Skip to content

Commit

Permalink
Merge pull request #401 from systemaccounting/400-make-env-local-default
Browse files Browse the repository at this point in the history
400 make env local default
  • Loading branch information
mxfactorial authored Dec 20, 2024
2 parents f7e7297 + 29649d1 commit 39eae2b
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 59 deletions.
130 changes: 78 additions & 52 deletions .github/workflows/build-all-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
- name: push images
run: docker push --all-tags ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME
3 changes: 2 additions & 1 deletion client/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions make/ecr-lambda.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion make/shared.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion migrations/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion services/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -59,5 +60,4 @@ get-secrets:
--app-name $(APP_NAME) \
--env $(ENV)
env:
@$(MAKE) -s test-env-arg
@$(MAKE) get-secrets

0 comments on commit 39eae2b

Please sign in to comment.