Skip to content

Make personal-dev-env creation endure repo changes#6183

Merged
openshift-merge-bot[bot] merged 1 commit into
Azure:mainfrom
tmstff:make_pers-dev-env_creation_endure_repo_changes
Jul 23, 2026
Merged

Make personal-dev-env creation endure repo changes#6183
openshift-merge-bot[bot] merged 1 commit into
Azure:mainfrom
tmstff:make_pers-dev-env_creation_endure_repo_changes

Conversation

@tmstff

@tmstff tmstff commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

https://redhat.atlassian.net/browse/ARO-28516

What

fix for the following bug:

if you change files in ARO-HCP and commit them while make personal-dev-env is running, the latter fails (because certain image hashs can not be found). This is fixed by freezing revisions during the build.

Why

To save time by having fewer re-runs when continuing development while creating a presonal-dev-env.

Testing

make personal-dev-env with concurrent changes ✅

Special notes for your reviewer

GNU Make variable assignment semantics

Two assignment operators behave differently:

?= (conditional recursive) — like =. The RHS is stored as a recipe, not a value. Make re-evaluates it every time
the variable is expanded. $(shell ...) re-runs each expansion.

:= (simply-expanded) — RHS is evaluated once, at parse time, when make first reads the Makefile line. Result is
stored as a plain string. No re-evaluation ever.


What went wrong

FLEET_IMAGE_TAG ?= $(shell ... generate-tag.sh) # stores the recipe, not the value

-> if changes occur during build time, variables like FLEET_IMAGE_TAG become inconsistent
-> made sure consistent tagging is used for images.

PR Checklist

  • PR is scoped to a single task (no mixed concerns)
  • Title follows Conventional Commits format
  • Summary explains the "Why" behind the change
  • Linked to relevant ticket/issue
  • Screenshots included (if graph/UI/metrics changes)
  • Self-reviewed the diff
  • CI/CD checks are passing (ignore Tide)
  • Draft PR used for WIP (if applicable)
  • Commit history is clean (rebased/squashed)
  • Tricky code blocks are commented
  • Specific reviewers tagged
  • All comment threads resolved before merge

If E2E tests are included:

  • E2E tests follow Principles of Good E2E Test Case Design
  • If new E2E use case is covered (via a new test or new check/verifier),
    demonstrate that the test is able to detect a defect/error and fail with
    proper error message and logs which communicates nature of the problem.

@openshift-ci

openshift-ci Bot commented Jul 21, 2026

Copy link
Copy Markdown

Hi @tmstff. Thanks for your PR.

I'm waiting for a Azure member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@tmstff tmstff changed the title freeze revisions during build Make personal-dev-env creation endure repo changes Jul 21, 2026
@tmstff-azure

Copy link
Copy Markdown

/ok-to-test

@tmstff
tmstff marked this pull request as ready for review July 22, 2026 08:33
Copilot AI review requested due to automatic review settings July 22, 2026 08:33
@openshift-ci
openshift-ci Bot requested review from geoberle and janboll July 22, 2026 08:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make make personal-dev-env resilient to concurrent repo commits/changes by freezing the image tag/revision inputs used across the multi-service build/push workflow, so all services consistently reference the same tag during a single run.

Changes:

  • Compute a single IMAGE_TAG at the repo root (for DEPLOY_ENV=pers|swft) and propagate it into sub-make invocations.
  • Update multiple service Makefiles to use simply-expanded (:=) image tag variables and prefer the shared IMAGE_TAG when provided.
  • Apply the same tag-freezing behavior to the tooling/aro-hcp-exporter image build.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
Makefile Introduces a root-level IMAGE_TAG and passes it into service build/push and override-recording targets.
backend/Makefile Freezes image tag evaluation and prefers shared IMAGE_TAG to keep backend image tagging consistent.
frontend/Makefile Same as backend: uses shared IMAGE_TAG / freezes tag evaluation for frontend image builds.
admin/Makefile Same pattern applied to admin image tagging to ensure consistency during a run.
sessiongate/Makefile Same pattern applied to sessiongate image tagging to ensure consistency during a run.
mgmt-agent/Makefile Same pattern applied to mgmt-agent image tagging to ensure consistency during a run.
kube-applier/Makefile Same pattern applied to kube-applier image tagging to ensure consistency during a run.
fleet/Makefile Same pattern applied to fleet image tagging to ensure consistency during a run.
tooling/aro-hcp-exporter/Makefile Freezes exporter image tag evaluation and prefers shared IMAGE_TAG when present.

Comment thread Makefile Outdated
Comment thread backend/Makefile Outdated
Comment thread frontend/Makefile Outdated
Comment thread fleet/Makefile Outdated
Comment thread kube-applier/Makefile Outdated
Comment thread mgmt-agent/Makefile Outdated
Comment thread sessiongate/Makefile Outdated
Comment thread admin/Makefile Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 11:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread Makefile Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 22, 2026 12:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Comments suppressed due to low confidence (1)

Makefile:482

  • IMAGE_TAG and ARO_HCP_REVISION are frozen via two separate $(shell ...) calls. If a new commit lands between those calls, the pushed image tag can still end up referring to a different commit than the revision embedded into binaries/images (the original failure mode this PR is addressing).
	$(eval IMAGE_TAG := $(shell DETECT_DIRTY_GIT_WORKTREE=${DETECT_DIRTY_GIT_WORKTREE} DEPLOY_ENV=${DEPLOY_ENV} ./generate-tag.sh))
	$(eval ARO_HCP_REVISION := $(shell git rev-parse HEAD))
	$(eval export IMAGE_TAG ARO_HCP_REVISION)

