Skip to content

Commit

Permalink
Merge pull request #465 from andyzhangx/fix-broken-pipeline
Browse files Browse the repository at this point in the history
chore: fix broken post-csi-driver-smb-push-images pipeline
  • Loading branch information
andyzhangx authored May 1, 2022
2 parents 60d4b2e + c353fba commit 8326812
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ cscope.*

/bazel-*
*.pyc

bin
28 changes: 15 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

CMDS=smbplugin
PKG = github.com/kubernetes-csi/csi-driver-smb
GINKGO_FLAGS = -ginkgo.v
GO111MODULE = on
GOPATH ?= $(shell go env GOPATH)
GOBIN ?= $(GOPATH)/bin
DOCKER_CLI_EXPERIMENTAL = enabled
IMAGE_NAME ?= smb-csi
IMAGENAME ?= smb-csi
export GOPATH GOBIN GO111MODULE DOCKER_CLI_EXPERIMENTAL

include release-tools/build.make
Expand All @@ -34,11 +35,12 @@ ifndef PUBLISH
override IMAGE_VERSION := e2e-$(GIT_COMMIT)
endif
endif
IMAGE_TAG = $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION)
IMAGE_TAG_LATEST = $(REGISTRY)/$(IMAGE_NAME):latest
IMAGE_TAG = $(REGISTRY)/$(IMAGENAME):$(IMAGE_VERSION)
IMAGE_TAG_LATEST = $(REGISTRY)/$(IMAGENAME):latest
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS ?= "-X ${PKG}/pkg/smb.driverVersion=${IMAGE_VERSION} -X ${PKG}/pkg/smb.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/smb.buildDate=${BUILD_DATE} -s -w -extldflags '-static'"
E2E_HELM_OPTIONS ?= --set image.smb.repository=$(REGISTRY)/$(IMAGE_NAME) --set image.smb.tag=$(IMAGE_VERSION) --set controller.dnsPolicy=ClusterFirstWithHostNet --set linux.dnsPolicy=ClusterFirstWithHostNet
LDFLAGS = -X ${PKG}/pkg/smb.driverVersion=${IMAGE_VERSION} -X ${PKG}/pkg/smb.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/smb.buildDate=${BUILD_DATE}
EXT_LDFLAGS = -s -w -extldflags "-static"
E2E_HELM_OPTIONS ?= --set image.smb.repository=$(REGISTRY)/$(IMAGENAME) --set image.smb.tag=$(IMAGE_VERSION) --set controller.dnsPolicy=ClusterFirstWithHostNet --set linux.dnsPolicy=ClusterFirstWithHostNet
E2E_HELM_OPTIONS += ${EXTRA_HELM_OPTIONS}
# Generate all combination of all OS, ARCH, and OSVERSIONS for iteration
ALL_OS = linux windows
Expand Down Expand Up @@ -120,39 +122,39 @@ e2e-teardown:

.PHONY: smb
smb:
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -a -ldflags "${LDFLAGS}" -mod vendor -o _output/${ARCH}/smbplugin ./pkg/smbplugin
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -a -ldflags "${LDFLAGS} ${EXT_LDFLAGS}" -mod vendor -o _output/${ARCH}/smbplugin ./cmd/smbplugin

.PHONY: smb-armv7
smb-armv7:
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -a -ldflags "${LDFLAGS}" -mod vendor -o _output/arm/v7/smbplugin ./pkg/smbplugin
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -a -ldflags "${LDFLAGS} ${EXT_LDFLAGS}" -mod vendor -o _output/arm/v7/smbplugin ./cmd/smbplugin

.PHONY: smb-windows
smb-windows:
CGO_ENABLED=0 GOOS=windows go build -a -ldflags "${LDFLAGS}" -mod vendor -o _output/${ARCH}/smbplugin.exe ./pkg/smbplugin
CGO_ENABLED=0 GOOS=windows go build -a -ldflags "${LDFLAGS} ${EXT_LDFLAGS}" -mod vendor -o _output/${ARCH}/smbplugin.exe ./cmd/smbplugin

