Skip to content

fix: for kustomize.buildOptions.<version> per-version build options are never applied #27673#27723

Open
Knickkennedy wants to merge 6 commits intoargoproj:masterfrom
Knickkennedy:master
Open

fix: for kustomize.buildOptions.<version> per-version build options are never applied #27673#27723
Knickkennedy wants to merge 6 commits intoargoproj:masterfrom
Knickkennedy:master

Conversation

@Knickkennedy
Copy link
Copy Markdown
Contributor

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Title of the PR
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

I ran the unit tests with the updated unit tests as followed:

go test ./util/settings/... -run "Test_GetKustomize" -v 2>&1 === RUN Test_GetKustomizeBinaryPath === RUN Test_GetKustomizeBinaryPath/VersionDoesNotExist === RUN Test_GetKustomizeBinaryPath/DefaultBuildOptions === RUN Test_GetKustomizeBinaryPath/VersionExists === RUN Test_GetKustomizeBinaryPath/VersionExistsWithBuildOption === RUN Test_GetKustomizeBinaryPath/ExplicitVersionSet time="2026-05-06T13:46:21-04:00" level=warning msg="kustomizeOptions.binaryPath is deprecated, use KustomizeOptions.versions instead" --- PASS: Test_GetKustomizeBinaryPath (0.00s) --- PASS: Test_GetKustomizeBinaryPath/VersionDoesNotExist (0.00s) --- PASS: Test_GetKustomizeBinaryPath/DefaultBuildOptions (0.00s) --- PASS: Test_GetKustomizeBinaryPath/VersionExists (0.00s) --- PASS: Test_GetKustomizeBinaryPath/VersionExistsWithBuildOption (0.00s) --- PASS: Test_GetKustomizeBinaryPath/ExplicitVersionSet (0.00s) === RUN Test_GetKustomizeBuildOptions === RUN Test_GetKustomizeBuildOptions/NilOptions === RUN Test_GetKustomizeBuildOptions/NoVersionRequested === RUN Test_GetKustomizeBuildOptions/VersionWithBuildOptions === RUN Test_GetKustomizeBuildOptions/VersionWithoutBuildOptions === RUN Test_GetKustomizeBuildOptions/UnknownVersion --- PASS: Test_GetKustomizeBuildOptions (0.00s) --- PASS: Test_GetKustomizeBuildOptions/NilOptions (0.00s) --- PASS: Test_GetKustomizeBuildOptions/NoVersionRequested (0.00s) --- PASS: Test_GetKustomizeBuildOptions/VersionWithBuildOptions (0.00s) --- PASS: Test_GetKustomizeBuildOptions/VersionWithoutBuildOptions (0.00s) --- PASS: Test_GetKustomizeBuildOptions/UnknownVersion (0.00s) PASS ok github.com/argoproj/argo-cd/v3/util/settings (cached)

I believe this is all that is needed because we just needed to confirm that GetKustomizeBuildOptions correctly resolves the right build options string for a given version, this logic previously didn't exist at a code level. This is a fairly small, mechanically straightforward change. I'm happy to add more information or confirmation that these changes are correct/wrong depending on what the team desires.

fixes #27673 / fixes 27673

Root cause: minWidth: fit-content expands container with content.
Fix: Remove fit-content, add overflowWrap: break-word.

Signed-off-by: Knicholas Kennedy <knicholas.kennedy@gmail.com>
…as previously missing. I mirrored GetKustomizeBinaryPath for inspiration. I fixed two call sites where k.Build() was always receiving q.KustomizeOptions but now we check GetKustomizeBuildOptions first to ensure that we're picking up build options. We swap before passing it to Build() to avoid mutating shared options. I added unit tests based on the other unit tests I've seen ArgoCD do.

Signed-off-by: Knicholas Kennedy <knicholas.kennedy@gmail.com>
@Knickkennedy Knickkennedy requested a review from a team as a code owner May 6, 2026 18:04
@bunnyshell
Copy link
Copy Markdown

bunnyshell Bot commented May 6, 2026

🔴 Preview Environment stopped on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔵 /bns:start to start the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 63.63636% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.81%. Comparing base (e75b8e0) to head (eb6e778).

Files with missing lines Patch % Lines
reposerver/repository/repository.go 42.85% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #27723   +/-   ##
=======================================
  Coverage   63.81%   63.81%           
=======================================
  Files         419      419           
  Lines       57221    57241   +20     
=======================================
+ Hits        36513    36526   +13     
- Misses      17292    17297    +5     
- Partials     3416     3418    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a reposerver bug where kustomize.buildOptions.<version> (per-version Kustomize build options from argocd-cm) are parsed into settings but never applied to the actual kustomize build invocation when an Application selects a named Kustomize version.

Changes:

  • Added settings.GetKustomizeBuildOptions(...) to resolve effective build options for a given ApplicationSource + KustomizeOptions.
  • Added unit tests for build-options resolution in util/settings.
  • Updated reposerver Kustomize manifest generation (and app-details population) to apply the effective per-version build options without mutating shared KustomizeOptions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
util/settings/settings.go Adds helper to resolve effective (per-version vs global) Kustomize build options.
util/settings/settings_test.go Adds unit tests covering per-version and fallback build-options resolution.
reposerver/repository/repository.go Applies resolved per-version build options to Kustomize builds in manifest generation and app-details paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1716 to +1723
kustomizeOpts := q.KustomizeOptions
if kustomizeOpts != nil {
if effectiveBuildOptions := settings.GetKustomizeBuildOptions(kustomizeOpts, *q.ApplicationSource); effectiveBuildOptions != kustomizeOpts.BuildOptions {
optsCopy := *kustomizeOpts
optsCopy.BuildOptions = effectiveBuildOptions
kustomizeOpts = &optsCopy
}
}
Comment on lines +2593 to +2601
kustomizeOpts := q.KustomizeOptions
if kustomizeOpts != nil {
if effectiveBuildOptions := settings.GetKustomizeBuildOptions(kustomizeOpts, *q.Source); effectiveBuildOptions != kustomizeOpts.BuildOptions {
optsCopy := *kustomizeOpts
optsCopy.BuildOptions = effectiveBuildOptions
kustomizeOpts = &optsCopy
}
}
_, images, _, err := k.Build(q.Source.Kustomize, kustomizeOpts, env, nil)
Copy link
Copy Markdown
Member

@ranakan19 ranakan19 left a comment

Choose a reason for hiding this comment

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

Could you provide Repo-server log output as mentioned in the linked issue after this change?
It would be nice to have a test case in reposerver/repository/repository_test.go for this, is it possible to add that?
probably add a test case similar to https://github.com/argoproj/argo-cd/blob/master/reposerver/repository/repository_test.go#L281 with buildOption?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kustomize.buildOptions.<version> per-version build options are never applied

3 participants