-
Notifications
You must be signed in to change notification settings - Fork 102
105 lines (97 loc) · 3.26 KB
/
nightly-tfe-ci.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
name: Nightly TFE Tests
on:
workflow_dispatch:
schedule:
# Monday-Friday at 7:30AM UTC (90 minutes after infrastructure rebuild)
- cron: '30 7 * * 1-5'
jobs:
instance:
runs-on: ubuntu-latest
steps:
- name: terraform-cloud/apply
uses: hashicorp-forge/terraform-cloud-action/apply@4adbe7eea886138ac10a4c09e63c5c568aaa6672
with:
organization: hashicorp-v2
workspace: tflocal-go-tfe-nightly
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}
wait: true
tests:
needs: instance
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
total: [ 4 ]
index: [ 0, 1, 2, 3 ]
steps:
- name: terraform-cloud/outputs
id: tflocal
uses: hashicorp-forge/terraform-cloud-action/outputs@4adbe7eea886138ac10a4c09e63c5c568aaa6672
with:
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}
organization: hashicorp-v2
workspace: tflocal-go-tfe-nightly
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: ./.github/actions/test-go-tfe
with:
matrix_index: ${{ matrix.index }}
matrix_total: ${{ matrix.total }}
address: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_address }}
token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_token }}
oauth-client-github-token: ${{ secrets.OAUTH_CLIENT_GITHUB_TOKEN }}
enterprise: "1"
tests-summarize:
needs: [ tests ]
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Check tests Status
run: |
if [ "${{ needs.tests.result }}" = "success" ]; then
exit 0
fi
exit 1
slack-notify:
needs: [ tests ]
if: ${{ needs.tests.result == 'failure' }}
runs-on: ubuntu-latest
steps:
- name: Send slack notification on failure
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # v1.23.0
with:
payload: |
{
"text": ":x::moon::sob: Nightly TFE tests *FAILED*",
"attachments": [
{
"color": "#C41E3A",
"blocks": [
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Workflow:*\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
cleanup:
runs-on: ubuntu-latest
needs: ["tests-summarize"]
if: "${{ always() }}"
steps:
- name: terraform-cloud/destroy
uses: hashicorp-forge/terraform-cloud-action/destroy@4adbe7eea886138ac10a4c09e63c5c568aaa6672
with:
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}
organization: hashicorp-v2
workspace: tflocal-go-tfe-nightly