Skip to content

fix(deps): update module github.com/hashicorp/terraform-plugin-framework-timeouts to v0.7.0 #2120

fix(deps): update module github.com/hashicorp/terraform-plugin-framework-timeouts to v0.7.0

fix(deps): update module github.com/hashicorp/terraform-plugin-framework-timeouts to v0.7.0 #2120

name: Fabric Acceptance Tests
# This workflow determines whether a PR comes from an external fork
# (which requires approval from us) or from a branch on this repository
# (which means it was made by us and can run immediately). Once a PR
# is approved, the PR code gains access to secrets referenced in this
# workflow.
# The 'build' job and subsequent jobs, are executed only when the pull
# request is not a draft, regardless of whether it is from an internal
# branch or external fork.
# Any changes to this job, even from internal contributors, require heavy scrutiny.
on:
pull_request_target:
types: [ opened, synchronize, reopened, ready_for_review ]
paths:
- 'go.mod'
- 'go.sum'
- '**fabric**'
- '!LICENSE'
- '!**.md'
- '!website/**'
- '!docs/**'
- '!.github/ISSUE_TEMPLATE/**'
workflow_dispatch:
permissions:
#actions: write required to update OIDC subject claim template
pull-requests: read
contents: read
id-token: write
jobs:
authorize:
if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'pull_request_target' && github.event.pull_request.draft == false)
environment:
${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
'external' || 'internal' }}
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name == 'pull_request_target' && format('fabric-acctest-authorize-pr-{0}', github.event.pull_request.number) || 'fabric-acctest-authorize' }}
cancel-in-progress: true
steps:
- run: true
# The GitHub OIDC subject claim template has been customized at the repository level to include only the workflow name. Long-term, we should consider using the default template for tests.
build:
name: Build
needs: authorize
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version-file: './go.mod'
id: go
- name: Get dependencies
run: |
go mod download
- name: Build
run: |
go build -v .
test-PNFV:
name: Matrix Test
needs: build
runs-on: ubuntu-latest
env:
EQUINIX_API_ENDPOINT: "https://uatapi.equinix.com"
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
version:
- stable
terraform:
- '1.5'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version-file: './go.mod'
id: go
- name: Get dependencies
run: |
go mod download
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: TF Fabric PNFV acceptance tests
shell: bash
timeout-minutes: 180
env:
TF_ACC: "1"
TF_ACC_FABRIC_CONNECTIONS_TEST_DATA: ${{ secrets.TF_ACC_FABRIC_CONNECTIONS_TEST_DATA }}
TF_ACC_FABRIC_DEDICATED_PORTS: ${{ secrets.TF_ACC_FABRIC_DEDICATED_PORTS }}
EQUINIX_API_CLIENTID: ${{ secrets.EQUINIX_API_CLIENTID_PNFV }}
EQUINIX_API_CLIENTSECRET: ${{ secrets.EQUINIX_API_CLIENTSECRET_PNFV }}
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }}
run: |
go test -json ./... -v -coverprofile coverage_pnfv.txt -covermode=atomic -count 1 -parallel 8 -run "(PNFV)" -timeout 180m > pnfv_test_output.json
- name: Upload PNFV Testing Log
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: pnfv_test_logs
path: pnfv_test_output.json
- name: Sweeper PNFV
if: ${{ always() }}
env:
EQUINIX_API_CLIENTID: ${{ secrets.EQUINIX_API_CLIENTID_PNFV }}
EQUINIX_API_CLIENTSECRET: ${{ secrets.EQUINIX_API_CLIENTSECRET_PNFV }}
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }}
SWEEP: "all" #Flag required to define the regions that the sweeper is to be ran in
SWEEP_ALLOW_FAILURES: "true" #Enable to allow Sweeper Tests to continue after failures
SWEEP_DIR: "./equinix"
run: |
# Added sweep-run to filter Fabric PNFV test
go test -json $(go list ./... | grep 'internal/sweep\|equinix/equinix') -v -timeout 180m -sweep=${SWEEP} -sweep-allow-failures=${SWEEP_ALLOW_FAILURES} -sweep-run=$(grep -or 'AddTestSweepers("[^"]*"' | grep "_fabric_" | cut -d '"' -f2 | paste -s -d, -)
- name: Upload coverage to Codecov
if: ${{ always() }}
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage_pnfv.txt
test-PFCR:
name: Matrix Test
needs: build
runs-on: ubuntu-latest
env:
EQUINIX_API_ENDPOINT: "https://uatapi.equinix.com"
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
version:
- stable
terraform:
- '1.5'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version-file: './go.mod'
id: go
- name: Get dependencies
run: |
go mod download
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: TF Fabric PFCR acceptance tests
shell: bash
timeout-minutes: 180
env:
TF_ACC: "1"
TF_ACC_FABRIC_CONNECTIONS_TEST_DATA: ${{ secrets.TF_ACC_FABRIC_CONNECTIONS_TEST_DATA }}
TF_ACC_FABRIC_DEDICATED_PORTS: ${{ secrets.TF_ACC_FABRIC_DEDICATED_PORTS }}
TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID: ${{ secrets.TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID }}
TF_ACC_FABRIC_STREAM_TEST_DATA: ${{ secrets.TF_ACC_FABRIC_STREAM_TEST_DATA }}
EQUINIX_API_CLIENTID: ${{ secrets.EQUINIX_API_CLIENTID_PFCR }}
EQUINIX_API_CLIENTSECRET: ${{ secrets.EQUINIX_API_CLIENTSECRET_PFCR }}
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }}
run: |
go test -json ./... -v -coverprofile coverage_pfcr.txt -covermode=atomic -count 1 -parallel 8 -run "(PFCR)" -timeout 180m | tee pfcr_test_output.json
- name: Upload PFCR Testing Log
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: pfcr_test_logs
path: pfcr_test_output.json
- name: Sweeper PFCR
if: ${{ always() }}
env:
EQUINIX_API_CLIENTID: ${{ secrets.EQUINIX_API_CLIENTID_PFCR }}
EQUINIX_API_CLIENTSECRET: ${{ secrets.EQUINIX_API_CLIENTSECRET_PFCR }}
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }}
SWEEP: "all" #Flag required to define the regions that the sweeper is to be ran in
SWEEP_ALLOW_FAILURES: "true" #Enable to allow Sweeper Tests to continue after failures
run: |
# Added sweep-run to filter Fabric PFCR test
go test $(go list ./... | grep 'internal/sweep\|equinix/equinix') -v -timeout 180m -sweep=${SWEEP} -sweep-allow-failures=${SWEEP_ALLOW_FAILURES} -sweep-run=$(grep -or 'AddTestSweepers("[^"]*"' | grep "_fabric_" | cut -d '"' -f2 | paste -s -d, -)
- name: Upload coverage to Codecov
if: ${{ always() }}
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage_pfcr.txt
test-STS-creds:
name: Matrix Test
needs: build
runs-on: ubuntu-latest
env:
EQUINIX_API_ENDPOINT: "https://uatapi.equinix.com"
EQUINIX_STS_ENDPOINT: "https://sts.uat.equinix.com"
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
version:
- stable
terraform:
- '1.5'
sts_config:
- name: "default"
env_var_name: "EQUINIX_TOKEN_EXCHANGE_SUBJECT_TOKEN"
set_custom_env_var: false
token_exchange_subject_token_env_var: null
- name: "custom"
env_var_name: "CUSTOM_STS_TOKEN"
set_custom_env_var: true
token_exchange_subject_token_env_var: "CUSTOM_STS_TOKEN"
steps:
- id: get_id_token
name: Get GitHub OIDC Token for PFCR
uses: actions/github-script@v6
with:
script: |
try {
const idToken = await core.getIDToken('gha-fcr-client');
console.log('Token generated with audience: gha-fcr-client');
core.setOutput('id_token', idToken);
} catch (error) {
console.error('Error getting OIDC token:', error.message);
core.setFailed(`Error getting OIDC token: ${error.message}`);
}
result-encoding: string
- name: Check out code into the Go module directory
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version-file: './go.mod'
id: go
- name: Get dependencies
run: |
go mod download
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: TF Fabric PFCR acceptance tests STS creds
timeout-minutes: 180
env:
TF_ACC: "1"
TF_ACC_FABRIC_CONNECTIONS_TEST_DATA: ${{ secrets.TF_ACC_FABRIC_CONNECTIONS_TEST_DATA }}
TF_ACC_FABRIC_DEDICATED_PORTS: ${{ secrets.TF_ACC_FABRIC_DEDICATED_PORTS }}
TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID: ${{ secrets.TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID }}
TF_ACC_FABRIC_STREAM_TEST_DATA: ${{ secrets.TF_ACC_FABRIC_STREAM_TEST_DATA }}
EQUINIX_TOKEN_EXCHANGE_SCOPE: ${{ secrets.EQUINIX_STS_AUTH_SCOPE_PFCR }}
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }}
${{ matrix.sts_config.env_var_name }}: ${{ steps.get_id_token.outputs.id_token }}
${{ matrix.sts_config.set_custom_env_var && 'EQUINIX_TOKEN_EXCHANGE_SUBJECT_TOKEN_ENV_VAR' || 'SKIP' }}: ${{ matrix.sts_config.token_exchange_subject_token_env_var || '' }}
run: |
go test ./... --run "(TestAccFabricCreatePort2SPConnection_PFCR|TestAccCloudRouterCreateOnlyRequiredParameters_PFCR)" -v -coverprofile coverage_pfcr.txt -covermode=atomic -count 1
upload-test-report:
name: Upload Testing Report
if: always()
needs: [ test-PNFV, test-PFCR ]
runs-on: ubuntu-latest
outputs:
message: ${{ steps.slack_message.outputs.message }}
test-status: ${{ steps.slack_message.outputs.test-status }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
id: go
- name: Set up Python3
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.13'
- name: Get dependencies
run: |
go install github.com/thogarty/go-junit-report/v2@latest
pip3 install junit2html
- name: Download PNFV Test Logs
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: pnfv_test_logs
- name: Download PFCR Test Logs
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: pfcr_test_logs
- name: Create HTML Testing Report
shell: bash
run: |
cat pfcr_test_output.json pnfv_test_output.json > uat_test_report.json
python3 ./scripts/generate_test_report.py uat_test_report.json uat_test_report.html
- name: Prepare slack message
id: slack_message
if: always()
shell: bash
run: |
html_file="uat_test_report.html"
total=$(grep -c '<tr>' "$html_file" | awk '{print $1-1}')
failures=$(grep -c 'class="status-fail"' "$html_file")
message="*Results:* $((total-failures)) Passed, $failures Failures"
echo "message<<EOF" >> $GITHUB_OUTPUT
echo "$message" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
if [[ $failures -gt 0 ]]; then
test_status="failure"
else
test_status="success"
fi
echo "test-status<<EOF" >> $GITHUB_OUTPUT
echo "$test_status" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "$message" >> $GITHUB_STEP_SUMMARY
- name: Notify Slack
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2
if: always()
with:
method: chat.postMessage
token: ${{ secrets.SLACK_ACCESS_TOKEN }}
payload: |
channel: digin-panthers-gha-automation
attachments:
- color: ${{ steps.slack_message.outputs.test-status == 'success' && 'good' || steps.slack_message.outputs.test-status == 'failure' && 'danger' }}
text: |
*Repository:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.repository }}>
*Workflow:* ${{ github.workflow }}
*Status:* ${{ steps.slack_message.outputs.test-status }}
*Results:* ${{ steps.slack_message.outputs.message }}
*Triggered by:* <@${{ github.actor }}>
- name: Upload HTML Testing Report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: UAT Terraform Acceptance Test Reports
path: |
uat_test_report.html
compression-level: 0