From 98b95d769d9a2a7508a9862ba94141c04856bbd3 Mon Sep 17 00:00:00 2001 From: Faisal Memon Date: Mon, 18 Nov 2024 15:05:38 -0800 Subject: [PATCH] Use go.mod go version in integration test Dockerfiles Signed-off-by: Faisal Memon --- .github/tests/it/build.sh | 7 ++++++- .github/tests/it/client/Dockerfile | 3 ++- .github/tests/it/go-server/Dockerfile | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/tests/it/build.sh b/.github/tests/it/build.sh index 02a3ecd..b151c50 100755 --- a/.github/tests/it/build.sh +++ b/.github/tests/it/build.sh @@ -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 @@ -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 diff --git a/.github/tests/it/client/Dockerfile b/.github/tests/it/client/Dockerfile index 085721a..0208098 100644 --- a/.github/tests/it/client/Dockerfile +++ b/.github/tests/it/client/Dockerfile @@ -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 diff --git a/.github/tests/it/go-server/Dockerfile b/.github/tests/it/go-server/Dockerfile index f6e1a8e..5aa7c85 100644 --- a/.github/tests/it/go-server/Dockerfile +++ b/.github/tests/it/go-server/Dockerfile @@ -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