2023-03-28 21:29:27 +00:00
|
|
|
name: go-tests
|
|
|
|
|
2023-07-12 23:10:34 +00:00
|
|
|
on:
|
2023-03-28 21:29:27 +00:00
|
|
|
pull_request:
|
2023-07-24 16:05:43 +00:00
|
|
|
branches-ignore:
|
|
|
|
- stable-website
|
2023-03-28 21:29:27 +00:00
|
|
|
- 'docs/**'
|
|
|
|
- 'ui/**'
|
2023-07-24 16:05:43 +00:00
|
|
|
- 'mktg-**' # Digital Team Terraform-generated branches' prefix
|
|
|
|
- 'backport/docs/**'
|
|
|
|
- 'backport/ui/**'
|
|
|
|
- 'backport/mktg-**'
|
2023-04-06 22:29:32 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
# Push events on the main branch
|
|
|
|
- main
|
|
|
|
- release/**
|
2023-07-12 23:10:34 +00:00
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
env:
|
|
|
|
TEST_RESULTS: /tmp/test-results
|
2023-06-21 15:26:27 +00:00
|
|
|
GOPRIVATE: github.com/hashicorp # Required for enterprise deps
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-08-28 16:05:25 +00:00
|
|
|
# concurrency
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
jobs:
|
2023-08-23 19:26:05 +00:00
|
|
|
conditional-skip:
|
2024-09-25 17:08:24 +00:00
|
|
|
uses: ./.github/workflows/reusable-conditional-skip.yml
|
2023-08-23 19:26:05 +00:00
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
setup:
|
2023-08-23 19:26:05 +00:00
|
|
|
needs: [conditional-skip]
|
2023-03-28 21:29:27 +00:00
|
|
|
name: Setup
|
2023-09-20 21:33:30 +00:00
|
|
|
if: needs.conditional-skip.outputs.skip-ci != 'true'
|
2023-03-28 21:29:27 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
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-xl: ${{ steps.setup-outputs.outputs.compute-xl }}
|
|
|
|
steps:
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-03-28 21:29:27 +00:00
|
|
|
- id: setup-outputs
|
|
|
|
name: Setup outputs
|
|
|
|
run: ./.github/scripts/get_runner_classes.sh
|
|
|
|
|
2024-01-08 22:18:41 +00:00
|
|
|
get-go-version:
|
|
|
|
uses: ./.github/workflows/reusable-get-go-version.yml
|
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
check-go-mod:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
2023-03-28 21:29:27 +00:00
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
uses: ./.github/workflows/reusable-check-go-mod.yml
|
|
|
|
with:
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-small }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
check-generated-protobuf:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-06-22 14:56:45 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-medium) }}
|
2023-03-28 21:29:27 +00:00
|
|
|
steps:
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2023-03-28 21:29:27 +00:00
|
|
|
with:
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-03-28 21:29:27 +00:00
|
|
|
- run: make proto-tools
|
|
|
|
name: Install protobuf
|
|
|
|
- run: make proto-format
|
|
|
|
name: "Protobuf Format"
|
|
|
|
- run: make --always-make proto
|
|
|
|
- run: |
|
|
|
|
if ! git diff --exit-code; then
|
|
|
|
echo "Generated code was not updated correctly"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
- run: make proto-lint
|
|
|
|
name: "Protobuf Lint"
|
2023-09-11 17:50:52 +00:00
|
|
|
check-codegen:
|
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-09-11 17:50:52 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }}
|
|
|
|
steps:
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-09-11 17:50:52 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2023-09-11 17:50:52 +00:00
|
|
|
with:
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-09-11 17:50:52 +00:00
|
|
|
- run: make --always-make codegen
|
|
|
|
- run: |
|
|
|
|
if ! git diff --exit-code; then
|
|
|
|
echo "Generated code was not updated correctly"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-03-30 16:57:11 +00:00
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
lint-enums:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-04-04 15:15:45 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }}
|
2023-03-28 21:29:27 +00:00
|
|
|
steps:
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2023-03-28 21:29:27 +00:00
|
|
|
with:
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-07-12 23:10:34 +00:00
|
|
|
- run: go install github.com/reillywatson/enumcover/cmd/enumcover@master && enumcover ./...
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
lint-container-test-deps:
|
2023-03-30 16:57:11 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
|
|
|
steps:
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2023-03-28 21:29:27 +00:00
|
|
|
with:
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-03-30 16:57:11 +00:00
|
|
|
- run: make lint-container-test-deps
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
lint-consul-retry:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
|
|
|
steps:
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2023-03-28 21:29:27 +00:00
|
|
|
with:
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-12-06 17:11:32 +00:00
|
|
|
- run: make lint-consul-retry
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
lint:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
uses: ./.github/workflows/reusable-lint.yml
|
|
|
|
with:
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
lint-32bit:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
uses: ./.github/workflows/reusable-lint.yml
|
|
|
|
with:
|
|
|
|
go-arch: "386"
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
# create a development build
|
|
|
|
dev-build:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
uses: ./.github/workflows/reusable-dev-build.yml
|
2023-07-12 23:10:34 +00:00
|
|
|
with:
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
|
2023-07-25 17:58:12 +00:00
|
|
|
# dev-build-s390x:
|
|
|
|
# if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
# needs:
|
|
|
|
# - setup
|
2024-01-08 22:18:41 +00:00
|
|
|
# - get-go-version
|
2023-07-25 17:58:12 +00:00
|
|
|
# uses: ./.github/workflows/reusable-dev-build.yml
|
|
|
|
# with:
|
|
|
|
# uploaded-binary-name: 'consul-bin-s390x'
|
2023-08-31 14:56:59 +00:00
|
|
|
# runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-07-25 17:58:12 +00:00
|
|
|
# go-arch: "s390x"
|
2024-01-08 22:18:41 +00:00
|
|
|
# go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-07-25 17:58:12 +00:00
|
|
|
# repository-name: ${{ github.repository }}
|
|
|
|
# secrets:
|
|
|
|
# elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-07-12 23:10:34 +00:00
|
|
|
|
2023-04-05 23:10:31 +00:00
|
|
|
# dev-build-arm64:
|
2023-08-22 14:46:03 +00:00
|
|
|
# # only run on enterprise because GHA does not have arm64 runners in CE
|
2023-04-05 23:10:31 +00:00
|
|
|
# if: ${{ endsWith(github.repository, '-enterprise') }}
|
2023-07-12 23:10:34 +00:00
|
|
|
# needs:
|
|
|
|
# - setup
|
2024-01-08 22:18:41 +00:00
|
|
|
# - get-go-version
|
2023-04-05 23:10:31 +00:00
|
|
|
# uses: ./.github/workflows/reusable-dev-build.yml
|
|
|
|
# with:
|
|
|
|
# uploaded-binary-name: 'consul-bin-arm64'
|
2023-08-31 14:56:59 +00:00
|
|
|
# runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-04-05 23:10:31 +00:00
|
|
|
# go-arch: "arm64"
|
2024-01-08 22:18:41 +00:00
|
|
|
# go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-04-05 23:10:31 +00:00
|
|
|
# repository-name: ${{ github.repository }}
|
|
|
|
# secrets:
|
|
|
|
# elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-04-05 23:10:31 +00:00
|
|
|
# go-test-arm64:
|
2023-08-22 14:46:03 +00:00
|
|
|
# # only run on enterprise because GHA does not have arm64 runners in CE
|
2023-04-05 23:10:31 +00:00
|
|
|
# if: ${{ endsWith(github.repository, '-enterprise') }}
|
2023-07-12 23:10:34 +00:00
|
|
|
# needs:
|
|
|
|
# - setup
|
2024-01-08 22:18:41 +00:00
|
|
|
# - get-go-version
|
2023-04-05 23:10:31 +00:00
|
|
|
# - dev-build-arm64
|
|
|
|
# uses: ./.github/workflows/reusable-unit-split.yml
|
|
|
|
# with:
|
|
|
|
# directory: .
|
|
|
|
# uploaded-binary-name: 'consul-bin-arm64'
|
|
|
|
# runner-count: 12
|
|
|
|
# runs-on: "['self-hosted', 'ondemand', 'os=macos-arm', 'arm64']"
|
2023-11-15 20:43:33 +00:00
|
|
|
# go-test-flags: "${{ (github.ref_name != 'main' && !startsWith(github.ref_name, 'release/')) && '-short' || '' }}"
|
2024-01-08 22:18:41 +00:00
|
|
|
# go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-04-05 23:10:31 +00:00
|
|
|
# repository-name: ${{ github.repository }}
|
|
|
|
# secrets:
|
|
|
|
# elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
# consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
# datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-08-22 14:46:03 +00:00
|
|
|
go-test-ce:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit-split.yml
|
|
|
|
with:
|
|
|
|
directory: .
|
2023-11-15 20:43:33 +00:00
|
|
|
runner-count: 6
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: ""
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
2023-04-05 22:49:48 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-04-05 22:49:48 +00:00
|
|
|
|
|
|
|
go-test-enterprise:
|
2023-04-06 22:29:32 +00:00
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-04-05 22:49:48 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit-split.yml
|
|
|
|
with:
|
|
|
|
directory: .
|
2023-11-15 20:43:33 +00:00
|
|
|
runner-count: 6
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-04-05 22:49:48 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-race:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: .
|
2023-11-15 20:43:33 +00:00
|
|
|
go-test-flags: "-race -gcflags=all=-d=checkptr=0"
|
2023-03-31 03:39:34 +00:00
|
|
|
package-names-command: "go list ./... | grep -E -v '^github.com/hashicorp/consul/agent(/consul|/local|/routine-leak-checker)?$' | grep -E -v '^github.com/hashicorp/consul(/command|/connect|/snapshot)'"
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-32bit:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: .
|
|
|
|
go-arch: "386"
|
2023-11-15 20:43:33 +00:00
|
|
|
go-test-flags: "-short"
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
|
|
|
|
2023-07-25 17:58:12 +00:00
|
|
|
# go-test-s390x:
|
|
|
|
# if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
# needs:
|
|
|
|
# - setup
|
2024-01-08 22:18:41 +00:00
|
|
|
# - get-go-version
|
2023-07-25 17:58:12 +00:00
|
|
|
# - dev-build-s390x
|
|
|
|
# uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
# with:
|
|
|
|
# uploaded-binary-name: 'consul-bin-s390x'
|
|
|
|
# directory: .
|
2023-11-15 20:43:33 +00:00
|
|
|
# go-test-flags: -short"
|
2023-08-31 14:56:59 +00:00
|
|
|
# runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-07-25 17:58:12 +00:00
|
|
|
# repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
# go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-08 22:18:41 +00:00
|
|
|
# go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-07-25 17:58:12 +00:00
|
|
|
# permissions:
|
|
|
|
# id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
|
|
|
# contents: read
|
|
|
|
# secrets:
|
|
|
|
# elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
# consul-license: ${{secrets.CONSUL_LICENSE}}
|
|
|
|
# datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-envoyextensions:
|
2023-03-30 16:57:11 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: envoyextensions
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-troubleshoot:
|
2023-03-30 16:57:11 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: troubleshoot
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2024-01-12 14:57:38 +00:00
|
|
|
go-test-api-backwards-compatibility:
|
|
|
|
name: go-test-api-${{ needs.get-go-version.outputs.go-version-previous }}
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-12 14:57:38 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: api
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-12 14:57:38 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version-previous }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2024-01-12 14:57:38 +00:00
|
|
|
go-test-api:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-12 14:57:38 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: api
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-12 14:57:38 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2024-01-12 14:57:38 +00:00
|
|
|
go-test-sdk-backwards-compatibility:
|
|
|
|
name: go-test-sdk-${{ needs.get-go-version.outputs.go-version-previous }}
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-12 14:57:38 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: sdk
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-12 14:57:38 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version-previous }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2024-01-12 14:57:38 +00:00
|
|
|
go-test-sdk:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-12 14:57:38 +00:00
|
|
|
- get-go-version
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: sdk
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-11-14 20:02:18 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
2024-01-12 14:57:38 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-05-10 20:49:18 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
2023-07-12 23:10:34 +00:00
|
|
|
contents: read
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-05-10 20:49:18 +00:00
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2024-02-22 19:31:50 +00:00
|
|
|
go-test-testing-deployer:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- get-go-version
|
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: testing/deployer
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
|
|
|
repository-name: ${{ github.repository }}
|
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}"
|
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
|
|
|
contents: read
|
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
|
|
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
noop:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- run: "echo ok"
|
2023-04-06 22:29:32 +00:00
|
|
|
|
|
|
|
# This is job is required for branch protection as a required gihub check
|
|
|
|
# because GitHub actions show up as checks at the job level and not the
|
|
|
|
# workflow level. This is currently a feature request:
|
|
|
|
# https://github.com/orgs/community/discussions/12395
|
|
|
|
#
|
|
|
|
# This job must:
|
|
|
|
# - be placed after the fanout of a workflow so that everything fans back in
|
|
|
|
# to this job.
|
|
|
|
# - "need" any job that is part of the fan out / fan in
|
2023-07-12 23:10:34 +00:00
|
|
|
# - implement the if logic because we have conditional jobs
|
|
|
|
# (go-test-enteprise) that this job needs and this would potentially get
|
|
|
|
# skipped if a previous job got skipped. So we use the if clause to make
|
2023-04-06 22:29:32 +00:00
|
|
|
# sure it does not get skipped.
|
|
|
|
|
|
|
|
go-tests-success:
|
2023-07-12 23:10:34 +00:00
|
|
|
needs:
|
2023-08-23 19:26:05 +00:00
|
|
|
- conditional-skip
|
2023-04-06 22:29:32 +00:00
|
|
|
- setup
|
2023-09-11 17:50:52 +00:00
|
|
|
- check-codegen
|
2023-04-06 22:29:32 +00:00
|
|
|
- check-generated-protobuf
|
|
|
|
- check-go-mod
|
|
|
|
- lint-consul-retry
|
|
|
|
- lint-container-test-deps
|
|
|
|
- lint-enums
|
|
|
|
- lint
|
|
|
|
- lint-32bit
|
|
|
|
# - go-test-arm64
|
|
|
|
- go-test-enterprise
|
2023-08-22 14:46:03 +00:00
|
|
|
- go-test-ce
|
2023-04-06 22:29:32 +00:00
|
|
|
- go-test-race
|
|
|
|
- go-test-envoyextensions
|
|
|
|
- go-test-troubleshoot
|
2024-01-12 14:57:38 +00:00
|
|
|
- go-test-api-backwards-compatibility
|
|
|
|
- go-test-api
|
|
|
|
- go-test-sdk-backwards-compatibility
|
|
|
|
- go-test-sdk
|
2023-04-06 22:29:32 +00:00
|
|
|
- go-test-32bit
|
2024-02-22 19:31:50 +00:00
|
|
|
- go-test-testing-deployer
|
2023-07-25 17:58:12 +00:00
|
|
|
# - go-test-s390x
|
2023-04-06 22:29:32 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
2023-09-20 21:33:30 +00:00
|
|
|
if: always() && needs.conditional-skip.outputs.skip-ci != 'true'
|
2023-04-06 22:29:32 +00:00
|
|
|
steps:
|
2023-04-25 20:17:48 +00:00
|
|
|
- name: evaluate upstream job results
|
|
|
|
run: |
|
|
|
|
# exit 1 if failure or cancelled result for any upstream job
|
2023-12-05 15:24:04 +00:00
|
|
|
# this ensures that we fail the PR check regardless of cancellation, rather than skip-passing it
|
|
|
|
# see https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution#overview
|
2023-04-25 20:17:48 +00:00
|
|
|
if printf '${{ toJSON(needs) }}' | grep -E -i '\"result\": \"(failure|cancelled)\"'; then
|
|
|
|
printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-12-05 15:24:04 +00:00
|
|
|
- name: Set failure Slack commit message summary
|
|
|
|
# failure() ensures this runs even if the test eval step exits 1
|
|
|
|
if: failure()
|
2023-12-08 21:04:45 +00:00
|
|
|
env:
|
|
|
|
# Capturing in an env var makes this safe against GHA shell injection via commit message.
|
|
|
|
# See https://securitylab.github.com/research/github-actions-untrusted-input/
|
|
|
|
COMMIT_MESSAGE_FULL: ${{ github.event.head_commit.message }}
|
2023-12-05 15:24:04 +00:00
|
|
|
run: |
|
|
|
|
# if failure (not cancelled), notify Slack
|
|
|
|
if printf '${{ toJSON(needs) }}' | grep -E -i '\"result\": \"(failure)\"'; then
|
|
|
|
printf "Tests failed, notifying Slack"
|
|
|
|
echo "FAILED_TESTS=true" >> $GITHUB_ENV
|
2023-12-08 21:04:45 +00:00
|
|
|
|
|
|
|
# 'echo ... | head -n 1' does not work reliably, so use bash-ism to get first line.
|
|
|
|
COMMIT_MESSAGE_SUMMARY=${COMMIT_MESSAGE_FULL%%$'\n'*}
|
|
|
|
|
|
|
|
# Send multi-line env var to GITHUB_ENV.
|
|
|
|
# github.event.head_commit.message and github.ref_name both rely on this event occurring on a push / merge
|
|
|
|
echo "SLACK_MESSAGE_RAW<<EOF" >> $GITHUB_ENV
|
|
|
|
echo "❌ ${{ github.workflow }} workflow failed:
|
|
|
|
|
|
|
|
- Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
|
|
- Branch: ${{ github.ref_name }}
|
|
|
|
- Message: ${COMMIT_MESSAGE_SUMMARY}
|
|
|
|
- Author: ${{ github.event.sender.login }}" >> $GITHUB_ENV
|
|
|
|
echo "EOF" >> $GITHUB_ENV
|
2023-12-05 15:24:04 +00:00
|
|
|
fi
|
2023-11-15 00:42:28 +00:00
|
|
|
- name: Notify Slack
|
2023-12-05 15:24:04 +00:00
|
|
|
# failure() ensures this runs even if the test eval step exits 1
|
|
|
|
# FAILED_TESTS must also be checked to avoid running this step on cancellation due to the summary check above
|
|
|
|
if: ${{ failure() && env.FAILED_TESTS == 'true' && (github.ref_name == 'main' || startsWith(github.ref_name, 'release/')) }}
|
2023-11-15 00:42:28 +00:00
|
|
|
id: slack
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
|
2023-11-15 00:42:28 +00:00
|
|
|
with:
|
2023-12-08 21:04:45 +00:00
|
|
|
# Escape entire message string to ensure valid JSON. If invalid, the notification will fail silently in CI.
|
2023-11-15 00:42:28 +00:00
|
|
|
payload: |
|
|
|
|
{
|
2023-12-08 21:04:45 +00:00
|
|
|
"message": ${{ toJSON(env.SLACK_MESSAGE_RAW) }}
|
2023-11-15 00:42:28 +00:00
|
|
|
}
|
|
|
|
env:
|
2024-02-22 19:31:50 +00:00
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.CONSUL_PROTECTED_BRANCH_TEST_SLACK_WEBHOOK }}
|