Comment thread tooling/aro-hcp-exporter/Makefile
Comment thread backend/Makefile Outdated
Comment thread frontend/Makefile Outdated
Comment thread fleet/Makefile Outdated
Comment thread kube-applier/Makefile Outdated
Comment thread admin/Makefile Outdated
Comment thread mgmt-agent/Makefile Outdated
Comment thread sessiongate/Makefile Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

Makefile:482

  • personal-dev-env freezes IMAGE_TAG and ARO_HCP_REVISION, but they’re computed via two separate git reads (one inside generate-tag.sh, one via git rev-parse HEAD). If a commit happens between those two evaluations, the image tag can refer to a different revision than the embedded CommitSHA/build-arg revision, which undermines the “freeze revisions” goal.

Consider computing both values from the same revision source (e.g., capture ARO_HCP_REVISION once, then have generate-tag.sh accept a revision input / env var so it can derive the tag from that fixed SHA).

	$(eval IMAGE_TAG := $(shell DETECT_DIRTY_GIT_WORKTREE=${DETECT_DIRTY_GIT_WORKTREE} DEPLOY_ENV=${DEPLOY_ENV} ./generate-tag.sh))
	$(eval ARO_HCP_REVISION := $(shell git rev-parse HEAD))
	$(eval export IMAGE_TAG ARO_HCP_REVISION)

Copilot AI review requested due to automatic review settings July 22, 2026 13:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

Makefile:482

  • In personal-dev-env the recipe unconditionally assigns IMAGE_TAG and ARO_HCP_REVISION via $(eval ...), which overrides values provided via the environment (e.g., export IMAGE_TAG=...). This makes it hard to intentionally pin/reuse a tag or revision when running make personal-dev-env and is inconsistent with the per-service Makefiles which explicitly honor these overrides.
	$(eval IMAGE_TAG := $(shell DETECT_DIRTY_GIT_WORKTREE=${DETECT_DIRTY_GIT_WORKTREE} DEPLOY_ENV=${DEPLOY_ENV} ./generate-tag.sh))
	$(eval ARO_HCP_REVISION := $(shell git rev-parse HEAD))
	$(eval export IMAGE_TAG ARO_HCP_REVISION)

@tmstff
tmstff force-pushed the make_pers-dev-env_creation_endure_repo_changes branch from 0f911cb to 9989e9b Compare July 22, 2026 13:40
Without this fix, each sub-make phase (build, record, deploy) called
generate-tag.sh independently. If a commit happened between phases, the
recorded image digest would reference a tag that was never pushed,
breaking the deployment.

Fix: compute IMAGE_TAG and ARO_HCP_REVISION once at the start of the
personal-dev-env recipe via $(eval), then export both so all child
make processes inherit them as environment variables. Service Makefiles
use ?= with a $(or $(IMAGE_TAG),...) fallback so they read the exported
value when set and compute locally when invoked standalone.

ARO_HCP_COMMIT_TIME and *_IMAGE_TAG in service Makefiles are also
changed from := (parse-time) to ?= (lazy) so that git show and
generate-tag.sh only run when actually needed for image builds, not
on every make invocation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 13:48
@tmstff
tmstff force-pushed the make_pers-dev-env_creation_endure_repo_changes branch from 9989e9b to 588e665 Compare July 22, 2026 13:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

Makefile:482

  • personal-dev-env freezes IMAGE_TAG and ARO_HCP_REVISION via two separate git reads (./generate-tag.sh uses HEAD, then git rev-parse HEAD). If a commit happens between these two lines (the scenario this PR is addressing), the pushed image tag can refer to a different commit than what gets embedded via -X ...CommitSHA=${ARO_HCP_REVISION} and passed as Docker build-arg. To fully “freeze revisions during the build”, derive both values from the same captured revision (e.g., capture ARO_HCP_REVISION once and pass it into generate-tag.sh, or teach generate-tag.sh to accept an override revision and use that).
	$(eval IMAGE_TAG := $(shell DETECT_DIRTY_GIT_WORKTREE=${DETECT_DIRTY_GIT_WORKTREE} DEPLOY_ENV=${DEPLOY_ENV} ./generate-tag.sh))
	$(eval ARO_HCP_REVISION := $(shell git rev-parse HEAD))
	$(eval export IMAGE_TAG ARO_HCP_REVISION)

@mbarnes

mbarnes commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Didn't test but looks sane to me.

/lgtm

@tony-schndr

Copy link
Copy Markdown
Collaborator

Thanks for addressing this, alternatively you could try copy the repo into a temp directory. That would solve this problem and other scenarios ie editing code while a deployment is running. Probably a bit heavy weight though.

@tmstff

tmstff commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for addressing this, alternatively you could try copy the repo into a temp directory. That would solve this problem and other scenarios ie editing code while a deployment is running. Probably a bit heavy weight though.

Right, can also be a possibility for some cases. But especially if you change something where you need to modify the code and see if it runs when using "make personal-dev-env" it can become unhandy quite easily. With this lightweight fix you don't have to worry about this :-)

Another point is: you have to know about this behavior. Took me a while to figure out why make personal-dev-env was failing often. You just have to do a commit in the background and it may fail. Might save some other newbies some time :-)

@janboll

janboll commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

/approve

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: janboll, mbarnes, tmstff

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit 6d83a34 into Azure:main Jul 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants