Skip to content

Merge pull request #47 from deepflowio/update-666 #463

Merge pull request #47 from deepflowio/update-666

Merge pull request #47 from deepflowio/update-666 #463

Workflow file for this run

name: Release Charts
on:
push:
branches:
- main
- 'feature-**'
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:
- 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: |
curl -o index.current https://deepflow-ce.oss-cn-beijing.aliyuncs.com/chart/latest/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/latest/
for file in $(ls .cr-release-packages/deepflow-*.tgz)
do
ossutil cp -rf $file oss://deepflow-ce/chart/latest/
done
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 \
-f test-values.yaml
- name: install skopeo
run: |
sudo apt-get update
sudo apt-get -y install skopeo
skopeo --version
- name: sync image
run: |
sleep 300
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 "
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://deepflowce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://registry.cn-beijing.aliyuncs.com/deepflow-ce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://registry.cn-hongkong.aliyuncs.com/deepflow-ce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://ghcr.io/deepflowio/deepflow-ce/$SORTIMAGE
done
- name: sync init container image
run: |
DEPENDSIMAGE=$(kubectl get pods -n deepflow -o jsonpath={.items[*].spec.initContainers[*].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 "
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://deepflowce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://registry.cn-beijing.aliyuncs.com/deepflow-ce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://registry.cn-hongkong.aliyuncs.com/deepflow-ce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://ghcr.io/deepflowio/deepflow-ce/$SORTIMAGE
done
release_stable_chart:
name: release stable chart
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') #### to stable
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: 'gh-pages'
- name: push to deepflow repo
run: |
gh repo clone deepflowio/deepflow
cd deepflow/
git checkout -b gh-pages origin/gh-pages
cp -raf ../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 }}
- 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 oss://deepflow-ce/chart/latest/index.yaml oss://deepflow-ce/chart/stable/
- name: build sealos cluster image
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: 78
repository: labring/cluster-image
body: |
/imagebuild_apps deepflow stable
token: "${{ secrets.PUSH_SECRET }}"
- name: build sealos cluster image
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: 78
repository: labring/cluster-image
body: |
/imagebuild_apps deepflow ${{ github.ref_name }}
token: "${{ secrets.PUSH_SECRET }}"
- name: build kubesphere helm repo
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: 266
repository: kubesphere/helm-charts
body: |
/build-latest-app
token: "${{ secrets.PUSH_SECRET }}"
- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Charts
repo: deepflowio/deepflow-charts
token: ${{ secrets.PUSH_SECRET }}
ref: 'v6.1'
inputs: '{ "ref": "Release"}'
- name: Install k8s
run: |
sleep 30
- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Charts
repo: deepflowio/deepflow-charts
token: ${{ secrets.PUSH_SECRET }}
ref: 'v6.2'
inputs: '{ "ref": "Release"}'
- name: Install k8s
run: |
sleep 30
- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Charts
repo: deepflowio/deepflow-charts
token: ${{ secrets.PUSH_SECRET }}
ref: 'v6.3'
inputs: '{ "ref": "Release"}'
- name: Install k8s
run: |
sleep 30
- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Charts
repo: deepflowio/deepflow-charts
token: ${{ secrets.PUSH_SECRET }}
ref: 'v6.4'
inputs: '{ "ref": "Release"}'