From 420f601a68b33e44fcc59b7d560a222e0f65a9ee Mon Sep 17 00:00:00 2001 From: Prashant Shahi Date: Wed, 9 Feb 2022 20:35:25 +0530 Subject: [PATCH] =?UTF-8?q?ci(push):=20=F0=9F=91=B7=20add=20develop=20bran?= =?UTF-8?q?ch=20and=20remove=20second=20tag=20(#694)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Prashant Shahi --- .github/workflows/push.yaml | 25 +++++++++++++++++++------ Makefile | 10 ---------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 76385569e1..7cf2f7e0a3 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -7,6 +7,7 @@ on: - 'frontend/**' branches: - main + - develop tags: - ^v[0-9]+.[0-9]+.[0-9]+$ @@ -33,10 +34,16 @@ jobs: - name: Get branch name id: branch-name uses: tj-actions/branch-names@v5.1 + - name: Set docker tag environment + run: | + if [ '${{ steps.branch-name.outputs.is_tag }}' == 'true' ]; then + echo "DOCKER_TAG=${{ steps.branch-name.outputs.tag }}" >> $GITHUB_ENV + elif [ '${{ steps.branch-name.outputs.current_branch }}' == 'main' ]; then + echo "DOCKER_TAG=latest" >> $GITHUB_ENV + else + echo "DOCKER_TAG=${{ steps.branch-name.outputs.current_branch }}" >> $GITHUB_ENV + fi - name: Build and push docker image - env: - DOCKER_TAG: ${{ steps.short-sha.outputs.sha }} - DOCKER_SECOND_TAG: ${{ steps.branch-name.outputs.current_branch }} run: make build-push-query-service image-build-and-push-frontend: @@ -69,8 +76,14 @@ jobs: - name: Get branch name id: branch-name uses: tj-actions/branch-names@v5.1 + - name: Set docker tag environment + run: | + if [ '${{ steps.branch-name.outputs.is_tag }}' == 'true' ]; then + echo "DOCKER_TAG=${{ steps.branch-name.outputs.tag }}" >> $GITHUB_ENV + elif [ '${{ steps.branch-name.outputs.current_branch }}' == 'main' ]; then + echo "DOCKER_TAG=latest" >> $GITHUB_ENV + else + echo "DOCKER_TAG=${{ steps.branch-name.outputs.current_branch }}" >> $GITHUB_ENV + fi - name: Build and push docker image - env: - DOCKER_TAG: ${{ steps.short-sha.outputs.sha }} - DOCKER_SECOND_TAG: ${{ steps.branch-name.outputs.current_branch }} run: make build-push-frontend diff --git a/Makefile b/Makefile index b8528257ed..625a0c6953 100644 --- a/Makefile +++ b/Makefile @@ -45,13 +45,8 @@ build-push-frontend: @echo "------------------" @echo "--> Building and pushing frontend docker image" @echo "------------------" -ifndef DOCKER_SECOND_TAG @cd $(FRONTEND_DIRECTORY) && \ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) . -else - @cd $(FRONTEND_DIRECTORY) && \ - docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_SECOND_TAG) . -endif # Steps to build and push docker image of query service .PHONY: build-query-service-amd64 build-push-query-service @@ -68,13 +63,8 @@ build-push-query-service: @echo "------------------" @echo "--> Building and pushing query-service docker image" @echo "------------------" -ifndef DOCKER_SECOND_TAG @cd $(QUERY_SERVICE_DIRECTORY) && \ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/arm64,linux/amd64 --build-arg LD_FLAGS=$(LD_FLAGS) --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) . -else - @cd $(QUERY_SERVICE_DIRECTORY) && \ - docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/arm64,linux/amd64 --build-arg LD_FLAGS=$(LD_FLAGS) --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_SECOND_TAG) . -endif # Steps to build and push docker image of flattener .PHONY: build-flattener-amd64 build-push-flattener