diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index e613a1e6..901856c2 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: ["1.21","1.20","1.19"] + go-version: ["1.21"," 1.21.5","1.20",""1.20".4","1.20.5"] steps: - uses: actions/checkout@v4 - name: Calculate build vars @@ -60,8 +60,16 @@ jobs: - name: Build image env: GOLANG_VERSION: ${{ matrix.go-version }} + GOLANGCI_LINT_VERSION: "v1.42.1" + MOQ_VERSION: "v0.3.3" + CONTROLLER_GEN_VERSION: "v0.9.2" + CLIENT_GEN_VERSION: "v0.26.1" run: | docker build --build-arg GOLANG_VERSION=${GOLANG_VERSION} \ + --build-arg GOLANGCI_LINT_VERSION=${GOLANGCI_LINT_VERSION} \ + --build-arg MOQ_VERSION=${MOQ_VERSION} \ + --build-arg CONTROLLER_GEN_VERSION=${CONTROLLER_GEN_VERSION} \ + --build-arg CLIENT_GEN_VERSION=${CLIENT_GEN_VERSION} \ -f ./images/devel/Dockerfile \ --tag ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-test-infra:devel-go${GOLANG_VERSION} \ . diff --git a/images/devel/Dockerfile b/images/devel/Dockerfile index d1e74c6e..a9d29281 100644 --- a/images/devel/Dockerfile +++ b/images/devel/Dockerfile @@ -12,10 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -ARG GOLANG_VERSION=x.x +ARG GOLANG_VERSION=x.x.x +ARG GOLANGCI_LINT_VERSION=v1.52.0 +ARG MOQ_VERSION=latest +ARG CONTROLLER_GEN_VERSION=v0.9.2 +ARG CLIENT_GEN_VERSION=v0.26.1 FROM golang:${GOLANG_VERSION} -RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.0 \ - && go install github.com/matryer/moq@latest \ - && go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.2 \ - && go install k8s.io/code-generator/cmd/client-gen@v0.26.1 +RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} \ + && go install github.com/matryer/moq@${MOQ_VERSION} \ + && go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION} \ + && go install k8s.io/code-generator/cmd/client-gen@${CLIENT_GEN_VERSION} + +# We need to set the /work directory as a safe directory. +# This allows git commands to run in the container. +RUN git config --file=/.gitconfig --add safe.directory /work +