.PHONY: smb-darwin
smb-darwin:
CGO_ENABLED=0 GOOS=darwin go build -a -ldflags "${LDFLAGS}" -mod vendor -o _output/${ARCH}/smbplugin ./pkg/smbplugin
CGO_ENABLED=0 GOOS=darwin go build -a -ldflags "${LDFLAGS} ${EXT_LDFLAGS}" -mod vendor -o _output/${ARCH}/smbplugin ./cmd/smbplugin

.PHONY: container
container: smb
docker build --no-cache -t $(IMAGE_TAG) --output=type=docker -f ./pkg/smbplugin/Dockerfile .
docker build --no-cache -t $(IMAGE_TAG) --output=type=docker -f ./cmd/smbplugin/Dockerfile .

.PHONY: container-linux
container-linux:
docker buildx build --pull --output=type=$(OUTPUT_TYPE) --platform="linux/$(ARCH)" \
-t $(IMAGE_TAG)-linux-$(ARCH) --build-arg ARCH=$(ARCH) -f ./pkg/smbplugin/Dockerfile .
-t $(IMAGE_TAG)-linux-$(ARCH) --build-arg ARCH=$(ARCH) -f ./cmd/smbplugin/Dockerfile .

.PHONY: container-linux-armv7
container-linux-armv7:
docker buildx build --pull --output=type=$(OUTPUT_TYPE) --platform="linux/arm/v7" \
-t $(IMAGE_TAG)-linux-arm-v7 --build-arg ARCH=arm/v7 -f ./pkg/smbplugin/Dockerfile .
-t $(IMAGE_TAG)-linux-arm-v7 --build-arg ARCH=arm/v7 -f ./cmd/smbplugin/Dockerfile .

.PHONY: container-windows
container-windows:
docker buildx build --pull --output=type=$(OUTPUT_TYPE) --platform="windows/$(ARCH)" \
-t $(IMAGE_TAG)-windows-$(OSVERSION)-$(ARCH) --build-arg OSVERSION=$(OSVERSION) \
--build-arg ARCH=$(ARCH) -f ./pkg/smbplugin/Windows.Dockerfile .
--build-arg ARCH=$(ARCH) -f ./cmd/smbplugin/Windows.Dockerfile .

.PHONY: container-all
container-all: smb-windows
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pkg/smbplugin/README.md → cmd/smbplugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ ver=v0.6.0

linux="linux-amd64"
make smb
az acr build -r $acrName -t $acrRepo:$ver-$linux -f pkg/smbplugin/Dockerfile --platform linux .
az acr build -r $acrName -t $acrRepo:$ver-$linux -f cmd/smbplugin/Dockerfile --platform linux .

win="windows-1809-amd64"
make smb-windows
az acr build -r $acrName -t $acrRepo:$ver-$win -f pkg/smbplugin/Windows.Dockerfile --platform windows .
az acr build -r $acrName -t $acrRepo:$ver-$win -f cmd/smbplugin/Windows.Dockerfile --platform windows .

docker manifest create $acrRepo:$ver $acrRepo:$ver-$linux $acrRepo:$ver-$win
docker manifest inspect $acrRepo:$ver
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pkg/smbplugin/main.go → cmd/smbplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var (
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
nodeID = flag.String("nodeid", "", "node id")
driverName = flag.String("drivername", smb.DefaultDriverName, "name of the driver")
version = flag.Bool("version", false, "Print the version and exit.")
ver = flag.Bool("ver", false, "Print the version and exit.")
metricsAddress = flag.String("metrics-address", "0.0.0.0:29644", "export the metrics")
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
enableGetVolumeStats = flag.Bool("enable-get-volume-stats", false, "allow GET_VOLUME_STATS on agent node")
Expand All @@ -48,7 +48,7 @@ var (

func main() {
flag.Parse()
if *version {
if *ver {
info, err := smb.GetVersionYAML(*driverName)
if err != nil {
klog.Fatalln(err)
Expand Down
2 changes: 1 addition & 1 deletion hack/release-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi

export REGISTRY_NAME="$1"
export REGISTRY=$REGISTRY_NAME.azurecr.io
export IMAGE_NAME=public/k8s/csi/smb-csi
export IMAGENAME=public/k8s/csi/smb-csi
export CI=1
export PUBLISH=1

Expand Down

0 comments on commit 8326812

Please sign in to comment.