Release Charts #446
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Charts | |
on: | |
push: | |
branches: | |
- v6.3 | |
paths: | |
- 'charts/**' | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: "Why trigger?" | |
required: true | |
type: string | |
jobs: | |
release: | |
name: release | |
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions | |
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token | |
runs-on: ubuntu-latest | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
steps: | |
- uses: dev-drprasad/delete-tag-and-release@v0.2.1 | |
with: | |
delete_release: true # default: true | |
delete_draft_release: true # default: false; only applicable if delete_release == true | |
tag_name: deepflow-agent-6.3.9 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: dev-drprasad/delete-tag-and-release@v0.2.1 | |
with: | |
delete_release: true # default: true | |
delete_draft_release: true # default: false; only applicable if delete_release == true | |
tag_name: deepflow-6.3.9 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Copy DeepFlow Agent chart | |
run: | | |
cp -rf charts/deepflow-agent charts/deepflow/charts/ | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
- name: Install Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.9.0 | |
- name: Run chart-releaser | |
uses: helm/chart-releaser-action@v1.4.0 | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: helm index | |
run: | | |
rm -rf index.current | |
curl -o index.current https://deepflow-ce.oss-cn-beijing.aliyuncs.com/chart/stable/index.yaml||true | |
helm repo index .cr-release-packages/ --url https://deepflow-ce.oss-cn-beijing.aliyuncs.com/chart/latest/ --merge index.current | |
- uses: manyuanrong/setup-ossutil@v2.0 | |
with: | |
endpoint: "oss-accelerate.aliyuncs.com" | |
access-key-id: "${{ secrets.ALIYUN_OSS_ACCESS_KEY }}" | |
access-key-secret: "${{ secrets.ALIYUN_OSS_SECRETS_KEY }}" | |
- name: upload chart index | |
run: | | |
ossutil cp -rf .cr-release-packages/index.yaml oss://deepflow-ce/chart/stable/ | |
ossutil cp -rf .cr-release-packages/deepflow-6.3.9.tgz oss://deepflow-ce/chart/latest/ | |
ossutil cp -rf .cr-release-packages/deepflow-agent-6.3.9.tgz oss://deepflow-ce/chart/latest/ | |
- name: push to deepflow repo | |
run: | | |
git clone https://github.com/deepflowio/deepflow.git -b gh-pages | |
mkdir -p .cr-release-packages-agent | |
mkdir -p .cr-release-packages | |
mv .cr-release-packages/deepflow-agent*.tgz .cr-release-packages-agent/ | |
helm repo index .cr-release-packages/ --url https://github.com/deepflowio/deepflow-charts/releases/download/deepflow-6.3.9/ --merge deepflow/index.yaml | |
helm repo index .cr-release-packages-agent/ --url https://github.com/deepflowio/deepflow-charts/releases/download/deepflow-agent-6.3.9/ --merge .cr-release-packages/index.yaml | |
rm -rf deepflow | |
gh repo clone deepflowio/deepflow | |
cd deepflow/ | |
git checkout -b gh-pages origin/gh-pages | |
cp -raf ../.cr-release-packages-agent/index.yaml ./index.yaml | |
git config --global user.name "action" | |
git config --global user.email "$action@users.noreply.github.com" | |
git remote set-url --push origin https://action:${{ secrets.PUSH_SECRET }}@github.com/deepflowio/deepflow/ | |
git add ./index.yaml | |
git commit -am "update charts" | |
git push | |
env: | |
GH_TOKEN: ${{ secrets.PUSH_SECRET }} | |
sync_image: | |
name: sync image | |
runs-on: ubuntu-latest | |
needs: | |
- release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install deps - socat | |
run: | | |
sudo apt-get update | |
sudo apt-get install socat conntrack ebtables ipset -y | |
- name: Install kube key | |
run: | | |
sudo curl -sfL https://get-kk.kubesphere.io | VERSION=v2.2.2 sh - | |
sudo chmod +x kk | |
sudo ./kk version | |
- name: Install k8s | |
run: | | |
sudo ./kk create cluster --with-kubernetes v1.22.10 -y | |
- name: Interact with the cluster | |
run: | | |
mkdir -p $HOME/.kube | |
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | |
sudo chown $(id -u):$(id -g) $HOME/.kube/config | |
kubectl get nodes | |
kubectl get sc | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to GitHub Docker Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: "ghcr.io" | |
username: "${{ github.repository_owner }}" | |
password: "${{ secrets.GHCR_PUSH_TOKEN }}" | |
- name: Log in to Docker Registry | |
uses: docker/login-action@v2 | |
with: | |
username: "deepflowce" | |
password: "${{ secrets.REGISTRY_PASS }}" | |
- name: Log in to ALIYUN Docker Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: "registry.cn-hongkong.aliyuncs.com" | |
username: "${{ secrets.REGISTRY_ALIYUN_USER }}" | |
password: "${{ secrets.REGISTRY_PASS }}" | |
- name: Log in to ALIYUN Docker Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: "registry.cn-beijing.aliyuncs.com" | |
username: "${{ secrets.REGISTRY_ALIYUN_USER }}" | |
password: "${{ secrets.REGISTRY_PASS }}" | |
- name: add deepflow helm repo | |
run: | | |
helm repo add deepflow https://deepflowio.github.io/deepflow-charts/ | |
helm repo update | |
- name: install deepflow | |
run: | | |
helm upgrade --install deepflow -n deepflow deepflow/deepflow --create-namespace --version 6.3.9 \ | |
-f test-values.yaml | |
- name: install skopeo | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install skopeo | |
- name: sync image | |
run: | | |
DEPENDSIMAGE=$(kubectl get pods -n deepflow -o jsonpath={.items[*].spec.containers[*].image}|awk -F" " '{for(i=1;i<=NF;i++) print $i}' |grep -v deepflow|sort -u) | |
for SYNCIMAGE in $DEPENDSIMAGE | |
do | |
SORTIMAGE=$(echo $SYNCIMAGE|awk -F/ '{print $NF}') | |
echo $SORTIMAGE | |
echo "skopeo copy -a docker://$SYNCIMAGE docker://deepflowce/$SORTIMAGE" | |
echo "skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-beijing.aliyuncs.com/deepflow-ce/$SORTIMAGE" | |
echo "skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-hongkong.aliyuncs.com/deepflow-ce/$SORTIMAGE" | |
echo "skopeo copy -a docker://$SYNCIMAGE docker://ghcr.io/deepflowio/deepflow-ce/$SORTIMAGE " | |
skopeo copy -a docker://$SYNCIMAGE docker://deepflowce/$SORTIMAGE | |
skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-beijing.aliyuncs.com/deepflow-ce/$SORTIMAGE | |
skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-hongkong.aliyuncs.com/deepflow-ce/$SORTIMAGE | |
skopeo copy -a docker://$SYNCIMAGE docker://ghcr.io/deepflowio/deepflow-ce/$SORTIMAGE | |
done |