Skip to content

Commit 3ead440

Browse files
authored
Merge pull request #1963 from Jont828/useragent
Add version info to manager and userAgent in Tilt
2 parents 5522fe7 + d8a4b62 commit 3ead440

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,18 @@ endif
225225
$(KUBE_APISERVER) $(ETCD): ## install test asset kubectl, kube-apiserver, etcd
226226
source ./scripts/fetch_ext_bins.sh && fetch_tools
227227

228+
.PHONY: env-info # Temporary target to get additional logs in prow tests
229+
env-info:
230+
@echo "Working dir is $(shell pwd)"
231+
@echo "Working dir contents:"
232+
ls -la || echo ""
233+
@echo "Root dir contents:"
234+
ls -la / || echo ""
235+
@echo "Workspace contents are:"
236+
ls -la /workspace || echo ""
237+
@echo "Output of /hack/version.sh:"
238+
./hack/version.sh || echo ""
239+
228240
## --------------------------------------
229241
## Binaries
230242
## --------------------------------------
@@ -406,7 +418,7 @@ docker-pull-prerequisites:
406418
docker pull gcr.io/distroless/static:latest
407419

408420
.PHONY: docker-build
409-
docker-build: docker-pull-prerequisites ## Build the docker image for controller-manager
421+
docker-build: docker-pull-prerequisites env-info ## Build the docker image for controller-manager
410422
DOCKER_BUILDKIT=1 docker build --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG)-$(ARCH):$(TAG)
411423
$(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./config/default/manager_image_patch.yaml"
412424
$(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./config/default/manager_pull_policy.yaml"

Tiltfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,12 @@ def capz():
177177
yaml = str(encode_yaml_stream(yaml_dict))
178178
yaml = fixup_yaml_empty_arrays(yaml)
179179

180+
ldflags = str(local("hack/version.sh"))
181+
180182
# Set up a local_resource build of the provider's manager binary.
181183
local_resource(
182184
"manager",
183-
cmd = 'mkdir -p .tiltbuild;CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags \'-extldflags "-static"\' -o .tiltbuild/manager',
185+
cmd = 'mkdir -p .tiltbuild;CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags \'-extldflags "-static" ' + ldflags + "' -o .tiltbuild/manager",
184186
deps = ["api", "azure", "config", "controllers", "exp", "feature", "pkg", "util", "go.mod", "go.sum", "main.go"],
185187
labels = ["cluster-api"],
186188
)

hack/version.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ version::get_version_vars() {
4343
# We have distance to base tag (v1.1.0-1-gCommitHash)
4444
# shellcheck disable=SC2001
4545
GIT_VERSION=$(echo "${GIT_VERSION}" | sed "s/-g\([0-9a-f]\{14\}\)$/-\1/")
46+
# TODO: What should the output of this command look like?
47+
# For example, v1.1.0-32-gfeb4736460af8f maps to v1.1.0-32-f, do we want the trailing "-f" or not?
4648
fi
4749
if [[ "${GIT_TREE_STATE}" == "dirty" ]]; then
4850
# git describe --dirty only considers changes to existing files, but

0 commit comments

Comments
 (0)