File tree 4 files changed +17
-2
lines changed
4 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 30
30
- name : Build and push
31
31
uses : docker/build-push-action@v6
32
32
with :
33
+ build-args : |
34
+ PROJECT_VERSION=${{ steps.meta.outputs.version }}
33
35
platforms : linux/amd64,linux/arm64
34
36
push : true
35
37
tags : ${{ steps.meta.outputs.tags }}
Original file line number Diff line number Diff line change @@ -12,9 +12,12 @@ COPY go.mod go.sum *.go ./
12
12
COPY cmd ./cmd
13
13
COPY internal ./internal
14
14
15
+ ARG PROJECT_VERSION
16
+ RUN test -n "${PROJECT_VERSION}"
17
+
15
18
ARG TARGETPLATFORM
16
19
ENV CGO_ENABLED=0
17
- RUN xx-go build -o bin/ -v ./... && \
20
+ RUN xx-go build -ldflags "-X main.projectVersion=${PROJECT_VERSION}" - o bin/ -v ./... && \
18
21
xx-verify bin/*
19
22
20
23
# hadolint ignore=DL3006
Original file line number Diff line number Diff line change @@ -9,7 +9,10 @@ services:
9
9
- ./docker-tests.sh:/usr/local/bin/docker-tests.sh:ro
10
10
11
11
docker-socket-proxy :
12
- build : ..
12
+ build :
13
+ context : ..
14
+ args :
15
+ - PROJECT_VERSION=integration-tests
13
16
command :
14
17
- /usr/local/bin/docker-socket-proxy
15
18
- -api-listen
Original file line number Diff line number Diff line change @@ -49,6 +49,13 @@ export DOCKER_SOCKET_GID
49
49
# Start the service
50
50
docker compose up -d --build --quiet-pull docker-socket-proxy
51
51
52
+ # Check that version was set at build.
53
+ got=$( docker compose exec docker-socket-proxy /usr/local/bin/docker-socket-proxy -version)
54
+ expected=" docker-socket-proxy version integration-tests"
55
+ if [ " $got " != " $expected " ]; then
56
+ die " unexpected version information, expected \" $expected \" , got \" $got \" "
57
+ fi
58
+
52
59
# Wait for the service to be ready
53
60
max_attempts=5
54
61
wait_success=
You can’t perform that action at this time.
0 commit comments