Skip to content

Commit 5b3c84d

Browse files
authored
Remove the "netaccess" container from the docker-compose dev environment. (#7123)
Remove the "netaccess" container from the docker-compose dev environment. It isn't needed during a regular 'docker compose up' developer environment, and only really serves as a way to use the same tools image in CI. Two checks run during CI are the govulncheck and verifying go mod tidy / go vendor. Neither of these checks require anything from the custom image other than Golang itself, which can be provided directly from the CI environment. If a developer is working inside the existing containers, they can still run `go mod tidy; go mod vendor` themselves, which is a standard Golang workflow and thus is simpler than using the netaccess image via docker compose.
1 parent 776287f commit 5b3c84d

File tree

4 files changed

+33
-85
lines changed

4 files changed

+33
-85
lines changed

.github/workflows/boulder-ci.yml

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ jobs:
5555
- "./t.sh --unit --enable-race-detection"
5656
- "./tn.sh --unit --enable-race-detection"
5757
- "./t.sh --start-py"
58-
# gomod-vendor runs with a separate network access definition
59-
# because it needs to fetch packages from GitHub et. al., which
60-
# is incompatible with the DNS server override in the boulder
61-
# container (used for service discovery).
62-
- "docker compose run --use-aliases netaccess ./test.sh --gomod-vendor"
6358

6459
env:
6560
# This sets the docker image tag for the boulder-tools repository to
@@ -109,54 +104,48 @@ jobs:
109104
# When set to true, GitHub cancels all in-progress jobs if any matrix job fails. Default: true
110105
fail-fast: false
111106
matrix:
112-
# Add additional docker image tags here and all tests will be run with the additional image.
113-
BOULDER_TOOLS_TAG:
114-
- go1.21.3_2023-10-12
115-
116-
env:
117-
# This sets the docker image tag for the boulder-tools repository to
118-
# use in tests. It will be set appropriately for each tag in the list
119-
# defined in the matrix.
120-
BOULDER_TOOLS_TAG: ${{ matrix.BOULDER_TOOLS_TAG }}
107+
go-version: [ '1.21.3' ]
121108

122109
steps:
123110
# Checks out your repository under $GITHUB_WORKSPACE, so your job can access it
124111
- uses: actions/checkout@v3
125112
with:
126113
persist-credentials: false
127114

128-
- name: Docker Login
129-
# You may pin to the exact commit or the version.
130-
# uses: docker/login-action@f3364599c6aa293cdc2b8391b1b56d0c30e45c8a
131-
uses: docker/[email protected]
115+
- name: Setup Go ${{ matrix.go-version }}
116+
uses: actions/setup-go@v4
132117
with:
133-
# Username used to log against the Docker registry
134-
username: ${{ secrets.DOCKER_USERNAME}}
135-
# Password or personal access token used to log against the Docker registry
136-
password: ${{ secrets.DOCKER_PASSWORD}}
137-
# Log out from the Docker registry at the end of a job
138-
logout: true
139-
continue-on-error: true
118+
go-version: ${{ matrix.go-version }}
140119

141-
# Print the env variable being used to pull the docker image. For
142-
# informational use.
143-
- name: Print BOULDER_TOOLS_TAG
144-
run: echo "Using BOULDER_TOOLS_TAG ${BOULDER_TOOLS_TAG}"
120+
- name: Run govulncheck
121+
run: go run golang.org/x/vuln/cmd/govulncheck@latest ./...
145122

146-
# Pre-pull the docker containers before running the tests.
147-
- name: docker compose pull netaccess
148-
run: docker compose pull netaccess
123+
vendorcheck:
124+
runs-on: ubuntu-20.04
125+
strategy:
126+
# When set to true, GitHub cancels all in-progress jobs if any matrix job fails. Default: true
127+
fail-fast: false
128+
matrix:
129+
go-version: [ '1.21.3' ]
149130

150-
# Enable https://github.com/golang/go/wiki/LoopvarExperiment
151-
- run: echo "GOEXPERIMENT=loopvar" >> "$GITHUB_ENV"
131+
steps:
132+
# Checks out your repository under $GITHUB_WORKSPACE, so your job can access it
133+
- uses: actions/checkout@v3
134+
with:
135+
persist-credentials: false
136+
137+
- name: Setup Go ${{ matrix.go-version }}
138+
uses: actions/setup-go@v4
139+
with:
140+
go-version: ${{ matrix.go-version }}
141+
142+
- name: Verify vendor
143+
shell: bash
144+
run: |
145+
go mod tidy
146+
go mod vendor
147+
git diff --exit-code
152148
153-
# Unset the GOFLAGS environment variable because, by default, it will be
154-
# set to "GOFLAGS='-mod=vendor'" which all go subcommands will utilize. In
155-
# this instance, we want to run a package that isn't vendored in our
156-
# repository because 1) we don't need this package for CA operations and
157-
# 2) we want the benefits of vulnerability checking.
158-
- name: Run govulncheck
159-
run: docker compose run -e GOFLAGS= netaccess go run golang.org/x/vuln/cmd/govulncheck@latest ./...
160149
161150
# This is a utility build job to detect if the status of any of the
162151
# above jobs have failed and fail if so. It is needed so there can be

docker-compose.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ version: '3'
22
services:
33
boulder:
44
# Should match one of the GO_DEV_VERSIONS in test/boulder-tools/tag_and_upload.sh.
5-
image: &boulder_image letsencrypt/boulder-tools:${BOULDER_TOOLS_TAG:-go1.21.3_2023-10-12}
5+
image: letsencrypt/boulder-tools:${BOULDER_TOOLS_TAG:-go1.21.3_2023-10-12}
66
environment:
77
# To solve HTTP-01 and TLS-ALPN-01 challenges, change the IP in FAKE_DNS
88
# to the IP address where your ACME client's solver is listening.
99
# FAKE_DNS: 172.17.0.1
1010
FAKE_DNS: 10.77.77.77
11-
BOULDER_CONFIG_DIR: &boulder_config_dir test/config
11+
BOULDER_CONFIG_DIR: test/config
1212
GOFLAGS: -mod=vendor
1313
# Forward the parent env's GOEXPERIMENT value into the container.
1414
GOEXPERIMENT: ${GOEXPERIMENT}
@@ -132,19 +132,6 @@ services:
132132
ipv4_address: 10.88.88.10
133133
command: "consul agent -dev -config-format=hcl -config-file=/test/consul/config.hcl"
134134

135-
netaccess:
136-
image: *boulder_image
137-
environment:
138-
GO111MODULE: "on"
139-
GOFLAGS: -mod=vendor
140-
BOULDER_CONFIG_DIR: *boulder_config_dir
141-
networks:
142-
- bluenet
143-
volumes:
144-
- .:/boulder
145-
working_dir: *boulder_working_dir
146-
entrypoint: test/entrypoint-netaccess.sh
147-
148135
bjaeger:
149136
image: jaegertracing/all-in-one:1.50
150137
networks:

test.sh

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ With no options passed, runs standard battery of tests (lint, unit, and integrat
100100
-n, --config-next Changes BOULDER_CONFIG_DIR from test/config to test/config-next
101101
-i, --integration Adds integration to the list of tests to run
102102
-s, --start-py Adds start to the list of tests to run
103-
-m, --gomod-vendor Adds gomod-vendor to the list of tests to run
104103
-g, --generate Adds generate to the list of tests to run
105104
-o, --list-integration-tests Outputs a list of the available integration tests
106105
-f <REGEX>, --filter=<REGEX> Run only those tests matching the regular expression
@@ -135,7 +134,6 @@ while getopts luvweciosmgnhp:f:-: OPT; do
135134
o | list-integration-tests ) print_list_of_integration_tests ;;
136135
f | filter ) check_arg; FILTER+=("${OPTARG}") ;;
137136
s | start-py ) RUN+=("start") ;;
138-
m | gomod-vendor ) RUN+=("gomod-vendor") ;;
139137
g | generate ) RUN+=("generate") ;;
140138
n | config-next ) BOULDER_CONFIG_DIR="test/config-next" ;;
141139
h | help ) print_usage_exit ;;
@@ -145,9 +143,7 @@ while getopts luvweciosmgnhp:f:-: OPT; do
145143
done
146144
shift $((OPTIND-1)) # remove parsed options and args from $@ list
147145

148-
# The list of segments to run. Order doesn't matter. Note: gomod-vendor
149-
# is specifically left out of the defaults, because we don't want to run
150-
# it locally (it could delete local state).
146+
# The list of segments to run. Order doesn't matter.
151147
if [ -z "${RUN[@]+x}" ]
152148
then
153149
RUN+=("lints" "unit" "integration")
@@ -260,17 +256,6 @@ if [[ "${RUN[@]}" =~ "$STAGE" ]] ; then
260256
fi
261257
fi
262258

263-
# Run go mod vendor (happens only in CI) to check that the versions in
264-
# vendor/ really exist in the remote repo and match what we have.
265-
STAGE="gomod-vendor"
266-
if [[ "${RUN[@]}" =~ "$STAGE" ]] ; then
267-
print_heading "Running Go Mod Tidy"
268-
go mod tidy
269-
print_heading "Running Go Mod Vendor"
270-
go mod vendor
271-
run_and_expect_silence git diff --exit-code .
272-
fi
273-
274259
# Run generate to make sure all our generated code can be re-generated with
275260
# current tools.
276261
# Note: Some of the tools we use seemingly don't understand ./vendor yet, and

test/entrypoint-netaccess.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)