Deploy to dev #215
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to dev | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
run_tests: | |
uses: ./.github/workflows/test.yml | |
secrets: inherit | |
generate_image_tags: | |
uses: ./.github/workflows/generate_image_tags.yml | |
secrets: inherit | |
build_images: | |
uses: ./.github/workflows/build.yml | |
secrets: inherit | |
deploy: | |
needs: | |
- run_tests | |
- build_images | |
- generate_image_tags | |
runs-on: ubuntu-20.04 | |
env: | |
API_IMAGE_TAG: ${{ needs.generate_image_tags.outputs.API_IMAGE_TAG }} | |
AM_CLEANUP_IMAGE_TAG: ${{ needs.generate_image_tags.outputs.AM_CLEANUP_IMAGE_TAG }} | |
RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG: ${{ needs.generate_image_tags.outputs.RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG }} | |
THUMBNAIL_REFRESH_IMAGE_TAG: ${{ needs.generate_image_tags.outputs.THUMBNAIL_REFRESH_IMAGE_TAG }} | |
ACCOUNT_SPACE_UPDATER_IMAGE_TAG: ${{ needs.generate_image_tags.outputs.ACCOUNT_SPACE_UPDATER_IMAGE_TAG }} | |
defaults: | |
run: | |
working-directory: ./terraform/test_cluster | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
cli_config_credentials_token: ${{ secrets.TERRAFORM_API_TOKEN }} | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
# Note that while Terraform requires us to pass a values for the staging images below, they won't be used because | |
# the -target option restricts terraform to just updating the dev deployment | |
- name: Terraform Plan | |
id: plan | |
run: | | |
terraform plan -no-color -input=false \ | |
-var="stela_dev_image=$API_IMAGE_TAG" \ | |
-var="stela_staging_image=$API_IMAGE_TAG" \ | |
-var="archivematica_cleanup_dev_image=$AM_CLEANUP_IMAGE_TAG" \ | |
-var="archivematica_cleanup_staging_image=$AM_CLEANUP_IMAGE_TAG" \ | |
-var="record_thumbnail_dev_lambda_image=$RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG" \ | |
-var="record_thumbnail_staging_lambda_image=$RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG" \ | |
-var="thumbnail_refresh_dev_image=$THUMBNAIL_REFRESH_IMAGE_TAG" \ | |
-var="thumbnail_refresh_staging_image=$THUMBNAIL_REFRESH_IMAGE_TAG" \ | |
-var="account_space_updater_dev_lambda_image=$ACCOUNT_SPACE_UPDATER_IMAGE_TAG" \ | |
-var="account_space_updater_staging_lambda_image=$ACCOUNT_SPACE_UPDATER_IMAGE_TAG" \ | |
-target=kubernetes_deployment.stela_dev \ | |
-target=kubernetes_cron_job_v1.archivematica_cleanup_dev \ | |
-target=aws_lambda_function.record_thumbnail_lambda \ | |
-target=kubernetes_cron_job_v1.thumbnail_refresh_dev \ | |
-target=aws_lambda_function.account_space_update_dev_lambda | |
- name: Terraform Apply | |
run: | | |
terraform apply -auto-approve -input=false \ | |
-var="stela_dev_image=$API_IMAGE_TAG" \ | |
-var="stela_staging_image=$API_IMAGE_TAG" \ | |
-var="archivematica_cleanup_dev_image=$AM_CLEANUP_IMAGE_TAG" \ | |
-var="archivematica_cleanup_staging_image=$AM_CLEANUP_IMAGE_TAG" \ | |
-var="record_thumbnail_dev_lambda_image=$RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG" \ | |
-var="record_thumbnail_staging_lambda_image=$RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG" \ | |
-var="thumbnail_refresh_dev_image=$THUMBNAIL_REFRESH_IMAGE_TAG" \ | |
-var="thumbnail_refresh_staging_image=$THUMBNAIL_REFRESH_IMAGE_TAG" \ | |
-var="account_space_updater_dev_lambda_image=$ACCOUNT_SPACE_UPDATER_IMAGE_TAG" \ | |
-var="account_space_updater_staging_lambda_image=$ACCOUNT_SPACE_UPDATER_IMAGE_TAG" \ | |
-target=kubernetes_deployment.stela_dev \ | |
-target=kubernetes_cron_job_v1.archivematica_cleanup_dev \ | |
-target=aws_lambda_function.record_thumbnail_lambda \ | |
-target=kubernetes_cron_job_v1.thumbnail_refresh_dev \ | |
-target=aws_lambda_function.account_space_update_dev_lambda |