Skip to content

fix missing variable when building the image on cloudbuild #760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@
# limitations under the License.

FROM golang:1.13.15 as builder

ARG STAGINGVERSION

WORKDIR /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
ADD . .
RUN make
RUN GCE_PD_CSI_STAGING_VERSION=${STAGINGVERSION} make gce-pd-driver

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

# Start from Kubernetes Debian base
FROM k8s.gcr.io/build-image/debian-base-amd64:buster-v1.5.0
FROM k8s.gcr.io/build-image/debian-base-amd64:buster-v1.6.0
COPY --from=builder /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver /gce-pd-csi-driver
# Install necessary dependencies
RUN clean-install util-linux e2fsprogs mount ca-certificates udev xfsprogs
Expand Down
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
# Args:
# GCE_PD_CSI_STAGING_IMAGE: Staging image repository
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
ifdef GCE_PD_CSI_STAGING_VERSION
STAGINGVERSION=${GCE_PD_CSI_STAGING_VERSION}
else
STAGINGVERSION=${REV}
endif
GCE_PD_CSI_STAGING_VERSION ?= ${REV}
STAGINGVERSION=${GCE_PD_CSI_STAGING_VERSION}
STAGINGIMAGE=${GCE_PD_CSI_STAGING_IMAGE}
DRIVERBINARY=gce-pd-csi-driver
DRIVERWINDOWSBINARY=${DRIVERBINARY}.exe
Expand All @@ -45,7 +42,7 @@ gce-pd-driver-windows:
GOOS=windows go build -mod=vendor -ldflags -X=main.version=$(STAGINGVERSION) -o bin/${DRIVERWINDOWSBINARY} ./cmd/gce-pd-csi-driver/

build-container: require-GCE_PD_CSI_STAGING_IMAGE
$(DOCKER) build --build-arg TAG=$(STAGINGVERSION) -t $(STAGINGIMAGE):$(STAGINGVERSION) .
$(DOCKER) build --build-arg STAGINGVERSION=$(STAGINGVERSION) -t $(STAGINGIMAGE):$(STAGINGVERSION) .

build-and-push-windows-container-ltsc2019: require-GCE_PD_CSI_STAGING_IMAGE init-buildx
$(DOCKER) buildx build --file=Dockerfile.Windows --platform=windows \
Expand Down Expand Up @@ -82,7 +79,7 @@ push-container: build-container
build-and-push-container-linux: require-GCE_PD_CSI_STAGING_IMAGE init-buildx
$(DOCKER) buildx build --platform=linux \
-t $(STAGINGIMAGE):$(STAGINGVERSION)_linux \
--build-arg TAG=$(STAGINGVERSION) --push .
--build-arg STAGINGVERSION=$(STAGINGVERSION) --push .

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