diff --git a/.github/workflows/build-all-images.yaml b/.github/workflows/build-all-images.yaml index a356368a..eb626fee 100644 --- a/.github/workflows/build-all-images.yaml +++ b/.github/workflows/build-all-images.yaml @@ -19,16 +19,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME balance_by_account: name: balance-by-account runs-on: ubuntu-latest @@ -38,16 +40,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME graphql: name: graphql runs-on: ubuntu-latest @@ -57,16 +61,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME request_create: name: request-create runs-on: ubuntu-latest @@ -76,16 +82,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME request_approve: name: request-approve runs-on: ubuntu-latest @@ -95,16 +103,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME request_by_id: name: request-by-id runs-on: ubuntu-latest @@ -114,16 +124,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME requests_by_account: name: requests-by-account runs-on: ubuntu-latest @@ -133,16 +145,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME transaction_by_id: name: transaction-by-id runs-on: ubuntu-latest @@ -152,16 +166,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME transactions_by_account: name: transactions-by-account runs-on: ubuntu-latest @@ -171,16 +187,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME event: name: event runs-on: ubuntu-latest @@ -190,16 +208,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME measure: name: measure runs-on: ubuntu-latest @@ -209,16 +229,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME auto_confirm: name: auto-confirm runs-on: ubuntu-latest @@ -228,16 +250,18 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME go_migrate: name: go-migrate runs-on: ubuntu-latest @@ -247,13 +271,15 @@ jobs: - uses: actions/checkout@v4 - name: build image run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx ./migrations/go-migrate # non root build context - - name: tag image - run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: tag image with current short sha and latest + run: | + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:${GITHUB_SHA:0:7} + docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest - name: log into container registry uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: push image - run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest \ No newline at end of file + - name: push images + run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME \ No newline at end of file diff --git a/client/makefile b/client/makefile index 800cfbca..1e29dcad 100644 --- a/client/makefile +++ b/client/makefile @@ -177,5 +177,6 @@ date: test-env-arg: ifndef ENV - $(error trailing ENV assignment missing, e.g. make test ENV=dev) + $(info trailing ENV assignment missing, e.g. make env ENV=dev|stg|prod, defaulting to 'local') +ENV=local endif \ No newline at end of file diff --git a/make/ecr-lambda.mk b/make/ecr-lambda.mk index 2351dd5e..183a36b7 100644 --- a/make/ecr-lambda.mk +++ b/make/ecr-lambda.mk @@ -22,8 +22,11 @@ clean-image: ###################### globally required ###################### initial-deploy: + @echo "build" @$(MAKE) -s build-image + @echo "tag" @$(MAKE) -s tag-dev-image + @echo "push" @$(MAKE) -s push-dev-image deploy: diff --git a/make/shared.mk b/make/shared.mk index 339587cf..a03e4b7c 100644 --- a/make/shared.mk +++ b/make/shared.mk @@ -19,7 +19,8 @@ endif test-env-arg: ifndef ENV - $(error trailing ENV assignment missing, e.g. make test ENV=dev) + $(info trailing ENV assignment missing, e.g. make env ENV=dev|stg|prod, defaulting to 'local') +ENV=local endif clean-log: diff --git a/makefile b/makefile index 537cf598..372816ad 100644 --- a/makefile +++ b/makefile @@ -277,7 +277,8 @@ get-secrets: ### arg tests test-env-arg: ifndef ENV - $(error trailing ENV assignment missing, e.g. make all ENV=stg) + $(info trailing ENV assignment missing, e.g. make env ENV=dev|stg|prod, defaulting to 'local') +ENV=local endif test-cmd-arg: diff --git a/migrations/makefile b/migrations/makefile index d2bd0681..19a3c755 100644 --- a/migrations/makefile +++ b/migrations/makefile @@ -186,7 +186,8 @@ endif test-env-arg: ifndef ENV - $(error trailing ENV assignment missing, e.g. make test ENV=dev) + $(info trailing ENV assignment missing, e.g. make env ENV=dev|stg|prod, defaulting to 'local') +ENV=local endif test-branch-arg: diff --git a/services/makefile b/services/makefile index f69d05d5..80b862bd 100644 --- a/services/makefile +++ b/services/makefile @@ -30,7 +30,8 @@ print: ### arg tests test-env-arg: ifndef ENV - $(error trailing ENV assignment missing, e.g. make all ENV=stg) + $(info trailing ENV assignment missing, e.g. make env ENV=dev|stg|prod, defaulting to 'local') +ENV=local endif test-cmd-arg: diff --git a/tests/makefile b/tests/makefile index f3ff222e..df4bd514 100644 --- a/tests/makefile +++ b/tests/makefile @@ -36,7 +36,8 @@ test-k8s: test-env-arg: ifndef ENV - $(error trailing ENV assignment missing, e.g. make test ENV=dev) + $(info trailing ENV assignment missing, e.g. make env ENV=dev|stg|prod, defaulting to 'local') +ENV=local endif test-env-file: @@ -59,5 +60,4 @@ get-secrets: --app-name $(APP_NAME) \ --env $(ENV) env: - @$(MAKE) -s test-env-arg @$(MAKE) get-secrets \ No newline at end of file