Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/auto release action #513

Merged
merged 36 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3bcf85f
Changed needs for stop-runner to include the release step
252afh Jun 4, 2024
d9cbe6b
Convert to use make command for releasing terraform
252afh Jun 4, 2024
33b7d4e
Added tf_init
252afh Jun 4, 2024
463e19c
Add core infra repo
252afh Jun 4, 2024
df3d434
Add redbox infra config repo and settings to tf_init
252afh Jun 4, 2024
289b1d8
Fixed core infra path, changed config dir to correct config location
252afh Jun 4, 2024
8136aec
Step this repo 3 layers deep in github action to allow for hardcoded …
252afh Jun 4, 2024
924bbf5
Removed nesting of core infra repo
252afh Jun 4, 2024
20c2da4
Change path from absolute to relative
252afh Jun 4, 2024
421399d
Change redbox-copilot path to have +1 depth
252afh Jun 4, 2024
fa73c2d
restore main checkout path to the obvious one
252afh Jun 4, 2024
7dcc6a4
remove overriding infra-config dir in make tf_init command
252afh Jun 4, 2024
32e7a75
Removed defined redbox infra config dir from make tf_auto_deploy command
252afh Jun 4, 2024
f8c5f8c
Add configure aws credentials
252afh Jun 5, 2024
87d1b34
Added rolling back config and core infra repos to input reference
252afh Jun 5, 2024
7824006
Change release infra to use shared github action
252afh Jun 5, 2024
430a4f0
Updated auto deploy makefile command to take in image_tag as a var, u…
252afh Jun 5, 2024
5083c12
Removed accidentally copying entire Makefile back into itself
252afh Jun 5, 2024
ae17e57
Tied core apply terraform action to a particular commit hash
252afh Jun 5, 2024
779a027
Added lock timeout and build image to auto deploy make command
252afh Jun 6, 2024
767be84
Updated version of core action to use and added required var
252afh Jun 10, 2024
f512a9a
Updated version of core action to use
252afh Jun 10, 2024
65773e8
Updated version of core action to use
252afh Jun 10, 2024
9dbfbf5
Updated version of core action to use
252afh Jun 10, 2024
36283de
Missing passing config ref into core action
252afh Jun 10, 2024
c634e7b
Make sure auto deploy action can only update ecs
252afh Jun 10, 2024
c31a99a
Update ecr repo name in makefile to allow updating the tag
252afh Jun 10, 2024
34eec9b
Updated reference to core action version
252afh Jun 10, 2024
59a1d3a
Updated reference to core action version
252afh Jun 10, 2024
db7d8b6
Updated reference to core action version
252afh Jun 10, 2024
f580fd0
Removed commented out bit
252afh Jun 10, 2024
bd4497d
Removed AWS_S3_BUCKET as we no longer need that for logging
252afh Jun 10, 2024
69153a3
Update version of core action to use
252afh Jun 10, 2024
eb0b390
Converted to for loop in the update tag action
252afh Jun 11, 2024
c3dd237
Remove already defined image_tag var
252afh Jun 11, 2024
0ec1ce2
Reverted the workflow used to main in manual-release.yml
252afh Jun 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions .github/workflows/manual-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ on:
env:
description: 'Environment to deploy to'
required: false
image_tag:
image-tag:
description: 'The SHA of the Git commit to use'
required: false
core-repo-reference:
description: 'The SHA to set the core repo to'
required: false
default: refs/heads/main
config-repo-reference:
description: 'The SHA to set the config repo to'
required: false
default: refs/heads/main

permissions:
contents: read
Expand Down Expand Up @@ -52,44 +60,30 @@ jobs:
needs:
- set-vars
- start-runner
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/apply-terraform.yml@main
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/apply-terraform.yml@353925b7de65e86e6af44027fb2e17e577776319
252afh marked this conversation as resolved.
Show resolved Hide resolved
with:
APP_NAME: ${{ needs.set-vars.outputs.app-name }}
RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}
INFRASTRUCTURE_FOLDER: "infrastructure/aws"
PUBLIC_INFRA_DEPLOYMENT: true
ENVIRONMENT: ${{ github.event.inputs.env }}
INFRA_CONFIG_REPO: ${{ needs.set-vars.outputs.infra-config-repo }}
CORE_INFRA_REF: ${{ github.event.inputs.core-repo-reference }}
INFRA_CONFIG_REF: ${{ github.event.inputs.config-repo-reference }}
IMAGE_TAG: ${{ github.event.inputs.image-tag }}
secrets:
AWS_GITHUBRUNNER_PAT: ${{ secrets.AWS_GITHUBRUNNER_PAT}}
AWS_GITHUBRUNNER_PAT_USER: ${{ secrets.AWS_GITHUBRUNNER_PAT_USER }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}

# release:
# runs-on: ${{ needs.start-runner.outputs.label }}
# needs:
# - set-vars
# - start-runner
# steps:
# - uses: actions/checkout@v3
#
# - name: Set up Python 3.11
# uses: actions/setup-python@v3
# with:
# python-version: "3.11"
#
# - name: Make release
# run: |
# make tf_auto_deploy env=${{ github.event.inputs.env }} IMAGE_TAG=${{ github.event.inputs.image_tag }}

stop-runner:
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml@main
if: needs.start-runner.outputs.use-persisted == 0 && always()
needs:
- set-vars
- start-runner
- build-image
- release-terraform
with:
RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}
EC2_INSTANCE_ID: ${{ needs.start-runner.outputs.ec2-instance-id }}
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ docker_push:

.PHONY: docker_update_tag
docker_update_tag:
lcardno10 marked this conversation as resolved.
Show resolved Hide resolved
MANIFEST=$$(aws ecr batch-get-image --repository-name $(ECR_REPO_NAME) --image-ids imageTag=$(IMAGE_TAG) --query 'images[].imageManifest' --output text) && \
aws ecr put-image --repository-name $(ECR_REPO_NAME) --image-tag $(tag) --image-manifest "$$MANIFEST"
for service in django-app core-api worker; do \
MANIFEST=$$(aws ecr batch-get-image --repository-name $(ECR_REPO_NAME)-$$service --image-ids imageTag=$(IMAGE_TAG) --query 'images[].imageManifest' --output text) && \
aws ecr put-image --repository-name $(ECR_REPO_NAME)-$$service--image-tag $(tag) --image-manifest "$$MANIFEST"
done


# Ouputs the value that you're after - usefx ul to get a value i.e. IMAGE_TAG out of the Makefile
Expand Down Expand Up @@ -186,7 +188,7 @@ tf_apply_universal: ## Apply terraform
.PHONY: tf_auto_apply
tf_auto_apply: ## Auto apply terraform
make tf_set_workspace && \
terraform -chdir=./infrastructure/aws apply -auto-approve -var-file=$(CONFIG_DIR)/${env}-input-params.tfvars ${tf_build_args}
terraform -chdir=./infrastructure/aws apply -auto-approve -lock-timeout=300s -var-file=$(CONFIG_DIR)/${env}-input-params.tfvars ${tf_build_args} -target="module.django-app" -target="module.core-api" -target="module.worker"

.PHONY: tf_destroy
tf_destroy: ## Destroy terraform
Expand Down
Loading