Skip to content

Commit cc596bd

Browse files
authored
Begin testing on go1.21rc2 with loopvar experiment (#6952)
Add go1.21rc2 to the matrix of go versions we test against. Add a new step to our CI workflows (boulder-ci, try-release, and release) which sets the "GOEXPERIMENT=loopvar" environment variable if we're running go1.21. This experiment makes it so that loop variables are scoped only to their single loop iteration, rather than to the whole loop. This prevents bugs such as our CAA Rechecking incident (https://bugzilla.mozilla.org/show_bug.cgi?id=1619047). Also add a line to our docker setup to propagate this environment variable into the container, where it can affect builds. Finally, fix one TLS-ALPN-01 test to have the fake subscriber server actually willing to negotiate the acme-tls/1 protocol, so that the ACME server's tls client actually waits to (fail to) get the certificate, instead of dying immediately. This fix is related to the upgrade to go1.21, not the loopvar experiment. Fixes #6950
1 parent 3d80d85 commit cc596bd

File tree

6 files changed

+26
-4
lines changed

6 files changed

+26
-4
lines changed

.github/workflows/boulder-ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
# Add additional docker image tags here and all tests will be run with the additional image.
3838
BOULDER_TOOLS_TAG:
3939
- go1.20.5_2023-06-20
40+
- go1.21rc2_2023-06-21
4041
# Tests command definitions. Use the entire "docker compose" command you want to run.
4142
tests:
4243
# Run ./test.sh --help for a description of each of the flags.
@@ -60,10 +61,10 @@ jobs:
6061
# container (used for service discovery).
6162
- "docker compose run --use-aliases netaccess ./test.sh --gomod-vendor"
6263

63-
# This sets the docker image tag for the boulder-tools repository to
64-
# use in tests. It will be set appropriately for each tag in the list
65-
# defined in the matrix.
6664
env:
65+
# This sets the docker image tag for the boulder-tools repository to
66+
# use in tests. It will be set appropriately for each tag in the list
67+
# defined in the matrix.
6768
BOULDER_TOOLS_TAG: ${{ matrix.BOULDER_TOOLS_TAG }}
6869

6970
# Sequence of tasks that will be executed as part of the job.
@@ -95,6 +96,11 @@ jobs:
9596
- name: docker compose pull
9697
run: docker compose pull
9798

99+
# Enable https://github.com/golang/go/wiki/LoopvarExperiment if we're on
100+
# go1.21rc2 or higher. This experiment value is unknown in lower versions.
101+
- if: startsWith(matrix.BOULDER_TOOLS_TAG, 'go1.21')
102+
run: echo "GOEXPERIMENT=loopvar" >> "$GITHUB_ENV"
103+
98104
# Run the test matrix. This will run
99105
- name: "Run Test: ${{ matrix.tests }}"
100106
run: ${{ matrix.tests }}

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
matrix:
1717
GO_VERSION:
1818
- "1.20.5"
19+
- "1.21rc2"
1920
runs-on: ubuntu-20.04
2021
permissions:
2122
contents: write
@@ -24,6 +25,11 @@ jobs:
2425
with:
2526
persist-credentials: false
2627

28+
# Enable https://github.com/golang/go/wiki/LoopvarExperiment if we're on
29+
# go1.21rc2 or higher. This experiment value is unknown in lower versions.
30+
- if: startsWith(matrix.GO_VERSION, '1.21')
31+
run: echo "GOEXPERIMENT=loopvar" >> "$GITHUB_ENV"
32+
2733
- name: Build .deb
2834
id: build
2935
env:

.github/workflows/try-release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ jobs:
1616
matrix:
1717
GO_VERSION:
1818
- "1.20.5"
19+
- "1.21rc2"
1920
runs-on: ubuntu-20.04
2021
steps:
2122
- uses: actions/checkout@v3
2223
with:
2324
persist-credentials: false
2425

26+
# Enable https://github.com/golang/go/wiki/LoopvarExperiment if we're on
27+
# go1.21rc2 or higher. This experiment value is unknown in lower versions.
28+
- if: startsWith(matrix.GO_VERSION, '1.21')
29+
run: echo "GOEXPERIMENT=loopvar" >> "$GITHUB_ENV"
30+
2531
- name: Build .deb
2632
id: build
2733
env:

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ services:
1010
FAKE_DNS: 10.77.77.77
1111
BOULDER_CONFIG_DIR: &boulder_config_dir test/config
1212
GOFLAGS: -mod=vendor
13+
# Forward the parent env's GOEXPERIMENT value into the container.
14+
GOEXPERIMENT: ${GOEXPERIMENT}
1315
volumes:
1416
- .:/boulder:cached
1517
- ./.gocache:/root/.cache/go-build:cached

test/boulder-tools/tag_and_upload.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ DOCKER_REPO="letsencrypt/boulder-tools"
1212
# .github/workflows/release.yml,
1313
# .github/workflows/try-release.yml if appropriate,
1414
# and .github/workflows/boulder-ci.yml with the new container tag.
15-
GO_CI_VERSIONS=( "1.20.5" )
15+
GO_CI_VERSIONS=( "1.20.5" "1.21rc2" )
1616
# These versions are built for both platforms that boulder devs use.
1717
# When updating GO_DEV_VERSIONS, please also update
1818
# ../../docker-compose.yml's default Go version.

va/tlsalpn_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ func TestTLSALPN01FailIP(t *testing.T) {
157157
func slowTLSSrv() *httptest.Server {
158158
server := httptest.NewUnstartedServer(http.DefaultServeMux)
159159
server.TLS = &tls.Config{
160+
NextProtos: []string{"http/1.1", ACMETLS1Protocol},
160161
GetCertificate: func(*tls.ClientHelloInfo) (*tls.Certificate, error) {
161162
time.Sleep(100 * time.Millisecond)
162163
return makeACert([]string{"nomatter"}), nil
@@ -196,6 +197,7 @@ func TestTLSALPNTimeoutAfterConnect(t *testing.T) {
196197
t.Fatalf("Connection should've timed out")
197198
}
198199
test.AssertEquals(t, prob.Type, probs.ConnectionProblem)
200+
199201
expected := "127.0.0.1: Timeout after connect (your server may be slow or overloaded)"
200202
if prob.Detail != expected {
201203
t.Errorf("Wrong error detail. Expected %q, got %q", expected, prob.Detail)

0 commit comments

Comments
 (0)