Skip to content

Commit f8595c1

Browse files
[release-2.2] Pass the correct LDFLAGS when building the operator image (#2544)
* Update module path in Makefile Signed-off-by: Yi Chen <[email protected]> * Update .dockerignore and .gitignore Signed-off-by: Yi Chen <[email protected]> --------- Signed-off-by: Yi Chen <[email protected]> Co-authored-by: Yi Chen <[email protected]>
1 parent 1ed9209 commit f8595c1

File tree

3 files changed

+13
-37
lines changed

3 files changed

+13
-37
lines changed

.dockerignore

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,7 @@
1-
.github/
21
.idea/
32
.vscode/
43
bin/
5-
charts/
6-
docs/
7-
config/
8-
examples/
9-
hack/
10-
manifest/
11-
spark-docker/
12-
test/
13-
vendor/
14-
.dockerignore
15-
.DS_Store
16-
.gitignore
17-
.gitlab-ci.yaml
18-
.golangci.yaml
19-
.pre-commit-config.yaml
20-
ADOPTERS.md
21-
CODE_OF_CONDUCT.md
22-
codecov.ymal
23-
CONTRIBUTING.md
4+
codecov.yaml
245
cover.out
25-
Dockerfile
26-
LICENSE
27-
OWNERS
28-
PROJECT
29-
README.md
30-
test.sh
6+
.DS_Store
7+
*.iml

.gitignore

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
.idea/
2+
.vscode/
13
bin/
2-
vendor/
4+
codecov.yaml
35
cover.out
4-
**/*.iml
5-
6-
# Various IDEs
7-
.idea/
8-
.vscode/
6+
.DS_Store
7+
*.iml

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ GIT_TREE_STATE := $(shell if [ -z "`git status --porcelain`" ]; then echo "clean
2121
GIT_SHA := $(shell git rev-parse --short HEAD || echo "HEAD")
2222
GIT_VERSION := ${VERSION}+${GIT_SHA}
2323

24-
REPO := github.com/kubeflow/spark-operator
24+
MODULE_PATH := $(shell awk '/^module/{print $$2; exit}' go.mod)
2525
SPARK_OPERATOR_GOPATH := /go/src/github.com/kubeflow/spark-operator
2626
SPARK_OPERATOR_CHART_PATH := charts/spark-operator-chart
2727
DEP_VERSION := `grep DEP_VERSION= Dockerfile | awk -F\" '{print $$2}'`
@@ -163,10 +163,10 @@ e2e-test: envtest ## Run the e2e tests against a Kind k8s instance that is spun
163163
##@ Build
164164

165165
override LDFLAGS += \
166-
-X ${REPO}.version=${GIT_VERSION} \
167-
-X ${REPO}.buildDate=${BUILD_DATE} \
168-
-X ${REPO}.gitCommit=${GIT_COMMIT} \
169-
-X ${REPO}.gitTreeState=${GIT_TREE_STATE} \
166+
-X ${MODULE_PATH}.version=${GIT_VERSION} \
167+
-X ${MODULE_PATH}.buildDate=${BUILD_DATE} \
168+
-X ${MODULE_PATH}.gitCommit=${GIT_COMMIT} \
169+
-X ${MODULE_PATH}.gitTreeState=${GIT_TREE_STATE} \
170170
-extldflags "-static"
171171

172172
.PHONY: build-operator

0 commit comments

Comments
 (0)