forked from cloudposse/github-action-atmos-terraform-apply
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegration-atmos-pro-tests.yml
More file actions
92 lines (77 loc) · 2.66 KB
/
Copy pathintegration-atmos-pro-tests.yml
File metadata and controls
92 lines (77 loc) · 2.66 KB
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
name: "Test - Atmos Pro Enabled"
on:
workflow_dispatch: {}
pull_request:
types: [opened, synchronize, reopened]
env:
AWS_REGION: us-east-2
# Permissions required for assuming AWS identity
permissions:
id-token: write
contents: read
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Setup
run: echo "Do setup"
test:
runs-on: ubuntu-latest
continue-on-error: true
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Atmos Test Config
shell: bash
run: |
mkdir -p ${{ runner.temp }}
cp ./tests/opentofu/atmos.yaml ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_APPLY_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_APPLY_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
cat ${{ runner.temp }}/atmos.yaml
- name: Plan Atmos Component
uses: cloudposse/github-action-atmos-terraform-plan@v5
with:
component: "foobar-atmos-pro"
stack: "plat-ue2-sandbox"
atmos-config-path: ${{ runner.temp }}
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Wait 15 sec to wait s3 bucket would be consistent (read after write consistency)
shell: bash
run: |
sleep 15;
- name: Apply Atmos Pro Component
id: current
uses: ./
with:
component: "foobar-atmos-pro"
stack: "plat-ue2-sandbox"
atmos-config-path: ${{ runner.temp }}
atmos-version: ">= 1.174.0"
outputs:
result: ${{ steps.current.outputs.status }}
assert:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: nick-fields/assert-action@v2
with:
expected: "succeeded"
actual: "${{ needs.test.outputs.result }}"
teardown:
runs-on: ubuntu-latest
needs: [assert]
if: ${{ always() }}
steps:
- name: Tear down
run: echo "Do Tear down"