From b2d8f01a0476206ca46dd351de9e93b0e6fcfbd9 Mon Sep 17 00:00:00 2001 From: KevFan Date: Wed, 18 Oct 2023 09:44:53 +0100 Subject: [PATCH] workflow: set branch name tag for non-main branch using docker/metadata-action --- .github/workflows/build-image.yaml | 13 +++---------- .github/workflows/e2e.yaml | 10 ---------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index 099c78e3..53ccdb02 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -8,7 +8,6 @@ on: tags: ['*'] env: - IMG_TAGS: ${{ github.sha }} IMG_REGISTRY_HOST: quay.io IMG_REGISTRY_ORG: kuadrant MAIN_BRANCH_NAME: main @@ -26,14 +25,6 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 -# - name: Add latest tag -# if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} -# run: | -# echo "IMG_TAGS=${{ env.IMG_TAGS }} latest" >> $GITHUB_ENV -# - name: Add branch name tag -# if: ${{ github.ref_name != env.MAIN_BRANCH_NAME }} -# run: | -# echo "IMG_TAGS=${{ env.IMG_TAGS }} ${{ github.ref_name }}" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx @@ -46,7 +37,9 @@ jobs: ${{ env.IMG_REGISTRY_HOST}}/${{ env.IMG_REGISTRY_ORG }}/limitador tags: | # set latest tag for main branch - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} + type=raw,value=latest,enable=${{ github.ref_name == env.MAIN_BRANCH_NAME }} + # set branch name tag for non-main branches + type=raw,value=${{ github.ref_name }},enable=${{ github.ref_name != env.MAIN_BRANCH_NAME }} type=sha - name: Login to container registry uses: docker/login-action@v2 diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 27e4ade1..83af14a6 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -33,14 +33,6 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max load: true -# - name: Build Limitador Image -# id: build-image -# uses: redhat-actions/buildah-build@v2 -# with: -# image: limitador-testing -# tags: latest -# dockerfiles: | -# ./Dockerfile - name: Create k8s Kind Cluster uses: helm/kind-action@v1.8.0 with: @@ -54,8 +46,6 @@ jobs: - name: Load limitador docker image run: | kind load docker-image ${{ steps.meta.outputs.tags }} -n limitador-local -# docker save -o image.tar ${{ steps.meta.outputs.tags }} -# kind load image-archive --name limitador-local image.tar - name: Deploy limitador run: | kubectl apply -f limitador-server/e2e/file-watcher/configmap.yaml