Skip to content

capi: generate validate target help from build names - #2149

Open
yindia wants to merge 3 commits into
kubernetes-sigs:mainfrom
yindia:fix-validate-target-drift-908
Open

capi: generate validate target help from build names#2149
yindia wants to merge 3 commits into
kubernetes-sigs:mainfrom
yindia:fix-validate-target-drift-908

Conversation

@yindia

@yindia yindia commented Aug 22, 2026

Copy link
Copy Markdown

Change description

The ##@ Validate packer config section of images/capi/Makefile hand-listed a validate-<image>: ## ... stub for every per-image validate target. These stubs were maintained separately from the *_BUILD_NAMES / *_VALIDATE_TARGETS lists they document, so they drifted: new images added to the build lists never got a help entry, and removed ones left stale stubs behind.

This change removes the hand-maintained per-image stubs and derives the help listing from the same variables that generate the real targets:

  • Adds ALL_VALIDATE_TARGETS, a sorted union of every *_VALIDATE_TARGETS list.

  • make help now prints a generated "Validate packer config (per-image)" section from ALL_VALIDATE_TARGETS, so the listing can no longer drift from the build targets it is derived from.

  • Keeps the -all aggregate targets as-is.

  • Is this change including a new Provider or a new OS? (y/n) n

  • If yes, has the Provider/OS matrix been updated in the readme? (y/n) n/a

  • If adding a new provider, are you a representative of that provider? (y/n) n/a

  • Removes 16 no-op validate-node-ova-local-vmx-* / -base-* targets that
    previously existed only as make help stubs and exited 0 as no-ops. They
    are not derived from any *_BUILD_NAMES list and nothing in CI or scripts
    references them.

Related issues

Additional context

Verified with:

cd images/capi && make help

The generated section lists every per-image validate-* target sourced from the build-name lists.

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign averagemarcus for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 22, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @yindia!

It looks like this is your first PR to kubernetes-sigs/image-builder 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/image-builder has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow kubernetes-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 22, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @yindia. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 22, 2026
@yindia

yindia commented Aug 31, 2026

Copy link
Copy Markdown
Author

cc: @jepio @drew-viles @AndiDog

@mboersma

Copy link
Copy Markdown
Contributor

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 31, 2026

@mboersma mboersma 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.

Could you also update custom-build-targets.md to match this change? It still tells contributors to add manual validate help stubs, including one in the example. Please explain that per-image validate help is generated automatically and note that new provider families must be added to ALL_VALIDATE_TARGETS.

Update custom-build-targets.md to match the generated per-image validate
help. Per-image validate stubs are no longer hand-maintained; only new
provider families need adding to ALL_VALIDATE_TARGETS.
@yindia
yindia requested a review from mboersma August 31, 2026 15:40
@yindia

yindia commented Aug 31, 2026

Copy link
Copy Markdown
Author

/test pull-ova-all
/test pull-azure-sigs

@yindia

yindia commented Sep 1, 2026

Copy link
Copy Markdown
Author

@mboersma ready for review

@drew-viles drew-viles 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.

Thanks, the docs update covers what @mboersma asked for and I confirmed make help now lists every per-image validate target. Two small things inline, plus one note: removing the stubs also removes the 16 validate-node-ova-local-vmx-* / -base-* targets, which previously exited 0 as no-ops. That is probably the right outcome, but could we mention it in the PR description?

Comment thread images/capi/Makefile Outdated

# All generated per-image validate targets, used by `make help` so the listing
# never drifts from the build targets it is derived from.
ALL_VALIDATE_TARGETS := $(sort \

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.

Could we derive this from .VARIABLES instead of hand-listing the families? Something like $(sort $(foreach v,$(filter %VALIDATE_TARGETS,$(.VARIABLES)),$($(v)))) produces the same 156 targets and removes the last place this can drift.

Comment thread images/capi/Makefile
@echo ' cleaning artifacts created from building OVAs using a local'
@echo ' hypervisor.'
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-35s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
@printf "\n\033[1mValidate packer config (per-image, generated)\033[0m\n"

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.

Nit: the generated lines sit one column left of the awk-rendered ones. %-36s or a second space before %s lines them up.

- Derive ALL_VALIDATE_TARGETS from *VALIDATE*_TARGETS vars via .VARIABLES
  so new provider families need no manual entry (removes last drift point).
- Pad generated validate help to %-36s to align with awk-rendered targets.

Addresses review feedback on kubernetes-sigs#2149.
@yindia
yindia requested a review from drew-viles September 4, 2026 12:56
@yindia

yindia commented Sep 4, 2026

Copy link
Copy Markdown
Author

Thanks for the reviews @drew-viles @mboersma. Addressed all feedback, PTAL when you get a chance 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow-up concerning validate targets

3 participants