-
Notifications
You must be signed in to change notification settings - Fork 3
204 lines (163 loc) · 5.92 KB
/
e2e.yaml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: E2E Tests
on:
pull_request:
branches:
- main
jobs:
actions:
runs-on: depot-ubuntu-22.04-4
env:
CGO_ENABLED: 0
permissions:
contents: read # required for checkout
id-token: write # mint AWS credentials through OIDC
steps:
- name: Cache Terraform Providers
id: cache-terraform
uses: actions/cache@v3
with:
path: .terraform
key: ${{ runner.os }}-${{ inputs.environment }}-${{ hashFiles('**/.terraform.lock.hcl') }}
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.5.7
terraform_wrapper: false
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com # set default value to work around https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-1401481855
aws-region: eu-west-2
role-to-assume: arn:aws:iam::211125377101:role/terraform-ci-test
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Go Init
uses: ./.github/actions/go_init
- name: Build the binary
run: |
set -xe
go get -v -t -d ./...
go build -o overmind main.go
- name: Run E2E Tests
env:
OVM_API_KEY: ${{ secrets.OVM_API_KEY }}
HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }}
run: |
set -xe
./overmind -v
terraform init
terraform plan -out=tfplan
terraform show -json tfplan > tfplan.json
ticket_link='${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
./overmind changes submit-plan \
--title "Test Change for e2e tests" \
--description "some description" \
--ticket-link "$ticket_link" \
tfplan.json \
> ./overmindtech-change-url
./overmind changes get-change \
--change "$(< ./overmindtech-change-url)" \
--format markdown \
> ./overmindtech-message
./overmind changes start-change \
--ticket-link "$ticket_link"
./overmind changes end-change \
--ticket-link "$ticket_link"
echo "E2E Tests Complete"
interactive:
runs-on: depot-ubuntu-22.04-4
env:
CGO_ENABLED: 0
permissions:
contents: read # required for checkout
id-token: write # mint AWS credentials through OIDC
steps:
- name: Cache Terraform Providers
id: cache-terraform
uses: actions/cache@v3
with:
path: .terraform
key: ${{ runner.os }}-${{ inputs.environment }}-${{ hashFiles('**/.terraform.lock.hcl') }}
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.5.7
terraform_wrapper: false
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com # set default value to work around https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-1401481855
aws-region: eu-west-2
role-to-assume: arn:aws:iam::211125377101:role/terraform-ci-test
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Go Init
uses: ./.github/actions/go_init
- name: Build the binary
run: |
set -xe
go get -v -t -d ./...
go build -o overmind main.go
- name: Run E2E Tests
env:
OVM_API_KEY: ${{ secrets.OVM_API_KEY }}
HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }}
TEABUG: pls
run: |
set -xe
go build -o overmind main.go
./overmind -v
terraform init
cp -a $(which terraform) . # provide a terraform binary to the containers below
docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_SESSION_TOKEN -e HONEYCOMB_API_KEY -e OVM_API_KEY -e TEABUG -v $PWD:/vhs -v ~/.aws:/root/.aws ghcr.io/charmbracelet/vhs /vhs/.github/e2eplan.tape
docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_SESSION_TOKEN -e HONEYCOMB_API_KEY -e OVM_API_KEY -e TEABUG -v $PWD:/vhs -v ~/.aws:/root/.aws ghcr.io/charmbracelet/vhs /vhs/.github/e2eapply.tape
sudo chown --recursive $(whoami) .
terraform apply -destroy -auto-approve
echo "E2E Tests Complete"
- name: debug output
if: always()
run: |
cat teabug.log
- name: Upload plan results
if: always()
uses: actions/upload-artifact@v4
with:
name: plan.mp4
path: e2e/plan.*
- name: Upload apply results
if: always()
uses: actions/upload-artifact@v4
with:
name: apply.mp4
path: e2e/apply.*
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install pnpm
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 9
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
continue-on-error: false
- name: Lost Pixel
uses: lost-pixel/[email protected]
env:
LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }}