Skip to content

Commit 09f3961

Browse files
indradhanushclaude
andauthored
test: integrate controller-manager image publishing + e2e GINKGO_NODES parallelism (#19)
* feat(byohctl): resolve agent bundle URL from byohctl's own version The hardcoded ByohAgentDebPackageURL constant required a manual hand-edit every time the agent bundle changed. Replace it with a ByohAgentBundleURL() function that composes the OCI repo path with byohctl's own baked-in version.GetVersion(), so byohctl and its expected agent bundle are always tied to the same git-describe version with zero manual edits. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * build(ci): compute agent deb bundle version from git describe Version now comes from `git describe --dirty --tags --match='v*'` (overridable via `BYOH_DEB_VERSION` env var) instead of an externally- supplied `BUILD_NUMBER`. This ensures the published bundle tag matches what byohctl bakes in at build time with no manual coordination. Also, update the publish target to match the new quay.io/platform9/cluster-api-provider-bringyourownhost/agent path that byohctl now expects. This ensures the CI pipeline pushes to the same OCI registry location that the agent installer references. * ci: publish agent deb bundle on every push to main Closes the loop: every push to main that passes CI now automatically builds and publishes the agent deb bundle tagged with that commit's git-describe version. This replaces the previous manual rebuild-and- hand-edit-a-constant process. Triggers via `workflow_run` off the existing CI workflow's success (avoiding a duplicate test run) plus a manual `workflow_dispatch` for dry runs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * build: add make tag as the single source of truth for agent versioning Add a new `tag` target that prints GIT_VERSION, derived from git-describe-based versioning. This becomes the one place every agent-side artifact (byohctl binary, agent bundle) gets its version from, instead of each consumer independently recomputing the same git-describe expression. The tag target is distinct from the existing TAG variable, which is the separate controller-manager image tag (still static "dev" by default). Unifying controller-manager versioning is follow-up work. Matches kaapi's philosophy in ~/pf9/kaapi/Makefile. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * build(byohctl,ci): derive version from the shared make tag target Previously, cmd/byohctl/Makefile, .ci/build-push-agent-deb.sh, and .github/workflows/build-push-agent-bundle.yml each computed their own copy of the git-describe expression independently: git describe --dirty --tags --match='v*' 2>/dev/null || echo "v0.0.0-..." Now all three defer to the root Makefile's `make tag` target instead. This ensures exactly one place owns the version computation and every agent-side artifact gets the same version without duplication or drift. byohctl's VERSION override escape hatch (`make build VERSION=...`) still works since make tag is only consulted via ?=. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * build: use 8-char abbreviated commit sha in git describe The git describe call backing make tag now passes --abbrev=8 to standardize on 8-character short SHAs instead of git's default 7 characters. The fallback git rev-parse --short=8 is updated to match, ensuring both code paths produce the same short SHA length. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * ci: simplify Print tag step to just make tag The Print tag step previously computed the tag into a shell variable and exported it to $GITHUB_ENV for the build step to reuse. This is now redundant since .ci/build-push-agent-deb.sh already calls make tag itself as its own fallback, so the step now simply runs make tag and prints the value directly without the extra plumbing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * feat(ci): publish controller-manager image on every push to main This extends the same git-describe-based versioning philosophy already applied to the agent bundle to the controller-manager Docker image. .ci/build-push-controller.sh now computes IMAGE_TAG from make tag instead of a manually-set \$BYOHCM_VERSION.\$BUILD_NUMBER, and publishes to quay.io/platform9/cluster-api-provider-bringyourownhost/controller-manager (nested under the same path as the agent bundle, just a different image name) instead of the separately-named quay.io/platform9/byoh-controller-manager. The configure_docker_registry function's registry-match guard was updated to match the new default registry path; it gates whether docker login runs and would have silently skipped login otherwise. The new workflow mirrors the agent bundle workflow's trigger design (workflow_run off CI success on main, plus workflow_dispatch for manual dry runs) but requires a real Set up Go step (unlike the agent bundle workflow) since the script's go mod vendor call runs on the host. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * ci: skip draft PRs, re-run on ready-for-review, publish on PR push ci.yml: Add draft filter to jobs and extend trigger types. - Added `if: ${{ !github.event.pull_request.draft }}` to both workflow jobs to skip execution on draft PRs. - Added `ready_for_review` to trigger types list (default types are opened/synchronize/reopened, which don't include the draft-to-ready transition). This re-runs CI when a draft PR is marked ready without requiring a new push. build-push-agent-bundle.yml and build-push-controller-manager.yml: Add pull_request trigger for PR builds and publishes. - Previously these workflows only ran via workflow_run (on CI success on main) or workflow_dispatch. Now they also trigger on non-draft PR push (same draft-skip via `if: ${{ !github.event.pull_request.draft }}` and same ready_for_review addition). - This enables building and pushing real tagged artifacts on every non-draft PR push, per explicit request. (Fork PRs will fail at quay login due to GitHub Actions not exposing repo secrets to fork-sourced pull_request events — a known, accepted limitation.) Checkout ref fix for pull_request events: - The checkout `ref` now falls back to `github.event.pull_request.head.sha` before `github.sha`. For pull_request events, `github.sha` points at a synthetic merge commit, not the actual PR branch's head. Using the synthetic commit would cause `git describe` (and thus `make tag`) to compute a different version than the same commit checked out any other way, leading to inconsistent versioning. The explicit PR head SHA ensures consistent version computation across all checkout contexts. * fix(ci): pass --no-print-directory to make -C tag invocations GNU Make automatically enables --print-directory whenever -C is used, printing 'make: Entering directory' and 'Leaving directory' messages. This repo's dev Mac ships an ancient GNU Make 3.81 that does not do this, but the GitHub Actions Ubuntu runner's newer Make (4.x) does. In .ci/build-push-controller.sh, IMAGE_TAG=$(make -C "${project_root}" tag) captured that chatter into IMAGE_TAG via command substitution, corrupting the docker build -t argument and failing the controller-manager publish workflow. The same latent bug existed in cmd/byohctl/Makefile's VERSION assignment, just not yet triggered since byohctl had only been built locally with the old Make. Fixed both by passing --no-print-directory to make -C. Also added a fail-loud whitespace guard on IMAGE_TAG in the controller script so this class of bug cannot silently corrupt a docker tag again. Verified: reproduced the failure locally with GNU Make 4.4.1, confirmed --no-print-directory fixes it, and re-verified go build, go test, and shell linting all pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * ci(e2e): parallelize e2e workflow into a 7-way GINKGO_FOCUS matrix The e2e workflow previously ran all 7 Ginkgo specs sequentially in a single job, taking ~59 minutes with resource contention (shared kind cluster/docker daemon) causing 600s control-plane timeouts on 4/7 specs. Each spec is independently scoped (creates/tears down its own namespace, hosts, cluster) with no technical coupling. This branch only exercised 2 of 7 specs; the catch-all step that ran everything had been removed. Restructure the workflow to give each spec a unique Ginkgo focus label and run them as separate parallel jobs via GINKGO_FOCUS matrix (fail-fast: false). Each spec now runs in isolation without resource contention, significantly reducing total wall-clock time and preventing timeouts. Go changes add unique focus labels to specs that had none or shared a non-exclusive tag, plus a Platform9 copyright header addition (no logic changes). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * ci(e2e): set explicit job name to clean up matrix display in Actions UI When a job uses a matrix strategy without an explicit name, GitHub Actions auto-appends every matrix key to the job's display name, creating noise with escaped regex characters. Setting name: e2e (${{ matrix.name }}) provides a cleaner, consistent UI by showing just the GINKGO_FOCUS variant name. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * ci(e2e): switch e2e workflow to single job with GINKGO_NODES parallelism Prior commit (633390b) split the e2e workflow into 7 GitHub Actions jobs, one per Ginkgo spec, which fixed coverage but redundantly repeated setup (docker builds, kind cluster, CAPI provider install, host-agent compile) across each job. This switch consolidates to a single job with Ginkgo's built-in GINKGO_NODES=4 process parallelism, leveraging the existing SynchronizedBeforeSuite/SynchronizedAfterSuite scaffolding already in test/e2e/e2e_suite_test.go (designed exactly for this) to share resources once. This eliminates per-job redundant setup entirely and drops the dead "Install ginkgo" step from the workflow. Workflow also bumps actions/setup-go to v7 with go-version 1.26.2 (matching go.mod directive) and enables action cache. Making specs run concurrently in one process required fixing verified concurrency bugs: hardcoded Docker container names ("byohost1"/"byohost2") and /tmp log file paths (including collisions among the templated versions) duplicated across multiple spec files, a shared /tmp kubeconfig-staging path used during container setup made race-prone by concurrent access (now unique per call), and two /tmp debug-script paths made per-process-unique via PID suffix on test failure. Trade-off accepted: resource contention moves from sequential (original 59-minute single-process run with 4/7 specs timing out) to concurrent (all specs at once on one runner, one shared docker daemon and kind API server). This is a different, unproven failure mode that requires validation with a real run. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix(e2e): point default controller-manager image at new quay.io registry A separate sibling workflow (build-push-controller-manager.yml) now publishes the controller-manager image to quay.io/platform9/cluster-api-provider-bringyourownhost/controller-manager instead of the old gcr.io/k8s-staging-cluster-api/cluster-api-byoh-controller. Before this commit, the e2e test config (test/e2e/config/provider.yaml) still hardcoded the old gcr.io reference with loadBehavior: mustLoad, which would prevent the locally-built image (via `make docker-build` using the Makefile's STAGING_REGISTRY/IMAGE_NAME defaults) from matching what e2e's bootstrap cluster setup expects to load, and the rendered manager Deployment manifest would reference the old name. This commit updates Makefile's STAGING_REGISTRY and IMAGE_NAME defaults, the kustomize image transformer's newName in config/manager/kustomization.yaml, and both references in test/e2e/config/provider.yaml (the mustLoad image entry and the tag-rewrite replacements rule) so they all consistently point at the new quay.io path. Intent: the image built by `make docker-build` with no overrides should be usable directly by e2e tests, with no separate image reference juggling needed. config/manager/manager.yaml's base image field was deliberately left unchanged because the kustomize image transformer always overrides it at build/deploy time regardless, verified not to affect `make deploy`/`make install`/`make publish-infra-yaml`. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent d7df41b commit 09f3961

23 files changed

Lines changed: 294 additions & 103 deletions

.ci/build-push-agent-deb.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
set -ex
2-
export BUILD_NUMBER
3-
export MAJOR_MINOR_VERSION=0.1
4-
export BYOH_DEB_VERSION=${MAJOR_MINOR_VERSION}.${BUILD_NUMBER}
2+
export BYOH_DEB_VERSION=${BYOH_DEB_VERSION:-$(make tag)}
53

64
echo 'alias shasum="sha512sum"' >> ~/.bashrc
75
source ~/.bashrc
@@ -21,6 +19,6 @@ curl -LO https://github.com/carvel-dev/imgpkg/releases/download/v0.43.1/imgpkg-l
2119
mv imgpkg-linux-amd64 imgpkg
2220
chmod +x imgpkg
2321

24-
echo "pushing deb bundle to quay.io/platform9/byoh-deb:$BYOH_DEB_VERSION"
25-
./imgpkg push -f build/pf9-byohost/debsrc/ -i quay.io/platform9/byoh-agent-deb:$BYOH_DEB_VERSION
22+
echo "pushing deb bundle to quay.io/platform9/cluster-api-provider-bringyourownhost/agent:$BYOH_DEB_VERSION"
23+
./imgpkg push -f build/pf9-byohost/debsrc/ -i quay.io/platform9/cluster-api-provider-bringyourownhost/agent:$BYOH_DEB_VERSION
2624

.ci/build-push-controller.sh

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
# build-and-push.sh - CI script for building and publishing the byoh controller manager Docker image.
44
#
55
# Parameters:
6-
# - IMAGE_REGISTRY Registry to publish the Docker image. By default 'quay.io/platform9/byoh-controller-manager' is used.
7-
# - IMAGE_NAME Name to use for this image. By default 'byoh-controller-manager' is used.
8-
# - IMAGE_TAG Tag to use for the image. By default '$BYOHCM_VERSION-$BUILD_NUMBER' is used.
9-
# - IMAGE_REGISTRY URL (without scheme) pointing to quay
6+
# - IMAGE_REGISTRY Registry to publish the Docker image. By default 'quay.io/platform9/cluster-api-provider-bringyourownhost' is used.
7+
# - IMAGE_NAME Name to use for this image. By default 'controller-manager' is used.
8+
# - IMAGE_TAG Tag to use for the image. By default the output of `make tag` (git describe) is used.
109
# - DRY_RUN If non-empty, no Docker image will be published.
1110
# - CONTAINER_TAG Location of the container_tag file (used as an artifact in TeamCity)
1211
# - DOCKER_USERNAME Username to login to quay.io.
1312
# - DOCKER_PASSWORD Password to login to quay.io.
1413
#
1514
# Examples:
16-
# - `USE_SYSTEM_GO=1 IMAGE_REGISTRY=quay.io IMAGE_NAME=platform9/byoh-controller-manager IMAGE_TAG=latest ./build-and-push.sh`: To test the script locally without gimme and push to Docker
15+
# - `USE_SYSTEM_GO=1 IMAGE_REGISTRY=quay.io IMAGE_NAME=platform9/cluster-api-provider-bringyourownhost/controller-manager IMAGE_TAG=latest ./build-and-push.sh`: To test the script locally without gimme and push to Docker
1716

1817
set -o nounset
1918
set -o errexit
@@ -25,15 +24,23 @@ CONTAINER_TAG=${CONTAINER_TAG:-${build_dir}/manager-container-tag}
2524
CONTAINER_FULL_TAG=${CONTAINER_FULL_TAG:-${build_dir}/manager-container-full-tag}
2625
GO_VERSION=${GO_VERSION:-1.22.5}
2726

28-
BUILD_NUMBER=${BUILD_NUMBER:-0}
29-
BYOHCM_VERSION=${BYOHCM_VERSION:-0.1}
30-
31-
IMAGE_REGISTRY=${IMAGE_REGISTRY:-"quay.io/platform9"}
32-
IMAGE_NAME=${IMAGE_NAME:-"byoh-controller-manager"}
33-
IMAGE_TAG=${IMAGE_TAG:-${BYOHCM_VERSION}.${BUILD_NUMBER}}
27+
IMAGE_REGISTRY=${IMAGE_REGISTRY:-"quay.io/platform9/cluster-api-provider-bringyourownhost"}
28+
IMAGE_NAME=${IMAGE_NAME:-"controller-manager"}
29+
IMAGE_TAG=${IMAGE_TAG:-$(make --no-print-directory -C "${project_root}" tag)}
3430
IMAGE_NAME_TAG=${IMAGE_NAME}:${IMAGE_TAG}
3531
IMAGE_REGISTRY_NAME_TAG=${IMAGE_REGISTRY}/${IMAGE_NAME_TAG}
3632

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+
3744

3845
main() {
3946
# Move to the project directory
@@ -95,7 +102,7 @@ on_exit() {
95102

96103
configure_docker_registry() {
97104
repository=$1
98-
if [ "${IMAGE_REGISTRY}" = "quay.io/platform9" ]; then
105+
if [ "${IMAGE_REGISTRY}" = "quay.io/platform9/cluster-api-provider-bringyourownhost" ]; then
99106
if [ -n "${DOCKER_PASSWORD:-}" ] ; then
100107
echo -n "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin "${IMAGE_REGISTRY}"
101108
else
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Publish Agent Bundle
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types: [completed]
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
build-and-push:
15+
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push') }}
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
with:
21+
ref: ${{ github.event.workflow_run.head_sha || github.event.pull_request.head.sha || github.sha }}
22+
fetch-depth: 0
23+
24+
- name: Install fpm build dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y --no-install-recommends ruby ruby-dev rubygems build-essential
28+
sudo gem install --no-document fpm
29+
30+
- name: Log in to Quay
31+
uses: docker/login-action@v3
32+
with:
33+
registry: quay.io
34+
username: ${{ secrets.QUAY_USERNAME }}
35+
password: ${{ secrets.QUAY_TOKEN }}
36+
37+
- name: Print tag
38+
run: make tag
39+
40+
- name: Build and push agent deb bundle
41+
run: bash .ci/build-push-agent-deb.sh
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build and Publish Controller Manager
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types: [completed]
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
build-and-push:
15+
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push') }}
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
with:
21+
ref: ${{ github.event.workflow_run.head_sha || github.event.pull_request.head.sha || github.sha }}
22+
fetch-depth: 0
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v4
26+
with:
27+
go-version: 1.24.5
28+
29+
- name: Log in to Quay
30+
uses: docker/login-action@v3
31+
with:
32+
registry: quay.io
33+
username: ${{ secrets.QUAY_USERNAME }}
34+
password: ${{ secrets.QUAY_TOKEN }}
35+
36+
- name: Print tag
37+
run: make tag
38+
39+
- name: Build and push controller manager image
40+
env:
41+
USE_SYSTEM_GO: "1"
42+
run: bash .ci/build-push-controller.sh

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- 'SECURITY_CONTACTS'
1313
pull_request:
1414
branches: [ main ]
15+
types: [opened, synchronize, reopened, ready_for_review]
1516
paths-ignore:
1617
- '*.md'
1718
- 'docs/**'
@@ -22,6 +23,7 @@ on:
2223

2324
jobs:
2425
build-agent:
26+
if: ${{ !github.event.pull_request.draft }}
2527
runs-on: ubuntu-22.04
2628
steps:
2729
- name: Checkout code
@@ -36,6 +38,7 @@ jobs:
3638
run: make host-agent-binaries
3739

3840
test:
41+
if: ${{ !github.event.pull_request.draft }}
3942
runs-on: ubuntu-22.04
4043
steps:
4144
- name: Check Docker Version

.github/workflows/e2e.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
workflow_dispatch: {}
1414

1515
jobs:
16-
e2e-pr-blocking:
16+
e2e:
1717
runs-on: ubuntu-22.04
1818
env:
1919
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -22,21 +22,16 @@ jobs:
2222
uses: actions/checkout@v3
2323

2424
- name: Set up Go
25-
uses: actions/setup-go@v4
25+
uses: actions/setup-go@v7
2626
with:
27-
go-version: 1.24.5
28-
29-
- name: Install ginkgo
30-
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.9.2
27+
go-version: 1.26.2
28+
cache: true
3129

3230
- name: turn off swap
3331
run: sudo swapoff -a
3432

3533
- name: Set netfilter conntrack max
3634
run: sudo sysctl -w net.netfilter.nf_conntrack_max=131072
3735

38-
- name: Run Cluster Class e2e tests
39-
run: yes | GINKGO_FOCUS="\[Cluster-Class\]" make test-e2e
40-
41-
- name: Run PR-Blocking e2e tests
42-
run: yes | GINKGO_FOCUS="\[PR-Blocking\]" make test-e2e
36+
- name: Run e2e tests
37+
run: yes | GINKGO_NODES=4 make test-e2e

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
SHELL:=/usr/bin/env bash
33

44
# Define registries
5-
STAGING_REGISTRY ?= gcr.io/k8s-staging-cluster-api
5+
STAGING_REGISTRY ?= quay.io/platform9/cluster-api-provider-bringyourownhost
66

7-
IMAGE_NAME ?= cluster-api-byoh-controller
7+
IMAGE_NAME ?= controller-manager
88
TAG ?= dev
99
RELEASE_DIR := _dist
1010

@@ -14,6 +14,18 @@ BYOH_BASE_IMG = byoh/node:e2e
1414
BYOH_BASE_IMG_DEV = byoh/node:dev
1515
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
1616

17+
# GIT_VERSION is the single, predictable version string for every
18+
# agent-side artifact built from a commit (agent bundle, byohctl) --
19+
# matches kaapi's git-tag-based versioning philosophy
20+
# (~/pf9/kaapi/Makefile). Distinct from TAG above, which is the
21+
# controller-manager image tag (still static "dev" by default); unifying
22+
# that is separate follow-up work.
23+
GIT_VERSION := $(shell git describe --abbrev=8 --dirty --tags --match='v*' 2>/dev/null || echo "v0.0.0-$(shell git rev-parse --short=8 HEAD)")
24+
25+
.PHONY: tag
26+
tag: ## Print the predictable git-derived version used for agent/byohctl artifacts
27+
@echo $(GIT_VERSION)
28+
1729
REPO_ROOT := $(shell pwd)
1830
GINKGO_FOCUS ?=
1931
GINKGO_SKIP ?=

cmd/byohctl/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
SHELL := /usr/bin/env bash
1111

1212
# Version information
13-
MAJOR ?= 1
14-
MINOR ?= 0
15-
BUILD_NUMBER ?= 1
16-
VERSION := $(MAJOR).$(MINOR).$(BUILD_NUMBER)
13+
# VERSION defaults to the root Makefile's `make tag` target -- the single
14+
# source of truth every agent-side artifact (byohctl, the agent bundle)
15+
# derives its version from, so they always agree without either side
16+
# hardcoding or independently recomputing anything.
17+
# Override for one-off local testing: `make build VERSION=v9.9.9-test`.
18+
REPO_ROOT := $(shell git rev-parse --show-toplevel)
19+
VERSION ?= $(shell $(MAKE) --no-print-directory -C $(REPO_ROOT) tag)
1720

1821
# Build settings
1922
BINARY_NAME := byohctl

cmd/byohctl/service/agent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,13 @@ var ensureRequiredPackages = func() error {
190190
}
191191

192192
var downloadDebianPackage = func(tempDir string) (string, error) {
193-
utils.LogInfo("Downloading BYOH agent Debian package from %s", ByohAgentDebPackageURL)
193+
utils.LogInfo("Downloading BYOH agent Debian package from %s", byohAgentBundleURL())
194194

195195
imgpkgPath, _ := exec.LookPath("imgpkg")
196196

197197
// Use a buffer to capture the command output
198198
var outputBuffer bytes.Buffer
199-
pullCmd := exec.Command(imgpkgPath, "pull", "-i", ByohAgentDebPackageURL, "-o", tempDir)
199+
pullCmd := exec.Command(imgpkgPath, "pull", "-i", byohAgentBundleURL(), "-o", tempDir)
200200
pullCmd.Stdout = &outputBuffer
201201
pullCmd.Stderr = &outputBuffer
202202

0 commit comments

Comments
 (0)