From e37583a0f1e741d9c1a14e9cecd4ae5321c6397d Mon Sep 17 00:00:00 2001 From: stoneshi-yunify Date: Thu, 5 Sep 2024 12:14:29 +0800 Subject: [PATCH] add build action Signed-off-by: stoneshi-yunify --- .github/workflows/build.yaml | 63 +++++++++++++++++++++++++ config/samples/mongo-test.yaml | 2 +- deploy/webhook-deployment-template.yaml | 2 +- deploy/webhook-deployment.yaml | 2 +- 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..6a6edf3 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,63 @@ +name: Build + +on: + workflow_dispatch: + inputs: + tag: + description: "Image Tag" + default: "latest" + push: + branches: + - 'main' + - 'release-*' + tags: + - 'v*' + +jobs: + buildx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prepare + id: prepare + run: | + VERSION=latest + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + fi + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION=${{ github.event.inputs.tag }} + fi + echo ::set-output name=version::${VERSION} + + - name: Docker meta for kubesphere + id: meta + uses: docker/metadata-action@v3 + with: + images: docker.io/kubesphere/volume-initializer + tags: ${{ steps.prepare.outputs.version }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: docker.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Build and push Docker images + uses: docker/build-push-action@v2.4.0 + with: + context: . + file: ./Dockerfile + tags: ${{ steps.meta.outputs.tags }} + push: true + load: false + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 \ No newline at end of file diff --git a/config/samples/mongo-test.yaml b/config/samples/mongo-test.yaml index 130690d..00b485f 100644 --- a/config/samples/mongo-test.yaml +++ b/config/samples/mongo-test.yaml @@ -17,7 +17,7 @@ spec: spec: containers: - name: container-tle280 - image: 'registry.cn-hangzhou.aliyuncs.com/stoneshiyunify/mongodb:4.2.4-debian-10-r0' + image: 'bitnami/mongodb:4.2.4-debian-10-r0' ports: - name: http-27017 containerPort: 27017 diff --git a/deploy/webhook-deployment-template.yaml b/deploy/webhook-deployment-template.yaml index 5b3955f..0901dff 100644 --- a/deploy/webhook-deployment-template.yaml +++ b/deploy/webhook-deployment-template.yaml @@ -90,7 +90,7 @@ spec: spec: containers: - name: volume-initializer - image: registry.cn-hangzhou.aliyuncs.com/stoneshiyunify/volume-initializer:latest + image: kubesphere/volume-initializer:latest imagePullPolicy: Always args: ['--tls-cert-file=/etc/run/certs/tls.crt', '--tls-private-key-file=/etc/run/certs/tls.key'] ports: diff --git a/deploy/webhook-deployment.yaml b/deploy/webhook-deployment.yaml index bd25410..e5b4c52 100644 --- a/deploy/webhook-deployment.yaml +++ b/deploy/webhook-deployment.yaml @@ -90,7 +90,7 @@ spec: spec: containers: - name: volume-initializer - image: registry.cn-hangzhou.aliyuncs.com/stoneshiyunify/volume-initializer:latest + image: kubesphere/volume-initializer:latest imagePullPolicy: Always args: ['--tls-cert-file=/etc/run/certs/tls.crt', '--tls-private-key-file=/etc/run/certs/tls.key'] ports: