diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index 2045251574..06bf97f5b3 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -4,12 +4,12 @@ on: pull_request: branches-ignore: - stable-website - - 'docs/**' - - 'ui/**' - - 'mktg-**' # Digital Team Terraform-generated branches' prefix - - 'backport/docs/**' - - 'backport/ui/**' - - 'backport/mktg-**' + - "docs/**" + - "ui/**" + - "mktg-**" # Digital Team Terraform-generated branches' prefix + - "backport/docs/**" + - "backport/ui/**" + - "backport/mktg-**" push: branches: # Push events on the main branch @@ -31,14 +31,14 @@ concurrency: jobs: conditional-skip: - runs-on: ubuntu-latest + runs-on: ubuntu-latest name: Get files changed and conditionally skip CI outputs: skip-ci: ${{ steps.read-files.outputs.skip-ci }} steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - fetch-depth: 0 + fetch-depth: 0 - name: Get changed files id: read-files run: ./.github/scripts/filter_changed_files_go_test.sh @@ -54,14 +54,14 @@ jobs: compute-large: ${{ steps.setup-outputs.outputs.compute-large }} compute-xl: ${{ steps.setup-outputs.outputs.compute-xl }} steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - id: setup-outputs - name: Setup outputs - run: ./.github/scripts/get_runner_classes.sh + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - id: setup-outputs + name: Setup outputs + run: ./.github/scripts/get_runner_classes.sh check-go-mod: needs: - - setup + - setup uses: ./.github/workflows/reusable-check-go-mod.yml with: runs-on: ${{ needs.setup.outputs.compute-small }} @@ -71,111 +71,111 @@ jobs: check-generated-protobuf: needs: - - setup + - setup runs-on: ${{ fromJSON(needs.setup.outputs.compute-medium) }} steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - # 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" - - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - with: - go-version-file: 'go.mod' - - 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" - - name: Notify Slack - if: ${{ failure() }} - run: .github/scripts/notify_slack.sh + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + # 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" + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + with: + go-version-file: "go.mod" + - 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" + - name: Notify Slack + if: ${{ failure() }} + run: .github/scripts/notify_slack.sh check-codegen: - needs: - - setup - runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }} - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - # 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" - - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - with: - go-version-file: 'go.mod' - - run: make --always-make codegen - - run: | - if ! git diff --exit-code; then - echo "Generated code was not updated correctly" - exit 1 - fi - - name: Notify Slack - if: ${{ failure() }} - run: .github/scripts/notify_slack.sh + needs: + - setup + runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }} + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + # 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" + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + with: + go-version-file: "go.mod" + - run: make --always-make codegen + - run: | + if ! git diff --exit-code; then + echo "Generated code was not updated correctly" + exit 1 + fi + - name: Notify Slack + if: ${{ failure() }} + run: .github/scripts/notify_slack.sh lint-enums: needs: - - setup + - setup runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }} steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - # 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" - - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - with: - go-version-file: 'go.mod' - - run: go install github.com/reillywatson/enumcover/cmd/enumcover@master && enumcover ./... - - name: Notify Slack - if: ${{ failure() }} - run: .github/scripts/notify_slack.sh + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + # 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" + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + with: + go-version-file: "go.mod" + - run: go install github.com/reillywatson/enumcover/cmd/enumcover@master && enumcover ./... + - name: Notify Slack + if: ${{ failure() }} + run: .github/scripts/notify_slack.sh lint-container-test-deps: needs: - - setup + - setup runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }} steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - # 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" - - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - with: - go-version-file: 'go.mod' - - run: make lint-container-test-deps - - name: Notify Slack - if: ${{ failure() }} - run: .github/scripts/notify_slack.sh + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + # 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" + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + with: + go-version-file: "go.mod" + - run: make lint-container-test-deps + - name: Notify Slack + if: ${{ failure() }} + run: .github/scripts/notify_slack.sh lint-consul-retry: needs: - - setup + - setup runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }} steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - # 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" - - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - with: - go-version-file: 'go.mod' - - run: go install github.com/hashicorp/lint-consul-retry@master && lint-consul-retry - - name: Notify Slack - if: ${{ failure() }} - run: .github/scripts/notify_slack.sh + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + # 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" + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + with: + go-version-file: "go.mod" + - run: go install github.com/hashicorp/lint-consul-retry@v1.3.0 && lint-consul-retry + - name: Notify Slack + if: ${{ failure() }} + run: .github/scripts/notify_slack.sh lint: needs: - - setup + - setup uses: ./.github/workflows/reusable-lint.yml with: runs-on: ${{ needs.setup.outputs.compute-large }} @@ -185,7 +185,7 @@ jobs: lint-32bit: needs: - - setup + - setup uses: ./.github/workflows/reusable-lint.yml with: go-arch: "386" @@ -197,7 +197,7 @@ jobs: # create a development build dev-build: needs: - - setup + - setup uses: ./.github/workflows/reusable-dev-build.yml with: runs-on: ${{ needs.setup.outputs.compute-large }} @@ -253,8 +253,8 @@ jobs: go-test-ce: needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit-split.yml with: directory: . @@ -273,8 +273,8 @@ jobs: go-test-enterprise: if: ${{ endsWith(github.repository, '-enterprise') }} needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit-split.yml with: directory: . @@ -292,8 +292,8 @@ jobs: go-test-race: needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit.yml with: directory: . @@ -312,8 +312,8 @@ jobs: go-test-32bit: needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit.yml with: directory: . @@ -353,8 +353,8 @@ jobs: go-test-envoyextensions: needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit.yml with: directory: envoyextensions @@ -371,8 +371,8 @@ jobs: go-test-troubleshoot: needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit.yml with: directory: troubleshoot @@ -389,8 +389,8 @@ jobs: go-test-api-1-19: needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit.yml with: directory: api @@ -408,8 +408,8 @@ jobs: go-test-api-1-20: needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit.yml with: directory: api @@ -427,8 +427,8 @@ jobs: go-test-sdk-1-19: needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit.yml with: directory: sdk @@ -446,8 +446,8 @@ jobs: go-test-sdk-1-20: needs: - - setup - - dev-build + - setup + - dev-build uses: ./.github/workflows/reusable-unit.yml with: directory: sdk @@ -484,27 +484,27 @@ jobs: go-tests-success: needs: - - conditional-skip - - setup - - check-codegen - - check-generated-protobuf - - check-go-mod - - lint-consul-retry - - lint-container-test-deps - - lint-enums - - lint - - lint-32bit - # - go-test-arm64 - - go-test-enterprise - - go-test-ce - - go-test-race - - go-test-envoyextensions - - go-test-troubleshoot - - go-test-api-1-19 - - go-test-api-1-20 - - go-test-sdk-1-19 - - go-test-sdk-1-20 - - go-test-32bit + - conditional-skip + - setup + - check-codegen + - check-generated-protobuf + - check-go-mod + - lint-consul-retry + - lint-container-test-deps + - lint-enums + - lint + - lint-32bit + # - go-test-arm64 + - go-test-enterprise + - go-test-ce + - go-test-race + - go-test-envoyextensions + - go-test-troubleshoot + - go-test-api-1-19 + - go-test-api-1-20 + - go-test-sdk-1-19 + - go-test-sdk-1-20 + - go-test-32bit # - go-test-s390x runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }} if: always() && needs.conditional-skip.outputs.skip-ci != 'true' diff --git a/Makefile b/Makefile index 8697bff79b..d98335a7b9 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ PROTOC_GO_INJECT_TAG_VERSION='v1.3.0' PROTOC_GEN_GO_BINARY_VERSION="v0.1.0" DEEP_COPY_VERSION='bc3f5aa5735d8a54961580a3a24422c308c831c2' COPYWRITE_TOOL_VERSION='v0.16.4' +LINT_CONSUL_RETRY_VERSION='v1.3.0' MOCKED_PB_DIRS= pbdns diff --git a/build-support/scripts/devtools.sh b/build-support/scripts/devtools.sh index b4cf687460..e3f6d15452 100755 --- a/build-support/scripts/devtools.sh +++ b/build-support/scripts/devtools.sh @@ -136,12 +136,16 @@ function proto_tools_install { } function lint_install { + local lint_consul_retry_version + lint_consul_retry_version="$(make --no-print-directory print-LINT_CONSUL_RETRY_VERSION)" local golangci_lint_version golangci_lint_version="$(make --no-print-directory print-GOLANGCI_LINT_VERSION)" - install_unversioned_tool \ + install_versioned_tool \ 'lint-consul-retry' \ - 'github.com/hashicorp/lint-consul-retry@master' + 'github.com/hashicorp/lint-consul-retry' \ + "${lint_consul_retry_version}" \ + 'github.com/hashicorp/lint-consul-retry' install_unversioned_tool \ 'enumcover' \