Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Single source of truth for Go version in CI and Dockerfile #382

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,7 @@ jobs:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
# pinning this to 1.20.5 because this issue in go-testcontainers occurs
# in 1.20.6 with the error "http: invalid Host header, host port waiting failed"
# https://github.com/testcontainers/testcontainers-go/issues/1359
# remove setting this when the above issue is fixed so that the job will
# just get the go version from .go-version.
go-version: 1.20.5
go-version: ${{ needs.get-go-version.outputs.go-version }}
- id: run-tests
run: cd integration-tests && go test -v -output-dir=./output -dataplane-image=hashicorppreview/${{env.repo}}:${{env.dev_tag}}-${{github.sha}} -server-image=${{matrix.server.image}} -server-version=${{matrix.server.version}}
continue-on-error: true
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/consul-dataplane-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ jobs:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
# pinning this to 1.20.5 because this issue in go-testcontainers occurs
# in 1.20.6 with the error "http: invalid Host header, host port waiting failed"
# https://github.com/testcontainers/testcontainers-go/issues/1359
# remove setting this when the above issue is fixed so that the job will
# just get the go version from .go-version.
go-version: 1.20.5
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: make docker
# Currently the server version below is set to 1.15-dev: integration-tests/main_test.go
- run: echo "VERSION=$(make version)" >> $GITHUB_ENV
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ FROM debian:bullseye-slim AS setcap-envoy-fips-binary
ARG BIN_NAME=consul-dataplane
ARG TARGETARCH
ARG TARGETOS
ARG GOLANG_VERSION

COPY --from=envoy-fips-binary /usr/local/bin/envoy /usr/local/bin/
COPY dist/$TARGETOS/$TARGETARCH/$BIN_NAME /usr/local/bin/
Expand All @@ -43,7 +44,7 @@ RUN setcap CAP_NET_BIND_SERVICE=+ep /usr/local/bin/$BIN_NAME

# go-discover builds the discover binary (which we don't currently publish
# either).
FROM golang:1.20.12-alpine as go-discover
FROM golang:${GOLANG_VERSION}-alpine as go-discover
RUN CGO_ENABLED=0 go install github.com/hashicorp/go-discover/cmd/discover@214571b6a5309addf3db7775f4ee8cf4d264fd5f

# Pull in dumb-init from alpine, as our distroless release image doesn't have a
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ REVISION = $(shell git rev-parse HEAD)

# Docker Stuff.
export DOCKER_BUILDKIT=1
BUILD_ARGS = BIN_NAME=$(BIN_NAME) PRODUCT_VERSION=$(VERSION) PRODUCT_REVISION=$(REVISION)
BUILD_ARGS = BIN_NAME=$(BIN_NAME) PRODUCT_VERSION=$(VERSION) PRODUCT_REVISION=$(REVISION) GOLANG_VERSION=$(GOLANG_VERSION)
TAG = $(PRODUCT_NAME):$(VERSION)
BA_FLAGS = $(addprefix --build-arg=,$(BUILD_ARGS))
FLAGS = --target $(TARGET) --platform $(PLATFORM) --tag $(TAG) $(BA_FLAGS)
Expand Down
Loading