Skip to content

Commit

Permalink
Use go.mod go version in integration test Dockerfiles
Browse files Browse the repository at this point in the history
Signed-off-by: Faisal Memon <[email protected]>
  • Loading branch information
faisal-memon committed Nov 18, 2024
1 parent 2550ab0 commit 98b95d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion .github/tests/it/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ docker compose exec spire-server ./bin/spire-server entry create \
# set ups spire agent
docker compose up spire-agent -d

# extract go version
go_version=$(sed -En 's/^go[ ]+([0-9.]+).*/\1/p' ../../../go.mod)

# build spiffe-helper
docker compose build --build-arg go_version=$go_version spiffe-helper

# set ups and postgres-db
Expand All @@ -71,10 +74,12 @@ docker compose exec mysql-db /etc/init.d/mysql start
docker compose exec mysql-db su root -c "mysql < /var/lib/mysql/data/init.sql"

# set ups go-server
docker compose build --build-arg go_version=$go_version go-server
docker compose up go-server -d
wait go-server /run/go-server/certs/svid.crt
docker compose exec go-server su go-server -c "/opt/go-server/server &"

#set ups client
# set ups client
docker compose build --build-arg go_version=$go_version client
docker compose up client -d
wait client /run/client/certs/svid.crt
3 changes: 2 additions & 1 deletion .github/tests/it/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM golang:1.22.3-alpine AS builder
ARG go_version
FROM golang:${go_version}-alpine AS builder
COPY ./client.go /service/client.go
WORKDIR /service
RUN go build -tags netgo -a -v -o /service/client ./client.go
Expand Down
3 changes: 2 additions & 1 deletion .github/tests/it/go-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM golang:1.22.3-alpine AS builder
ARG go_version
FROM golang:${go_version}-alpine AS builder
COPY ./server.go /service/server.go
WORKDIR /service
RUN go build -tags netgo -a -v -o /service/server ./server.go
Expand Down

0 comments on commit 98b95d7

Please sign in to comment.