-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (107 loc) · 3.74 KB
/
deploy.yml
File metadata and controls
122 lines (107 loc) · 3.74 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
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
name: Deploy
on:
workflow_dispatch:
push:
branches:
- main
jobs:
static:
name: Deploy
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Python Tools Setup
run: pip install -r requirements.txt
- name: Terraform Setup
uses: hashicorp/setup-terraform@v3
- name: Restore Terraform Cache
uses: actions/cache/restore@v4
with:
path: |
.terraform
.terraform.lock.hcl
key: terraform
- name: Terraform Init
env:
TF_TOKEN_app_terraform_io: ${{ secrets.TF_TOKEN_app_terraform_io }}
run: terraform init -input=false
- name: Save Terraform Cache
uses: actions/cache/save@v4
with:
path: |
.terraform
.terraform.lock.hcl
key: terraform
- name: Restore Defaults Cache
uses: actions/cache/restore@v4
with:
path: defaults.yaml
key: defaults
- name: Terraform Apply
env:
TF_TOKEN_app_terraform_io: ${{ secrets.TF_TOKEN_app_terraform_io }}
ACI_URL: ${{ secrets.ACI_URL }}
ACI_USERNAME: ${{ secrets.ACI_USERNAME }}
ACI_PASSWORD: ${{ secrets.ACI_PASSWORD }}
run: terraform apply -input=false -auto-approve
- name: Save Defaults Cache
uses: actions/cache/save@v4
with:
path: defaults.yaml
key: defaults
- name: Test Idempotency
env:
TF_TOKEN_app_terraform_io: ${{ secrets.TF_TOKEN_app_terraform_io }}
ACI_URL: ${{ secrets.ACI_URL }}
ACI_USERNAME: ${{ secrets.ACI_USERNAME }}
ACI_PASSWORD: ${{ secrets.ACI_PASSWORD }}
run: terraform plan -input=false -detailed-exitcode
- name: Test Health
env:
ACI_URL: ${{ secrets.ACI_URL }}
ACI_USERNAME: ${{ secrets.ACI_USERNAME }}
ACI_PASSWORD: ${{ secrets.ACI_PASSWORD }}
run: |
set -o pipefail
iac-test --data ./data --data ./defaults.yaml --templates ./tests/templates --output ./tests/results/aci |& tee test_output.txt
\cp tests/results/aci/log.html /tmp
- name: Webex Notifcation
if: always()
env:
TOKEN: ${{ secrets.WEBEX_TOKEN }}
ROOMID: ${{ secrets.WEBEX_ROOM_ID }}
MESSAGE: |
[**[${{ job.status }}] ${{ github.repository }} #${{ github.run_number }}**](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
* Commit: [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})[${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})
* Author: ${{ github.event.sender.login }}
* Branch: ${{ github.ref }} ${{ github.head_ref }}
* Event: ${{ github.event_name }}
run: |
FULL_MESSAGE=$MESSAGE`python .ci/render-wx.py`
echo $FULL_MESSAGE
URL="https://api.ciscospark.com/v1/messages/"
curl \
-X POST \
-H "Authorization:Bearer ${TOKEN}" \
--form "roomId=${ROOMID}" \
--form "markdown=${FULL_MESSAGE}" \
${URL}
- name: Checkout Github Pages
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Publish Github Pages
run: |
\cp /tmp/log.html ./
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git add log.html
git commit -a -m "Update test report" --allow-empty
git push