Skip to content

Commit 9df05d5

Browse files
authored
Merge pull request #760 from cpanato/cherrypick
fix missing variable when building the image on cloudbuild
2 parents 68bc22c + dc3ad23 commit 9df05d5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@
1313
# limitations under the License.
1414

1515
FROM golang:1.13.15 as builder
16+
17+
ARG STAGINGVERSION
18+
1619
WORKDIR /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
1720
ADD . .
18-
RUN make
21+
RUN GCE_PD_CSI_STAGING_VERSION=${STAGINGVERSION} make gce-pd-driver
1922

2023
# MAD HACKS: Build a version first so we can take the scsi_id bin and put it somewhere else in our real build
21-
FROM k8s.gcr.io/build-image/debian-base-amd64:buster-v1.5.0 as mad-hack
24+
FROM k8s.gcr.io/build-image/debian-base-amd64:buster-v1.6.0 as mad-hack
2225
RUN clean-install udev
2326

2427
# Start from Kubernetes Debian base
25-
FROM k8s.gcr.io/build-image/debian-base-amd64:buster-v1.5.0
28+
FROM k8s.gcr.io/build-image/debian-base-amd64:buster-v1.6.0
2629
COPY --from=builder /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver /gce-pd-csi-driver
2730
# Install necessary dependencies
2831
RUN clean-install util-linux e2fsprogs mount ca-certificates udev xfsprogs

Makefile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@
1515
# Args:
1616
# GCE_PD_CSI_STAGING_IMAGE: Staging image repository
1717
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
18-
ifdef GCE_PD_CSI_STAGING_VERSION
19-
STAGINGVERSION=${GCE_PD_CSI_STAGING_VERSION}
20-
else
21-
STAGINGVERSION=${REV}
22-
endif
18+
GCE_PD_CSI_STAGING_VERSION ?= ${REV}
19+
STAGINGVERSION=${GCE_PD_CSI_STAGING_VERSION}
2320
STAGINGIMAGE=${GCE_PD_CSI_STAGING_IMAGE}
2421
DRIVERBINARY=gce-pd-csi-driver
2522
DRIVERWINDOWSBINARY=${DRIVERBINARY}.exe
@@ -45,7 +42,7 @@ gce-pd-driver-windows:
4542
GOOS=windows go build -mod=vendor -ldflags -X=main.version=$(STAGINGVERSION) -o bin/${DRIVERWINDOWSBINARY} ./cmd/gce-pd-csi-driver/
4643

4744
build-container: require-GCE_PD_CSI_STAGING_IMAGE
48-
$(DOCKER) build --build-arg TAG=$(STAGINGVERSION) -t $(STAGINGIMAGE):$(STAGINGVERSION) .
45+
$(DOCKER) build --build-arg STAGINGVERSION=$(STAGINGVERSION) -t $(STAGINGIMAGE):$(STAGINGVERSION) .
4946

5047
build-and-push-windows-container-ltsc2019: require-GCE_PD_CSI_STAGING_IMAGE init-buildx
5148
$(DOCKER) buildx build --file=Dockerfile.Windows --platform=windows \
@@ -82,7 +79,7 @@ push-container: build-container
8279
build-and-push-container-linux: require-GCE_PD_CSI_STAGING_IMAGE init-buildx
8380
$(DOCKER) buildx build --platform=linux \
8481
-t $(STAGINGIMAGE):$(STAGINGVERSION)_linux \
85-
--build-arg TAG=$(STAGINGVERSION) --push .
82+
--build-arg STAGINGVERSION=$(STAGINGVERSION) --push .
8683

8784
test-sanity: gce-pd-driver
8885
go test -mod=vendor --v -timeout 30s sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/sanity -run ^TestSanity$

0 commit comments

Comments
 (0)