2023-03-06 21:57:55 +00:00
|
|
|
name: CI
|
|
|
|
on:
|
2023-03-21 18:13:40 +00:00
|
|
|
pull_request:
|
2023-05-01 17:52:41 +00:00
|
|
|
# The default types for pull_request are [ opened, synchronize, reopened ].
|
|
|
|
# This is insufficient for our needs, since we're skipping stuff on PRs in
|
|
|
|
# draft mode. By adding the ready_for_review type, when a draft pr is marked
|
|
|
|
# ready, we run everything, including the stuff we'd have skipped up until now.
|
2023-07-05 21:19:49 +00:00
|
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
2023-03-06 21:57:55 +00:00
|
|
|
push:
|
2023-03-21 18:13:40 +00:00
|
|
|
branches:
|
2023-05-01 15:42:03 +00:00
|
|
|
- main
|
|
|
|
- release/**
|
2023-04-05 14:03:08 +00:00
|
|
|
workflow_dispatch:
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-07-04 15:07:05 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.head_ref || github.run_id }}-ci
|
|
|
|
cancel-in-progress: true
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-03-06 21:57:55 +00:00
|
|
|
jobs:
|
|
|
|
setup:
|
|
|
|
name: Setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2023-07-20 22:39:29 +00:00
|
|
|
compute-small: ${{ steps.setup-outputs.outputs.compute-small }}
|
|
|
|
compute-medium: ${{ steps.setup-outputs.outputs.compute-medium }}
|
|
|
|
compute-large: ${{ steps.setup-outputs.outputs.compute-large }}
|
|
|
|
compute-largem: ${{ steps.setup-outputs.outputs.compute-largem }}
|
|
|
|
compute-xlarge: ${{ steps.setup-outputs.outputs.compute-xlarge }}
|
2023-03-06 21:57:55 +00:00
|
|
|
enterprise: ${{ steps.setup-outputs.outputs.enterprise }}
|
2023-07-12 19:26:00 +00:00
|
|
|
go-tags: ${{ steps.setup-outputs.outputs.go-tags }}
|
2023-03-06 21:57:55 +00:00
|
|
|
steps:
|
2023-07-12 19:26:00 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2023-07-05 21:19:49 +00:00
|
|
|
- id: setup-outputs
|
|
|
|
name: Setup outputs
|
|
|
|
run: |
|
|
|
|
github_repository="${{ github.repository }}"
|
2023-03-06 21:57:55 +00:00
|
|
|
|
2023-07-05 21:19:49 +00:00
|
|
|
if [ "${github_repository##*/}" == "vault-enterprise" ] ; then
|
|
|
|
# shellcheck disable=SC2129
|
2023-07-20 22:39:29 +00:00
|
|
|
echo 'compute-small=["self-hosted","ondemand","linux","type=c6a.large"]' >> "$GITHUB_OUTPUT" # 2x vCPUs, 4 GiB RAM,
|
|
|
|
echo 'compute-medium=["self-hosted","ondemand","linux","type=c6a.xlarge"]' >> "$GITHUB_OUTPUT" # 4x vCPUs, 8 GiB RAM,
|
|
|
|
echo 'compute-large=["self-hosted","ondemand","linux","type=c6a.2xlarge"]' >> "$GITHUB_OUTPUT" # 8x vCPUs, 16 GiB RAM,
|
|
|
|
echo 'compute-largem=["self-hosted","ondemand","linux","type=m6a.2xlarge"]' >> "$GITHUB_OUTPUT" # 8x vCPUs, 32 GiB RAM,
|
|
|
|
echo 'compute-xlarge=["self-hosted","ondemand","linux","type=c6a.4xlarge"]' >> "$GITHUB_OUTPUT" # 16x vCPUs, 32 GiB RAM,
|
2023-07-05 21:19:49 +00:00
|
|
|
echo 'enterprise=1' >> "$GITHUB_OUTPUT"
|
2023-07-12 19:26:00 +00:00
|
|
|
echo 'go-tags=ent,enterprise' >> "$GITHUB_OUTPUT"
|
2023-07-05 21:19:49 +00:00
|
|
|
else
|
|
|
|
# shellcheck disable=SC2129
|
2023-07-20 22:39:29 +00:00
|
|
|
echo 'compute-small="ubuntu-latest"' >> "$GITHUB_OUTPUT" # 2x vCPUs, 7 GiB RAM, 14 GB SSD
|
|
|
|
echo 'compute-medium="custom-linux-small-vault-latest"' >> "$GITHUB_OUTPUT" # 8x vCPUs, 32 GiB RAM, 300 GB SSD
|
|
|
|
echo 'compute-large="custom-linux-medium-vault-latest"' >> "$GITHUB_OUTPUT" # 16x vCPUs, 64 GiB RAM, 600 GB SSD
|
|
|
|
echo 'compute-largem="custom-linux-medium-vault-latest"' >> "$GITHUB_OUTPUT" # 16x vCPUs, 64 GiB RAM, 600 GB SSD
|
|
|
|
echo 'compute-xlarge="custom-linux-xl-vault-latest"' >> "$GITHUB_OUTPUT" # 32x vCPUs, 128 GiB RAM, 1200 GB SSD
|
2023-07-05 21:19:49 +00:00
|
|
|
echo 'enterprise=' >> "$GITHUB_OUTPUT"
|
2023-07-12 19:26:00 +00:00
|
|
|
echo 'go-tags=' >> "$GITHUB_OUTPUT"
|
2023-07-05 21:19:49 +00:00
|
|
|
fi
|
2023-07-12 19:26:00 +00:00
|
|
|
- name: Ensure Go modules are cached
|
|
|
|
uses: ./.github/actions/set-up-go
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
no-restore: true # don't download them on a cache hit
|
|
|
|
|
2023-03-22 19:02:06 +00:00
|
|
|
diff-oss-ci:
|
|
|
|
name: Diff OSS
|
|
|
|
needs:
|
2023-07-05 21:19:49 +00:00
|
|
|
- setup
|
2023-03-22 19:02:06 +00:00
|
|
|
if: ${{ needs.setup.outputs.enterprise != '' && github.base_ref != '' }}
|
2023-07-20 22:39:29 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
2023-03-22 19:02:06 +00:00
|
|
|
steps:
|
2023-07-05 21:19:49 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- id: determine-branch
|
|
|
|
run: |
|
|
|
|
branch="${{ github.base_ref }}"
|
2023-03-22 19:02:06 +00:00
|
|
|
|
2023-07-05 21:19:49 +00:00
|
|
|
if [[ $branch = release/* ]] ; then
|
|
|
|
branch=${branch%%+ent}
|
2023-03-22 19:02:06 +00:00
|
|
|
|
2023-07-05 21:19:49 +00:00
|
|
|
# Add OSS remote
|
|
|
|
git config --global user.email "github-team-secret-vault-core@hashicorp.com"
|
|
|
|
git config --global user.name "hc-github-team-secret-vault-core"
|
|
|
|
git remote add oss https://github.com/hashicorp/vault.git
|
|
|
|
git fetch oss "$branch"
|
2023-03-22 19:02:06 +00:00
|
|
|
|
2023-07-05 21:19:49 +00:00
|
|
|
branch="oss/$branch"
|
|
|
|
else
|
|
|
|
branch="origin/$branch"
|
|
|
|
fi
|
2023-03-22 19:02:06 +00:00
|
|
|
|
2023-07-05 21:19:49 +00:00
|
|
|
echo "BRANCH=$branch" >> "$GITHUB_OUTPUT"
|
|
|
|
- id: diff
|
|
|
|
run: |
|
|
|
|
./.github/scripts/oss-diff.sh ${{ steps.determine-branch.outputs.BRANCH }} HEAD
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-07-21 17:15:14 +00:00
|
|
|
verify-changes:
|
|
|
|
name: Verify doc-ui only PRs
|
|
|
|
uses: ./.github/workflows/verify_changes.yml
|
|
|
|
|
2023-03-06 21:57:55 +00:00
|
|
|
test-go:
|
|
|
|
name: Run Go tests
|
|
|
|
needs:
|
2023-07-05 21:19:49 +00:00
|
|
|
- setup
|
2023-07-21 17:15:14 +00:00
|
|
|
- verify-changes
|
|
|
|
# Don't run this job for docs/ui only PRs
|
2023-03-30 20:27:42 +00:00
|
|
|
if: |
|
2023-07-21 17:15:14 +00:00
|
|
|
needs.verify-changes.outputs.is_docs_change == 'false' &&
|
|
|
|
needs.verify-changes.outputs.is_ui_change == 'false'
|
2023-03-06 21:57:55 +00:00
|
|
|
uses: ./.github/workflows/test-go.yml
|
|
|
|
with:
|
2023-04-27 13:41:49 +00:00
|
|
|
# The regular Go tests use an extra runner to execute the
|
|
|
|
# binary-dependent tests. We isolate them there so that the
|
|
|
|
# other tests aren't slowed down waiting for a binary build.
|
2023-07-20 13:07:20 +00:00
|
|
|
binary-tests: true
|
|
|
|
total-runners: 16
|
2023-03-06 21:57:55 +00:00
|
|
|
go-arch: amd64
|
2023-07-12 19:26:00 +00:00
|
|
|
go-tags: '${{ needs.setup.outputs.go-tags }},deadlock'
|
2023-07-20 22:39:29 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-21 18:13:40 +00:00
|
|
|
enterprise: ${{ needs.setup.outputs.enterprise }}
|
|
|
|
secrets: inherit
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-03-21 18:13:40 +00:00
|
|
|
test-go-race:
|
|
|
|
name: Run Go tests with data race detection
|
|
|
|
needs:
|
2023-07-05 21:19:49 +00:00
|
|
|
- setup
|
2023-07-21 17:15:14 +00:00
|
|
|
- verify-changes
|
|
|
|
# Don't run this job for docs/ui only PRs
|
2023-03-30 20:27:42 +00:00
|
|
|
if: |
|
2023-05-01 17:52:41 +00:00
|
|
|
github.event.pull_request.draft == false &&
|
2023-07-21 17:15:14 +00:00
|
|
|
needs.verify-changes.outputs.is_docs_change == 'false' &&
|
|
|
|
needs.verify-changes.outputs.is_ui_change == 'false'
|
2023-03-21 18:13:40 +00:00
|
|
|
uses: ./.github/workflows/test-go.yml
|
|
|
|
with:
|
2023-03-24 17:17:21 +00:00
|
|
|
total-runners: 16
|
|
|
|
env-vars: |
|
|
|
|
{
|
|
|
|
"VAULT_CI_GO_TEST_RACE": 1
|
|
|
|
}
|
2023-03-21 18:13:40 +00:00
|
|
|
extra-flags: '-race'
|
|
|
|
go-arch: amd64
|
2023-07-12 19:26:00 +00:00
|
|
|
go-tags: ${{ needs.setup.outputs.go-tags }}
|
2023-07-20 22:39:29 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-06 21:57:55 +00:00
|
|
|
enterprise: ${{ needs.setup.outputs.enterprise }}
|
2023-07-13 18:36:30 +00:00
|
|
|
name: "race"
|
2023-03-06 21:57:55 +00:00
|
|
|
secrets: inherit
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-03-24 17:17:21 +00:00
|
|
|
test-go-fips:
|
|
|
|
name: Run Go tests with FIPS configuration
|
2023-07-21 17:15:14 +00:00
|
|
|
# Only run this job for the enterprise repo if the PR is not docs/ui only
|
2023-03-24 17:17:21 +00:00
|
|
|
if: |
|
2023-05-01 17:52:41 +00:00
|
|
|
github.event.pull_request.draft == false &&
|
2023-03-24 17:17:21 +00:00
|
|
|
needs.setup.outputs.enterprise == 1 &&
|
2023-07-21 17:15:14 +00:00
|
|
|
needs.verify-changes.outputs.is_docs_change == 'false' &&
|
|
|
|
needs.verify-changes.outputs.is_ui_change == 'false'
|
2023-03-24 17:17:21 +00:00
|
|
|
needs:
|
2023-07-05 21:19:49 +00:00
|
|
|
- setup
|
2023-07-21 17:15:14 +00:00
|
|
|
- verify-changes
|
2023-03-24 17:17:21 +00:00
|
|
|
uses: ./.github/workflows/test-go.yml
|
|
|
|
with:
|
|
|
|
total-runners: 16
|
|
|
|
env-vars: |
|
|
|
|
{
|
|
|
|
"GOEXPERIMENT": "boringcrypto"
|
|
|
|
}
|
|
|
|
go-arch: amd64
|
2023-07-12 19:26:00 +00:00
|
|
|
go-tags: '${{ needs.setup.outputs.go-tags }},deadlock,cgo,fips,fips_140_2'
|
2023-07-20 22:39:29 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-24 17:17:21 +00:00
|
|
|
enterprise: ${{ needs.setup.outputs.enterprise }}
|
2023-07-13 18:36:30 +00:00
|
|
|
name: "fips"
|
2023-03-24 17:17:21 +00:00
|
|
|
secrets: inherit
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-03-22 19:02:06 +00:00
|
|
|
test-ui:
|
|
|
|
name: Test UI
|
2023-03-30 20:27:42 +00:00
|
|
|
# The test-ui job is only run on:
|
|
|
|
# - pushes to main and branches starting with "release/"
|
|
|
|
# - PRs where the branch starts with "ui/", "backport/ui/", "merge", or when base branch starts with "release/"
|
2023-07-13 18:36:30 +00:00
|
|
|
# - PRs with the "ui" label on GitHub
|
2023-03-30 20:27:42 +00:00
|
|
|
if: |
|
|
|
|
github.ref_name == 'main' ||
|
|
|
|
startsWith(github.ref_name, 'release/') ||
|
|
|
|
startsWith(github.head_ref, 'ui/') ||
|
|
|
|
startsWith(github.head_ref, 'backport/ui/') ||
|
2023-07-05 21:19:49 +00:00
|
|
|
startsWith(github.head_ref, 'merge') ||
|
2023-04-18 19:03:35 +00:00
|
|
|
contains(github.event.pull_request.labels.*.name, 'ui')
|
2023-03-22 19:02:06 +00:00
|
|
|
needs:
|
2023-07-05 21:19:49 +00:00
|
|
|
- setup
|
2023-03-22 19:02:06 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
2023-07-20 22:39:29 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-largem) }}
|
2023-03-22 19:02:06 +00:00
|
|
|
steps:
|
2023-07-05 21:19:49 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2023-07-12 19:26:00 +00:00
|
|
|
- uses: ./.github/actions/set-up-go
|
2023-07-05 21:19:49 +00:00
|
|
|
with:
|
2023-07-12 19:26:00 +00:00
|
|
|
github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-07-05 21:19:49 +00:00
|
|
|
# Setup node.js without caching to allow running npm install -g yarn (next step)
|
2023-07-20 22:39:29 +00:00
|
|
|
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
|
2023-07-05 21:19:49 +00:00
|
|
|
with:
|
|
|
|
node-version-file: './ui/package.json'
|
|
|
|
- id: install-yarn
|
|
|
|
run: |
|
|
|
|
npm install -g yarn
|
|
|
|
# Setup node.js with caching using the yarn.lock file
|
2023-07-20 22:39:29 +00:00
|
|
|
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
|
2023-07-05 21:19:49 +00:00
|
|
|
with:
|
|
|
|
node-version-file: './ui/package.json'
|
|
|
|
cache: yarn
|
|
|
|
cache-dependency-path: ui/yarn.lock
|
|
|
|
- id: install-browser
|
|
|
|
uses: browser-actions/setup-chrome@c485fa3bab6be59dce18dbc18ef6ab7cbc8ff5f1 # v1.2.0
|
|
|
|
- id: ui-dependencies
|
|
|
|
name: ui-dependencies
|
|
|
|
working-directory: ./ui
|
|
|
|
run: |
|
|
|
|
yarn install --frozen-lockfile
|
|
|
|
npm rebuild node-sass
|
|
|
|
- id: vault-auth
|
|
|
|
name: Authenticate to Vault
|
|
|
|
if: github.repository == 'hashicorp/vault-enterprise'
|
|
|
|
run: vault-auth
|
|
|
|
- id: secrets
|
|
|
|
name: Fetch secrets
|
|
|
|
if: github.repository == 'hashicorp/vault-enterprise'
|
|
|
|
uses: hashicorp/vault-action@130d1f5f4fe645bb6c83e4225c04d64cfb62de6e
|
|
|
|
with:
|
2023-03-22 19:02:06 +00:00
|
|
|
url: ${{ steps.vault-auth.outputs.addr }}
|
|
|
|
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }}
|
|
|
|
token: ${{ steps.vault-auth.outputs.token }}
|
|
|
|
secrets: |
|
|
|
|
kv/data/github/hashicorp/vault-enterprise/github-token token | PRIVATE_REPO_GITHUB_TOKEN;
|
|
|
|
kv/data/github/hashicorp/vault-enterprise/license license_1 | VAULT_LICENSE;
|
2023-07-05 21:19:49 +00:00
|
|
|
- id: setup-git
|
|
|
|
name: Setup Git
|
|
|
|
if: github.repository == 'hashicorp/vault-enterprise'
|
|
|
|
run: |
|
|
|
|
git config --global url."https://${{ steps.secrets.outputs.PRIVATE_REPO_GITHUB_TOKEN }}@github.com".insteadOf https://github.com
|
|
|
|
- id: build-go-dev
|
|
|
|
name: build-go-dev
|
|
|
|
run: |
|
|
|
|
rm -rf ./pkg
|
|
|
|
mkdir ./pkg
|
2023-03-22 19:02:06 +00:00
|
|
|
|
2023-07-05 21:19:49 +00:00
|
|
|
make ci-bootstrap dev
|
|
|
|
- id: test-ui
|
|
|
|
name: test-ui
|
|
|
|
env:
|
|
|
|
VAULT_LICENSE: ${{ steps.secrets.outputs.VAULT_LICENSE }}
|
|
|
|
run: |
|
|
|
|
export PATH="${PWD}/bin:${PATH}"
|
2023-03-22 19:02:06 +00:00
|
|
|
|
2023-07-05 21:19:49 +00:00
|
|
|
if [ "${{ github.repository }}" == 'hashicorp/vault' ] ; then
|
|
|
|
export VAULT_LICENSE="${{ secrets.VAULT_LICENSE }}"
|
|
|
|
fi
|
2023-03-22 19:02:06 +00:00
|
|
|
|
2023-07-05 21:19:49 +00:00
|
|
|
# Run Ember tests
|
|
|
|
cd ui
|
|
|
|
mkdir -p test-results/qunit
|
|
|
|
yarn test:oss
|
|
|
|
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
|
|
|
with:
|
|
|
|
name: test-results-ui
|
|
|
|
path: ui/test-results
|
|
|
|
if: success() || failure()
|
2023-07-07 17:52:01 +00:00
|
|
|
- uses: test-summary/action@62bc5c68de2a6a0d02039763b8c754569df99e3f # TSCCR: no entry for repository "test-summary/action"
|
2023-07-05 21:19:49 +00:00
|
|
|
with:
|
|
|
|
paths: "ui/test-results/qunit/results.xml"
|
|
|
|
show: "fail"
|
|
|
|
if: always()
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-03-24 14:39:17 +00:00
|
|
|
tests-completed:
|
|
|
|
needs:
|
2023-07-05 21:19:49 +00:00
|
|
|
- setup
|
|
|
|
- test-go
|
|
|
|
- test-ui
|
2023-07-12 19:26:00 +00:00
|
|
|
if: always()
|
2023-07-20 22:39:29 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
2023-03-24 14:39:17 +00:00
|
|
|
steps:
|
2023-07-05 21:19:49 +00:00
|
|
|
- run: |
|
|
|
|
tr -d '\n' <<< '${{ toJSON(needs.*.result) }}' | grep -q -v -E '(failure|cancelled)'
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-07-07 17:52:01 +00:00
|
|
|
notify-tests-completed-failures-oss:
|
|
|
|
if: ${{ always() && github.repository == 'hashicorp/vault' && needs.tests-completed.result == 'failure' && (github.ref_name == 'main' || startsWith(github.ref_name, 'release/')) }}
|
2023-07-05 21:19:49 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
needs:
|
|
|
|
- tests-completed
|
|
|
|
steps:
|
|
|
|
- name: send-notification
|
|
|
|
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
|
|
|
|
# We intentionally aren't using the following here since it's from an internal repo
|
|
|
|
# uses: hashicorp/cloud-gha-slack-notifier@730a033037b8e603adf99ebd3085f0fdfe75e2f4 #v1
|
|
|
|
env:
|
|
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
|
|
with:
|
|
|
|
channel-id: "C05AABYEA9Y" # sent to #feed-vault-ci-official
|
|
|
|
payload: |
|
|
|
|
{"text":"OSS test failures on ${{ github.ref_name }}","blocks":[{"type":"header","text":{"type":"plain_text","text":":rotating_light: OSS test failures :rotating_light:","emoji":true}},{"type":"divider"},{"type":"section","text":{"type":"mrkdwn","text":"test(s) failed on ${{ github.ref_name }}"},"accessory":{"type":"button","text":{"type":"plain_text","text":"View Failing Workflow","emoji":true},"url":"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}}]}
|
2023-07-07 17:52:01 +00:00
|
|
|
|
|
|
|
notify-tests-completed-failures-ent:
|
|
|
|
if: ${{ always() && github.repository == 'hashicorp/vault-enterprise' && needs.tests-completed.result == 'failure' && (github.ref_name == 'main' || startsWith(github.ref_name, 'release/')) }}
|
|
|
|
runs-on: ['self-hosted', 'linux', 'small']
|
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
needs:
|
|
|
|
- tests-completed
|
|
|
|
steps:
|
|
|
|
- id: vault-auth
|
|
|
|
name: Vault Authenticate
|
|
|
|
run: vault-auth
|
|
|
|
- id: secrets
|
|
|
|
name: Fetch Vault Secrets
|
|
|
|
uses: hashicorp/vault-action@130d1f5f4fe645bb6c83e4225c04d64cfb62de6e
|
|
|
|
with:
|
|
|
|
url: ${{ steps.vault-auth.outputs.addr }}
|
|
|
|
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }}
|
|
|
|
token: ${{ steps.vault-auth.outputs.token }}
|
|
|
|
secrets: |
|
|
|
|
kv/data/github/${{ github.repository }}/github_actions_notifications_bot token | SLACK_BOT_TOKEN;
|
|
|
|
- name: send-notification
|
|
|
|
uses: hashicorp/cloud-gha-slack-notifier@730a033037b8e603adf99ebd3085f0fdfe75e2f4 #v1
|
|
|
|
with:
|
|
|
|
channel-id: "C05AABYEA9Y" # sent to #feed-vault-ci-official
|
|
|
|
slack-bot-token: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
|
|
|
|
payload: |
|
|
|
|
{"text":"Enterprise test failures on ${{ github.ref_name }}","blocks":[{"type":"header","text":{"type":"plain_text","text":":rotating_light: Enterprise test failures :rotating_light:","emoji":true}},{"type":"divider"},{"type":"section","text":{"type":"mrkdwn","text":"test(s) failed on ${{ github.ref_name }}"},"accessory":{"type":"button","text":{"type":"plain_text","text":"View Failing Workflow","emoji":true},"url":"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}}]}
|
|
|
|
|
|
|
|
test-summary:
|
|
|
|
name: Go test failures
|
|
|
|
runs-on: ubuntu-latest
|
2023-07-10 18:09:52 +00:00
|
|
|
if: |
|
|
|
|
always() &&
|
|
|
|
(needs.test-go.result == 'success' ||
|
|
|
|
needs.test-go.result == 'failure' ||
|
|
|
|
needs.test-go-fips.result == 'success' ||
|
|
|
|
needs.test-go-fips.result == 'failure' ||
|
|
|
|
needs.test-go-race.result == 'success' ||
|
|
|
|
needs.test-go-race.result == 'failure')
|
2023-07-07 17:52:01 +00:00
|
|
|
needs:
|
|
|
|
- test-go
|
|
|
|
- test-go-fips
|
|
|
|
- test-go-race
|
|
|
|
steps:
|
|
|
|
- name: Download failure summary
|
2023-07-13 13:19:21 +00:00
|
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
2023-07-07 17:52:01 +00:00
|
|
|
with:
|
|
|
|
name: failure-summary
|
|
|
|
- name: Prepare failure summary
|
|
|
|
run: |
|
2023-07-13 18:36:30 +00:00
|
|
|
# Sort all of the summary table rows and push them to a temp file.
|
2023-07-07 17:52:01 +00:00
|
|
|
temp_file_name=temp-$(date +%s)
|
2023-07-13 18:36:30 +00:00
|
|
|
cat failure-summary-*.md | sort >> "$temp_file_name"
|
2023-07-20 22:39:29 +00:00
|
|
|
|
2023-07-13 18:36:30 +00:00
|
|
|
# If there are test failures, present them in a format of a GitHub Markdown table.
|
2023-07-07 17:52:01 +00:00
|
|
|
if [ -s "$temp_file_name" ]; then
|
|
|
|
# shellcheck disable=SC2129
|
|
|
|
# Here we create the headings for the summary table
|
2023-07-13 18:36:30 +00:00
|
|
|
echo "| Test Type | Package | Test | Elapsed | Runner Index | Logs |" >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
echo "| --------- | ------- | ---- | ------- | ------------ | ---- |" >> "$GITHUB_STEP_SUMMARY"
|
2023-07-20 13:07:20 +00:00
|
|
|
# shellcheck disable=SC2002
|
|
|
|
cat "$temp_file_name" >> "$GITHUB_STEP_SUMMARY"
|
2023-07-07 17:52:01 +00:00
|
|
|
else
|
|
|
|
echo "### All Go tests passed! :white_check_mark:" >> "$GITHUB_STEP_SUMMARY"
|
2023-07-12 19:26:00 +00:00
|
|
|
fi
|
2023-07-20 22:39:29 +00:00
|
|
|
|
2023-07-20 13:07:20 +00:00
|
|
|
# the random EOF is needed for a multiline environment variable
|
|
|
|
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
|
|
|
|
# shellcheck disable=SC2129
|
|
|
|
echo "TABLE_TEST_RESULTS<<$EOF" >> "$GITHUB_ENV"
|
|
|
|
cat "$temp_file_name" >> "$GITHUB_ENV"
|
2023-07-20 22:39:29 +00:00
|
|
|
echo "$EOF" >> "$GITHUB_ENV"
|
2023-07-20 13:07:20 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
|
|
- name: Create comment
|
|
|
|
if: github.head_ref != ''
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
|
|
RUN_ID: ${{ github.run_id }}
|
|
|
|
REPO: ${{ github.event.repository.name }}
|
2023-07-20 22:39:29 +00:00
|
|
|
TABLE_DATA: ${{ env.TABLE_TEST_RESULTS }}
|
2023-07-20 13:07:20 +00:00
|
|
|
run: ./.github/scripts/report_failed_tests.sh
|