From 15bc8b04232438ac9e5372bf5d5a6d1325b1db4a Mon Sep 17 00:00:00 2001 From: kmova Date: Fri, 18 Dec 2020 20:53:15 +0000 Subject: [PATCH] setup automated builds using the release-tools Use the steps at below link to setup automated builds via release-tools. https://github.com/kubernetes-csi/csi-release-tools - add release-tools via git subtree - update Makefile to use the release-tools/make - add cloudbuild links from release-tools - update Dockerfile that can be used for multi-arch by release tools Signed-off-by: kmova --- .cloudbuild.sh | 1 + Dockerfile | 22 ++++++++++++++++++++++ Makefile | 37 ++++--------------------------------- README.md | 8 +++++--- cloudbuild.yaml | 1 + go.sum | 1 + 6 files changed, 34 insertions(+), 36 deletions(-) create mode 120000 .cloudbuild.sh create mode 100644 Dockerfile create mode 120000 cloudbuild.yaml diff --git a/.cloudbuild.sh b/.cloudbuild.sh new file mode 120000 index 00000000..d9b2a9a3 --- /dev/null +++ b/.cloudbuild.sh @@ -0,0 +1 @@ +./release-tools/cloudbuild.sh \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..287549bd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Copyright 2017-2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM alpine +LABEL maintainers="Kubernetes Authors" +LABEL description="NFS subdir external provisioner" +ARG binary=./bin/nfs-subdir-external-provisioner + +RUN apk update --no-cache && apk add ca-certificates +COPY ${binary} /nfs-subdir-external-provisioner +ENTRYPOINT ["/nfs-subdir-external-provisioner"] diff --git a/Makefile b/Makefile index 9452755f..31d1b4f3 100644 --- a/Makefile +++ b/Makefile @@ -12,38 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -ifeq ($(REGISTRY),) - REGISTRY = quay.io/external_storage/ -endif -ifeq ($(VERSION),) - VERSION = latest -endif -IMAGE = $(REGISTRY)nfs-subdir-external-provisioner:$(VERSION) -IMAGE_ARM = $(REGISTRY)nfs-subdir-external-provisioner-arm:$(VERSION) -MUTABLE_IMAGE = $(REGISTRY)nfs-subdir-external-provisioner:latest -MUTABLE_IMAGE_ARM = $(REGISTRY)nfs-subdir-external-provisioner-arm:latest +CMDS=nfs-subdir-external-provisioner +all: build -all: build image build_arm image_arm +include release-tools/build.make -container: build image build_arm image_arm - -build: - CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o docker/x86_64/nfs-subdir-external-provisioner ./cmd/nfs-subdir-external-provisioner - -build_arm: - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -a -ldflags '-extldflags "-static"' -o docker/arm/nfs-subdir-external-provisioner ./cmd/nfs-subdir-external-provisioner - -image: - docker build -t $(MUTABLE_IMAGE) docker/x86_64 - docker tag $(MUTABLE_IMAGE) $(IMAGE) - -image_arm: - docker run --rm --privileged multiarch/qemu-user-static:register --reset - docker build -t $(MUTABLE_IMAGE_ARM) docker/arm - docker tag $(MUTABLE_IMAGE_ARM) $(IMAGE_ARM) - -push: - docker push $(IMAGE) - docker push $(MUTABLE_IMAGE) - docker push $(IMAGE_ARM) - docker push $(MUTABLE_IMAGE_ARM) +BUILD_PLATFORMS=linux amd64; linux arm64 -arm64; linux ppc64le -ppc64le; linux s390x -s390x diff --git a/README.md b/README.md index c6e2f368..94acbc2e 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,11 @@ Note: This repository is being migrated from https://github.com/kubernetes-incub ```sh make build -# Set a custom image registry to push the container image -# Example REGISTRY="quay.io/myorg" -make image +make container +# `nfs-subdir-external-provisioner:latest` will be created. +# To upload this to your customer registry, say `quay.io/myorg`, you can use +# docker tag nfs-subdir-external-provisioner:latest quay.io/myorg/nfs-subdir-external-provisioner:latest +# docker push quay.io/myorg/nfs-subdir-external-provisioner:latest ``` ## How to deploy nfs-client to your cluster diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 120000 index 00000000..16d51841 --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1 @@ +./release-tools/cloudbuild.yaml \ No newline at end of file diff --git a/go.sum b/go.sum index 107ca8eb..616f28ff 100644 --- a/go.sum +++ b/go.sum @@ -151,6 +151,7 @@ github.com/heketi/tests v0.0.0-20151005000721-f3775cbcefd6/go.mod h1:xGMAM8JLi7U github.com/heketi/utils v0.0.0-20170317161834-435bc5bdfa64/go.mod h1:RYlF4ghFZPPmk2TC5REt5OFwvfb6lzxFWrTWB+qs28s= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=