Skip to content

Commit 0b7b63a

Browse files
authored
Merge pull request #18 from platform9/dg/predictable-agent-versioning
dg/predictable agent versioning
2 parents 9fd5c17 + f85d56d commit 0b7b63a

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.ci/build-push-controller.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,21 @@ GO_VERSION=${GO_VERSION:-1.22.5}
2626

2727
IMAGE_REGISTRY=${IMAGE_REGISTRY:-"quay.io/platform9/cluster-api-provider-bringyourownhost"}
2828
IMAGE_NAME=${IMAGE_NAME:-"controller-manager"}
29-
IMAGE_TAG=${IMAGE_TAG:-$(make -C "${project_root}" tag)}
29+
IMAGE_TAG=${IMAGE_TAG:-$(make --no-print-directory -C "${project_root}" tag)}
3030
IMAGE_NAME_TAG=${IMAGE_NAME}:${IMAGE_TAG}
3131
IMAGE_REGISTRY_NAME_TAG=${IMAGE_REGISTRY}/${IMAGE_NAME_TAG}
3232

33+
# make -C implicitly enables --print-directory on some GNU Make versions
34+
# (confirmed: not on this repo's dev-Mac Make 3.81, but yes on the Ubuntu
35+
# CI runner's newer Make) -- without --no-print-directory above, the
36+
# "Entering directory" chatter leaks into IMAGE_TAG via command
37+
# substitution and corrupts the docker -t argument. Fail loud if it ever
38+
# recurs instead of silently building/pushing a mistagged image.
39+
if [[ "${IMAGE_TAG}" =~ [[:space:]] ]]; then
40+
echo "ERROR: IMAGE_TAG contains whitespace, likely make output leaked into the tag: '${IMAGE_TAG}'" >&2
41+
exit 1
42+
fi
43+
3344

3445
main() {
3546
# Move to the project directory

cmd/byohctl/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ SHELL := /usr/bin/env bash
1616
# hardcoding or independently recomputing anything.
1717
# Override for one-off local testing: `make build VERSION=v9.9.9-test`.
1818
REPO_ROOT := $(shell git rev-parse --show-toplevel)
19-
VERSION ?= $(shell $(MAKE) -C $(REPO_ROOT) tag)
19+
VERSION ?= $(shell $(MAKE) --no-print-directory -C $(REPO_ROOT) tag)
2020

2121
# Build settings
2222
BINARY_NAME := byohctl

0 commit comments

Comments
 (0)