Skip to content

Nightly TFE Tests

Nightly TFE Tests #491

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
timeout-minutes: 20
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: [ 1 ]
index: [ 0 ]
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