generated from 18F/open-source-policy
-
Notifications
You must be signed in to change notification settings - Fork 4
106 lines (98 loc) · 3.22 KB
/
apply.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
name: apply
on:
push:
branches:
- main
env:
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
BUCKET: "${{ secrets.BUCKET }}"
REGION: "${{ secrets.REGION }}"
KEY: "ssb-tfstate"
ENCRYPT: "true"
jobs:
apply-staging:
name: apply (staging)
runs-on: ubuntu-latest
environment: staging
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_VAR_cf_username: ${{ secrets.TF_VAR_cf_username }}
TF_VAR_cf_password: ${{ secrets.TF_VAR_cf_password }}
TF_VAR_aws_access_key_id: ${{ secrets.TF_VAR_aws_access_key_id }}
TF_VAR_aws_secret_access_key: ${{ secrets.TF_VAR_aws_secret_access_key }}
TERRAFORM_PRE_RUN: |
./install-tools.sh
cp helm /usr/local/bin/
cp kubectl /usr/local/bin/
cp aws-iam-authenticator /usr/local/bin/
aws-iam-authenticator help
steps:
- name: checkout
uses: actions/checkout@v3
- name: prep applications
run: |
./app-setup-eks.sh
./app-setup-solrcloud.sh
./app-setup-smtp.sh
- name: terraform apply (staging)
uses: dflook/terraform-apply@v1
with:
path: .
label: staging
workspace: staging
var_file: terraform.staging.tfvars
backend_config: >
bucket=${{ env.BUCKET }},
key=${{ env.KEY }},
region=${{ env.REGION }},
encrypt=${{ env.ENCRYPT }},
access_key=${{ env.AWS_ACCESS_KEY_ID }},
secret_key=${{ env.AWS_SECRET_ACCESS_KEY }}
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
- name: test staging environment
run: echo staging tests ok # TODO staging smoke tests
apply-production:
needs: apply-staging
name: apply (production)
runs-on: ubuntu-latest
environment: production
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_VAR_cf_username: ${{ secrets.TF_VAR_cf_username }}
TF_VAR_cf_password: ${{ secrets.TF_VAR_cf_password }}
TF_VAR_aws_access_key_id: ${{ secrets.TF_VAR_aws_access_key_id }}
TF_VAR_aws_secret_access_key: ${{ secrets.TF_VAR_aws_secret_access_key }}
TERRAFORM_PRE_RUN: |
./install-tools.sh
cp helm /usr/local/bin/
cp kubectl /usr/local/bin/
cp aws-iam-authenticator /usr/local/bin/
aws-iam-authenticator help
steps:
- name: checkout
uses: actions/checkout@v3
- name: prep applications
run: |
./app-setup-eks.sh
./app-setup-solrcloud.sh
./app-setup-smtp.sh
- name: terraform apply (production)
uses: dflook/terraform-apply@v1
with:
path: .
label: production
workspace: default
var_file: terraform.production.tfvars
backend_config: >
bucket=${{ env.BUCKET }},
key=${{ env.KEY }},
region=${{ env.REGION }},
encrypt=${{ env.ENCRYPT }},
access_key=${{ env.AWS_ACCESS_KEY_ID }},
secret_key=${{ env.AWS_SECRET_ACCESS_KEY }}