diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index e7aad32..f093d55 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: "1.20" + go-version: "1.22" cache: false - name: Checkout the code uses: actions/checkout@v3.2.0 diff --git a/docker-files/Dockerfile b/docker-files/Dockerfile index 69f0780..3be10e1 100644 --- a/docker-files/Dockerfile +++ b/docker-files/Dockerfile @@ -15,10 +15,10 @@ # # Dockerfile to build CSI Metadata Retriever sidecar # some arguments that must be supplied -ARG GOVERSION +ARG GOIMAGE ARG BASEIMAGE # Stage to build the driver -FROM golang:${GOVERSION} as builder +FROM $GOIMAGE as builder RUN mkdir -p /go/src COPY ./ /go/src/ diff --git a/docker.mk b/docker.mk index 9e68084..4cd9481 100644 --- a/docker.mk +++ b/docker.mk @@ -22,13 +22,13 @@ docker: download-csm-common $(eval include csm-common.mk) echo "Building: $(REGISTRY)/$(IMAGENAME):v$(MAJOR).$(MINOR).$(PATCH) RELNOTE $(RELNOTE)" echo "$(DOCKER_FILE)" - $(BUILDER) build -f $(DOCKER_FILE) -t "$(REGISTRY)/$(IMAGENAME):v$(MAJOR).$(MINOR).$(PATCH)$(RELNOTE)" --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE) . + $(BUILDER) build -f $(DOCKER_FILE) -t "$(REGISTRY)/$(IMAGENAME):v$(MAJOR).$(MINOR).$(PATCH)$(RELNOTE)" --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) . docker-no-cache: download-csm-common $(eval include csm-common.mk) echo "Building: $(REGISTRY)/$(IMAGENAME):$(MAJOR).$(MINOR).$(PATCH) RELNOTE $(RELNOTE)" echo "$(DOCKER_FILE) --no-cache" - $(BUILDER) build --no-cache --pull -f $(DOCKER_FILE) -t "$(REGISTRY)/$(IMAGENAME):v$(MAJOR).$(MINOR).$(PATCH)$(RELNOTE)" --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE) . + $(BUILDER) build --no-cache --pull -f $(DOCKER_FILE) -t "$(REGISTRY)/$(IMAGENAME):v$(MAJOR).$(MINOR).$(PATCH)$(RELNOTE)" --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) . push: diff --git a/overrides.mk b/overrides.mk index 4ea15d8..02fe291 100644 --- a/overrides.mk +++ b/overrides.mk @@ -18,14 +18,14 @@ # DEFAULT values -DEFAULT_GOVERSION="1.21" +DEFAULT_GOIMAGE=$(shell sed -En 's/^go (.*)$$/\1/p' go.mod) DEFAULT_REGISTRY="dellemc" DEFAULT_IMAGENAME="csi-metadata-retriever" -# set the GOVERSION if needed -ifeq ($(GOVERSION),) -export GOVERSION="$(DEFAULT_GOVERSION)" +# set the GOIMAGE if needed +ifeq ($(GOIMAGE),) +export GOIMAGE="$(DEFAULT_GOIMAGE)" endif # set the REGISTRY if needed @@ -67,8 +67,8 @@ overrides-help: @echo @echo "The following environment variables can be set to control the build" @echo - @echo "GOVERSION - The version of Go to build with, default is: $(DEFAULT_GOVERSION)" - @echo " Current setting is: $(GOVERSION)" + @echo "GOIMAGE - The version of Go to build with, default is: $(DEFAULT_GOIMAGE)" + @echo " Current setting is: $(GOIMAGE)" @echo "REGISTRY - The registry to push images to, default is: $(DEFAULT_REGISTRY)" @echo " Current setting is: $(REGISTRY)" @echo "IMAGENAME - The image name to be built, defaut is: $(DEFAULT_IMAGENAME)"