mirror of https://github.com/hashicorp/consul
Backport of [NET-4968] Upgrade Go to 1.21 into release/1.15.x (#20180)
* backport of commitpull/20183/head01ca961e04
* backport of commite71ae3aed8
--------- Co-authored-by: Michael Zalimeni <michael.zalimeni@hashicorp.com>
parent
977b2dcf3d
commit
c5dd828369
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:improvement
|
||||||
|
Upgrade to use Go 1.21.6.
|
||||||
|
```
|
|
@ -423,9 +423,11 @@ jobs:
|
||||||
consul-license: ${{secrets.CONSUL_LICENSE}}
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
||||||
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
||||||
|
|
||||||
go-test-api-1-19:
|
go-test-api-backwards-compatibility:
|
||||||
|
name: go-test-api-${{ needs.get-go-version.outputs.go-version-previous }}
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
|
- get-go-version
|
||||||
- dev-build
|
- dev-build
|
||||||
uses: ./.github/workflows/reusable-unit.yml
|
uses: ./.github/workflows/reusable-unit.yml
|
||||||
with:
|
with:
|
||||||
|
@ -433,7 +435,7 @@ jobs:
|
||||||
runs-on: ${{ needs.setup.outputs.compute-large }}
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
||||||
repository-name: ${{ github.repository }}
|
repository-name: ${{ github.repository }}
|
||||||
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
||||||
go-version: "1.19"
|
go-version: ${{ needs.get-go-version.outputs.go-version-previous }}
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
||||||
contents: read
|
contents: read
|
||||||
|
@ -442,9 +444,10 @@ jobs:
|
||||||
consul-license: ${{secrets.CONSUL_LICENSE}}
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
||||||
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
||||||
|
|
||||||
go-test-api-1-20:
|
go-test-api:
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
|
- get-go-version
|
||||||
- dev-build
|
- dev-build
|
||||||
uses: ./.github/workflows/reusable-unit.yml
|
uses: ./.github/workflows/reusable-unit.yml
|
||||||
with:
|
with:
|
||||||
|
@ -452,7 +455,7 @@ jobs:
|
||||||
runs-on: ${{ needs.setup.outputs.compute-large }}
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
||||||
repository-name: ${{ github.repository }}
|
repository-name: ${{ github.repository }}
|
||||||
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
||||||
go-version: "1.20"
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
||||||
contents: read
|
contents: read
|
||||||
|
@ -461,9 +464,11 @@ jobs:
|
||||||
consul-license: ${{secrets.CONSUL_LICENSE}}
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
||||||
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
||||||
|
|
||||||
go-test-sdk-1-19:
|
go-test-sdk-backwards-compatibility:
|
||||||
|
name: go-test-sdk-${{ needs.get-go-version.outputs.go-version-previous }}
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
|
- get-go-version
|
||||||
- dev-build
|
- dev-build
|
||||||
uses: ./.github/workflows/reusable-unit.yml
|
uses: ./.github/workflows/reusable-unit.yml
|
||||||
with:
|
with:
|
||||||
|
@ -471,7 +476,7 @@ jobs:
|
||||||
runs-on: ${{ needs.setup.outputs.compute-large }}
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
||||||
repository-name: ${{ github.repository }}
|
repository-name: ${{ github.repository }}
|
||||||
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
||||||
go-version: "1.19"
|
go-version: ${{ needs.get-go-version.outputs.go-version-previous }}
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
||||||
contents: read
|
contents: read
|
||||||
|
@ -480,9 +485,10 @@ jobs:
|
||||||
consul-license: ${{secrets.CONSUL_LICENSE}}
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
||||||
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
datadog-api-key: "${{ !endsWith(github.repository, '-enterprise') && secrets.DATADOG_API_KEY || '' }}"
|
||||||
|
|
||||||
go-test-sdk-1-20:
|
go-test-sdk:
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
|
- get-go-version
|
||||||
- dev-build
|
- dev-build
|
||||||
uses: ./.github/workflows/reusable-unit.yml
|
uses: ./.github/workflows/reusable-unit.yml
|
||||||
with:
|
with:
|
||||||
|
@ -490,7 +496,7 @@ jobs:
|
||||||
runs-on: ${{ needs.setup.outputs.compute-large }}
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
||||||
repository-name: ${{ github.repository }}
|
repository-name: ${{ github.repository }}
|
||||||
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
||||||
go-version: "1.20"
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
||||||
contents: read
|
contents: read
|
||||||
|
@ -536,10 +542,10 @@ jobs:
|
||||||
- go-test-race
|
- go-test-race
|
||||||
- go-test-envoyextensions
|
- go-test-envoyextensions
|
||||||
- go-test-troubleshoot
|
- go-test-troubleshoot
|
||||||
- go-test-api-1-19
|
- go-test-api-backwards-compatibility
|
||||||
- go-test-api-1-20
|
- go-test-api
|
||||||
- go-test-sdk-1-19
|
- go-test-sdk-backwards-compatibility
|
||||||
- go-test-sdk-1-20
|
- go-test-sdk
|
||||||
- go-test-32bit
|
- go-test-32bit
|
||||||
# - go-test-s390x
|
# - go-test-s390x
|
||||||
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
||||||
|
|
|
@ -6,6 +6,9 @@ on:
|
||||||
go-version:
|
go-version:
|
||||||
description: "The Go version detected by this workflow"
|
description: "The Go version detected by this workflow"
|
||||||
value: ${{ jobs.get-go-version.outputs.go-version }}
|
value: ${{ jobs.get-go-version.outputs.go-version }}
|
||||||
|
go-version-previous:
|
||||||
|
description: "The Go version (MAJOR.MINOR) prior to the current one, used for backwards compatibility testing"
|
||||||
|
value: ${{ jobs.get-go-version.outputs.go-version-previous }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
get-go-version:
|
get-go-version:
|
||||||
|
@ -13,6 +16,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
go-version: ${{ steps.get-go-version.outputs.go-version }}
|
go-version: ${{ steps.get-go-version.outputs.go-version }}
|
||||||
|
go-version-previous: ${{ steps.get-go-version.outputs.go-version-previous }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||||
- name: Determine Go version
|
- name: Determine Go version
|
||||||
|
@ -32,3 +36,7 @@ jobs:
|
||||||
GO_VERSION=$(head -n 1 .go-version)
|
GO_VERSION=$(head -n 1 .go-version)
|
||||||
echo "Building with Go ${GO_VERSION}"
|
echo "Building with Go ${GO_VERSION}"
|
||||||
echo "go-version=${GO_VERSION}" >> $GITHUB_OUTPUT
|
echo "go-version=${GO_VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
GO_MINOR_VERSION=${GO_VERSION%.*}
|
||||||
|
GO_VERSION_PREVIOUS="${GO_MINOR_VERSION%.*}.$((${GO_MINOR_VERSION#*.}-1))"
|
||||||
|
echo "Previous version ${GO_VERSION_PREVIOUS}"
|
||||||
|
echo "go-version-previous=${GO_VERSION_PREVIOUS}" >> $GITHUB_OUTPUT
|
||||||
|
|
|
@ -48,11 +48,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
go-version: ${{ inputs.go-version }}
|
go-version: ${{ inputs.go-version }}
|
||||||
- run: go env
|
- run: go env
|
||||||
|
- name: Set golangci-lint version
|
||||||
|
run: echo "GOLANGCI_LINT_VERSION=$(make --no-print-directory print-GOLANGCI_LINT_VERSION)" >> $GITHUB_ENV
|
||||||
- name: lint-${{ matrix.directory }}
|
- name: lint-${{ matrix.directory }}
|
||||||
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # pin@v3.4.0
|
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # pin@v3.4.0
|
||||||
with:
|
with:
|
||||||
working-directory: ${{ matrix.directory }}
|
working-directory: ${{ matrix.directory }}
|
||||||
version: v1.51.1
|
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
||||||
args: --build-tags="${{ env.GOTAGS }}" -v
|
args: --build-tags="${{ env.GOTAGS }}" -v
|
||||||
skip-cache: true
|
skip-cache: true
|
||||||
- name: Notify Slack
|
- name: Notify Slack
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1.20.12
|
1.21.6
|
||||||
|
|
|
@ -90,17 +90,14 @@ linters-settings:
|
||||||
- github.com/hashicorp/consul-net-rpc/go-msgpack
|
- github.com/hashicorp/consul-net-rpc/go-msgpack
|
||||||
|
|
||||||
depguard:
|
depguard:
|
||||||
list-type: denylist
|
rules:
|
||||||
include-go-root: true
|
main:
|
||||||
# A list of packages for the list type specified.
|
listMode: lax
|
||||||
# Default: []
|
deny:
|
||||||
packages:
|
- pkg: net/rpc
|
||||||
- net/rpc
|
desc: "only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc"
|
||||||
# A list of packages for the list type specified.
|
- pkg: github.com/golang/protobuf
|
||||||
# Specify an error message to output when a denied package is used.
|
desc: "only use google.golang.org/protobuf"
|
||||||
# Default: []
|
|
||||||
packages-with-error-message:
|
|
||||||
- net/rpc: "only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc"
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
timeout: 10m
|
timeout: 10m
|
||||||
|
|
|
@ -7,7 +7,7 @@ SHELL = bash
|
||||||
# These version variables can either be a valid string for "go install <module>@<version>"
|
# These version variables can either be a valid string for "go install <module>@<version>"
|
||||||
# or the string @DEV to imply use what is currently installed locally.
|
# or the string @DEV to imply use what is currently installed locally.
|
||||||
###
|
###
|
||||||
GOLANGCI_LINT_VERSION='v1.51.1'
|
GOLANGCI_LINT_VERSION='v1.55.2'
|
||||||
MOCKERY_VERSION='v2.20.0'
|
MOCKERY_VERSION='v2.20.0'
|
||||||
BUF_VERSION='v1.4.0'
|
BUF_VERSION='v1.4.0'
|
||||||
PROTOC_GEN_GO_GRPC_VERSION="v1.2.0"
|
PROTOC_GEN_GO_GRPC_VERSION="v1.2.0"
|
||||||
|
|
|
@ -699,8 +699,11 @@ func TestAPI_ClientTLSOptions(t *testing.T) {
|
||||||
|
|
||||||
// Should fail
|
// Should fail
|
||||||
_, err = client.Agent().Self()
|
_, err = client.Agent().Self()
|
||||||
if err == nil || !strings.Contains(err.Error(), "bad certificate") {
|
// Check for one of the possible cert error messages
|
||||||
t.Fatal(err)
|
// See https://cs.opensource.google/go/go/+/62a994837a57a7d0c58bb364b580a389488446c9
|
||||||
|
if err == nil || !(strings.Contains(err.Error(), "tls: bad certificate") ||
|
||||||
|
strings.Contains(err.Error(), "tls: certificate required")) {
|
||||||
|
t.Fatalf("expected tls certificate error, but got '%v'", err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue