Skip to content

Commit 8326812

Browse files
authored
Merge pull request #465 from andyzhangx/fix-broken-pipeline
chore: fix broken post-csi-driver-smb-push-images pipeline
2 parents 60d4b2e + c353fba commit 8326812

File tree

7 files changed

+22
-18
lines changed

7 files changed

+22
-18
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,5 @@ cscope.*
6868

6969
/bazel-*
7070
*.pyc
71+
72+
bin

Makefile

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
CMDS=smbplugin
1516
PKG = github.com/kubernetes-csi/csi-driver-smb
1617
GINKGO_FLAGS = -ginkgo.v
1718
GO111MODULE = on
1819
GOPATH ?= $(shell go env GOPATH)
1920
GOBIN ?= $(GOPATH)/bin
2021
DOCKER_CLI_EXPERIMENTAL = enabled
21-
IMAGE_NAME ?= smb-csi
22+
IMAGENAME ?= smb-csi
2223
export GOPATH GOBIN GO111MODULE DOCKER_CLI_EXPERIMENTAL
2324

2425
include release-tools/build.make
@@ -34,11 +35,12 @@ ifndef PUBLISH
3435
override IMAGE_VERSION := e2e-$(GIT_COMMIT)
3536
endif
3637
endif
37-
IMAGE_TAG = $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION)
38-
IMAGE_TAG_LATEST = $(REGISTRY)/$(IMAGE_NAME):latest
38+
IMAGE_TAG = $(REGISTRY)/$(IMAGENAME):$(IMAGE_VERSION)
39+
IMAGE_TAG_LATEST = $(REGISTRY)/$(IMAGENAME):latest
3940
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
40-
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'"
41-
E2E_HELM_OPTIONS ?= --set image.smb.repository=$(REGISTRY)/$(IMAGE_NAME) --set image.smb.tag=$(IMAGE_VERSION) --set controller.dnsPolicy=ClusterFirstWithHostNet --set linux.dnsPolicy=ClusterFirstWithHostNet
41+
LDFLAGS = -X ${PKG}/pkg/smb.driverVersion=${IMAGE_VERSION} -X ${PKG}/pkg/smb.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/smb.buildDate=${BUILD_DATE}
42+
EXT_LDFLAGS = -s -w -extldflags "-static"
43+
E2E_HELM_OPTIONS ?= --set image.smb.repository=$(REGISTRY)/$(IMAGENAME) --set image.smb.tag=$(IMAGE_VERSION) --set controller.dnsPolicy=ClusterFirstWithHostNet --set linux.dnsPolicy=ClusterFirstWithHostNet
4244
E2E_HELM_OPTIONS += ${EXTRA_HELM_OPTIONS}
4345
# Generate all combination of all OS, ARCH, and OSVERSIONS for iteration
4446
ALL_OS = linux windows
@@ -120,39 +122,39 @@ e2e-teardown:
120122

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

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

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

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

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

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

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

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

157159
.PHONY: container-all
158160
container-all: smb-windows
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ ver=v0.6.0
1111

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

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

2020
docker manifest create $acrRepo:$ver $acrRepo:$ver-$linux $acrRepo:$ver-$win
2121
docker manifest inspect $acrRepo:$ver
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var (
3939
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
4040
nodeID = flag.String("nodeid", "", "node id")
4141
driverName = flag.String("drivername", smb.DefaultDriverName, "name of the driver")
42-
version = flag.Bool("version", false, "Print the version and exit.")
42+
ver = flag.Bool("ver", false, "Print the version and exit.")
4343
metricsAddress = flag.String("metrics-address", "0.0.0.0:29644", "export the metrics")
4444
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
4545
enableGetVolumeStats = flag.Bool("enable-get-volume-stats", false, "allow GET_VOLUME_STATS on agent node")
@@ -48,7 +48,7 @@ var (
4848

4949
func main() {
5050
flag.Parse()
51-
if *version {
51+
if *ver {
5252
info, err := smb.GetVersionYAML(*driverName)
5353
if err != nil {
5454
klog.Fatalln(err)

hack/release-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fi
2323

2424
export REGISTRY_NAME="$1"
2525
export REGISTRY=$REGISTRY_NAME.azurecr.io
26-
export IMAGE_NAME=public/k8s/csi/smb-csi
26+
export IMAGENAME=public/k8s/csi/smb-csi
2727
export CI=1
2828
export PUBLISH=1
2929

0 commit comments

Comments
 (0)