-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (75 loc) · 3.31 KB
/
dev_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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 }}
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" \
-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
- 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" \
-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