Commit Graph

2702 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] f7a81518ed Merge remote-tracking branch 'origin/main' into fix-include-needs-transitive-1003
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
2026-03-27 08:23:26 +00:00
copilot-swe-agent[bot] 121fda4900 fix: address review comments - preserve tab delimiters in List and fix transitive needs cross-namespace resolution
1. exec.go List(): Filter empty lines without TrimSpace-ing non-empty
   lines, preserving trailing tab separators from helm list output.

2. state.go collectNeedsWithTransitives(): Resolve transitives by full
   ReleaseToID matching (via ID→ReleaseSpec map) instead of name-based
   matching, avoiding cross-namespace ambiguity when multiple releases
   share the same name.

Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/94b03eb4-31e5-4d04-9959-eeaafb695855

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
2026-03-27 00:14:14 +00:00
copilot-swe-agent[bot] cd216c6ee9 fix: remove nameToID normalization from GroupReleasesByDependency
After ApplyOverrides/reformat(), need IDs are already fully-qualified
(matching ReleaseToID format). The nameToID map was doing redundant
name-based lookups that could theoretically select the wrong dependency
when multiple releases share the same name across namespaces (same issue
fixed in collectDirectNeedsOnly in 02a5de3). Reverted to the original
behavior of passing need IDs as-is.

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/7b896c61-ba38-4471-942a-784e79fab298
2026-03-26 09:55:54 +00:00
Etienne Champetier 4bdb6f097c
fix: keep all chart dependencies key / values (#2501)
* feat: Refactor TestRewriteChartDependencies

Signed-off-by: Etienne Champetier <e.champetier@ateme.com>

* fix: keep all chart dependencies key / values

In rewriteChartDependencies we were only parsing name / repository / version,
thus dropping keys like condition / import-values.

This at least fixes the use of condition.

Signed-off-by: Etienne Champetier <e.champetier@ateme.com>

---------

Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
2026-03-26 13:16:54 +08:00
yxxhero 732e4ad913
fix: helmfile fetch fails for kustomization directories (#2504)
* fix: helmfile fetch fails for kustomization directories

Fixes #2503

When running `helmfile fetch` on a release that points to a local
kustomization directory (without Chart.yaml), the command failed with
"Chart.yaml is missing".

The issue was that the condition `helmfileCommand != "pull"` in
prepareChartForRelease skipped chartification for ALL cases during
fetch, including local kustomization directories that NEED chartify
to convert them to Helm charts.

Solution:
- Added `NeedsChartifyForLocalDir` field to the Chartify struct to
  track when chartification is needed because the local directory
  is not a Helm chart (no Chart.yaml)
- Modified the condition to skip chartification for "pull" ONLY when
  it's not a local directory without Chart.yaml

This preserves the original fix (commit 1f134d93) for remote charts
with transformers while fixing local kustomization directories.

Signed-off-by: yxxhero <aiopsclub@163.com>

* test: add integration test for helmfile fetch with kustomization

Add test case for issue #2503 to verify helmfile fetch works correctly
with local kustomization directories (without Chart.yaml).

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-26 09:44:28 +08:00
copilot-swe-agent[bot] 02a5de3330 fix: simplify collectDirectNeedsOnly to use need IDs as-is
After ApplyOverrides/reformat(), need IDs are already fully-qualified
(matching ReleaseToID format). The previous name-based lookup could
select the wrong dependency when multiple releases share the same name
across namespaces/kubecontexts.

Also adds a cross-namespace test case to verify correct behavior when
releases share names across different namespaces.

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/e8effb99-17de-4b2e-ae14-cc90c2108146
2026-03-25 10:32:33 +00:00
copilot-swe-agent[bot] a1bf95e9ba Changes before error encountered
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/340f3d6f-8a80-4fcf-90cf-16ae64191ebb
2026-03-25 01:32:12 +00:00
copilot-swe-agent[bot] 42205380c4 fix: remove trailing blank line in write-values.go to fix gci lint
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/20d6e351-1611-4bbe-8f08-d52326fff056
2026-03-25 00:45:50 +00:00
copilot-swe-agent[bot] afdb6ccdab fix: restore withNeeds DAG behavior and regenerate snapshots
- In withNeeds second withDAG call, set SkipNeeds when needs are already
  included (instead of using IncludeNeeds which causes DAG to pull in
  transitive deps). This is the key fix for --include-needs only including
  direct dependencies.
- In GroupReleasesByDependency, use WithDependencies from opts.IncludeNeeds
  only when SelectedReleases is explicitly provided (withDAG path).
  When using the Filtered flag path, needs are already handled by
  markExcludedReleases.
- Regenerate test snapshots to reflect correct behavior where
  --include-needs excludes transitive dependencies.
- Restore diff_test.go and diff_nokubectx_test.go from main for
  non-include-needs test cases.

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/170cecc0-7a3e-4326-98d3-4f2bffee1848
2026-03-25 00:33:45 +00:00
copilot-swe-agent[bot] ed823115f1 fix: restore SelectedReleases handling in GroupReleasesByDependency and revert snapshots
The root cause of the CI failure was that GroupReleasesByDependency was changed
to use !r.Filtered instead of opts.SelectedReleases for the DAG plan's Only field.
When no selectors are active (like helmfile destroy), all releases are unfiltered,
causing all releases to be planned for deletion - including uninstalled ones.

Fix: Use opts.SelectedReleases when provided, fall back to Filtered flag otherwise.
Also remove unnecessary SelectedReleases block from PlanReleases since
GroupReleasesByDependency now handles it directly.
Restore test snapshots from main as the behavior should now match.

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/170cecc0-7a3e-4326-98d3-4f2bffee1848
2026-03-25 00:12:22 +00:00
copilot-swe-agent[bot] 0cf7ab6908 test: add test case for both includeNeeds and includeTransitiveNeeds enabled
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/c0b910d1-387a-476e-beb9-ea38ab6c1061
2026-03-24 23:30:57 +00:00
copilot-swe-agent[bot] 4fada4f73c fix: address review feedback - remove WriteValuesImpl overrides, optimize debug log, add direct-only needs test
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/c0b910d1-387a-476e-beb9-ea38ab6c1061
2026-03-24 23:30:07 +00:00
copilot-swe-agent[bot] fd9c2179fc Merge branch 'main' into fix-include-needs-transitive-1003 2026-03-24 23:15:46 +00:00
copilot-swe-agent[bot] d00c3f1c87 fix: remove extra blank line in diff-args apply-live-stderr integration test output
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/d8f38e68-8ff2-4d2d-8441-79aa254db5b7
2026-03-24 23:00:33 +00:00
dependabot[bot] 2053fdd94e
build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.97.1 to 1.97.2 (#2500) 2026-03-25 06:07:15 +08:00
dependabot[bot] a9175ab927
build(deps): bump azure/setup-helm from 4.3.1 to 5.0.0 (#2499) 2026-03-25 06:06:45 +08:00
Jinyu c70b20ad7a
feat: add an arg that passing description to `helm upgrade` command (#2497)
* feat: add an arg that passing description to `helm upgrade` command

fix: github actions

Signed-off-by: swimablefish <swimablefish@gmail.com>

* fix: lint and test failed

Signed-off-by: swimablefish <swimablefish@gmail.com>

* feat: encapsulation

Signed-off-by: swimablefish <swimablefish@gmail.com>

* feat: add version gate

Signed-off-by: swimablefish <swimablefish@gmail.com>

* feat: rephrase

Signed-off-by: swimablefish <swimablefish@gmail.com>

---------

Signed-off-by: swimablefish <swimablefish@gmail.com>
2026-03-24 21:01:44 +08:00
yxxhero e72315a876
build: update helm-diff to v3.15.3 (#2498)
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-24 17:28:41 +08:00
yxxhero 472e8c7a2d
fix: error on missing secret key when using vals (#2496)
* fix: error on missing secret key when using vals

Add HELMFILE_VALS_FAIL_ON_MISSING_KEY_IN_MAP environment variable
to control whether vals should fail when a referenced key does not
exist in the secret map.

Previously, when a secret reference like ref+vault://path#/nonexistent-key
pointed to a non-existent key, vals would silently return an empty string
without error. This could lead to deployments with missing configuration.

Default behavior remains backward compatible (returns empty string).
Set HELMFILE_VALS_FAIL_ON_MISSING_KEY_IN_MAP=true to enable strict mode.

Fixes #1563

Signed-off-by: yxxhero <aiopsclub@163.com>

* refactor: extract buildValsOptions helper and improve tests

- Extract buildValsOptions() to make vals configuration testable
- Use t.Setenv instead of manual env save/restore in tests
- Test actual vals.Options output including FailOnMissingKeyInMap

Addresses PR review comments on #2496

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: use strconv.ParseBool and make tests hermetic

- Use strconv.ParseBool for FailOnMissingKeyInMap parsing to support
  common boolean values like 'TRUE', '1', '0', etc.
- Always set env vars explicitly in tests (even to empty string) to
  prevent flaky tests when env vars are set externally
- Add test cases for various boolean formats

Signed-off-by: yxxhero <aiopsclub@163.com>

* docs: add documentation for vals-related environment variables

Add documentation for:
- HELMFILE_AWS_SDK_LOG_LEVEL: configure AWS SDK logging for vals
- HELMFILE_VALS_FAIL_ON_MISSING_KEY_IN_MAP: enable strict mode for secret refs

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: improve error handling and case-insensitive comparison

- buildValsOptions now returns error for invalid boolean values
  instead of silently defaulting to false
- Use strings.EqualFold for case-insensitive 'off' comparison
  to handle OFF, Off, etc.
- Add test cases for invalid boolean and uppercase OFF
- Update docs to mention case-insensitive and error behavior

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: normalize log level and improve singleton initialization

- Normalize AWS log level 'off' to lowercase for true case-insensitivity
- Replace sync.Once with mutex to allow recovery from config errors
- Update tests to expect normalized 'off' value
- Update docs to clarify when error is raised

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-24 09:42:54 +08:00
Hristiyan Ivanov 5c67cbcd6a
fix: pass --timeout flag through to helm for sync and apply (#2495)
* fix: propagate timeout flag

Signed-off-by: Hristiyan Ivanov <hristiyan.d.ivanov@gmail.com>

* test: add test for propagating timeout flag

Signed-off-by: Hristiyan Ivanov <hristiyan.d.ivanov@gmail.com>

* feat: add timeout flag to apply command

Signed-off-by: Hristiyan Ivanov <hristiyan.d.ivanov@gmail.com>

* test: add test for timeout flag for helmfile apply

Signed-off-by: Hristiyan Ivanov <hristiyan.d.ivanov@gmail.com>

* fix: improve description of timeout flag

Signed-off-by: Hristiyan Ivanov <hristiyan.d.ivanov@gmail.com>

---------

Signed-off-by: Hristiyan Ivanov <hristiyan.d.ivanov@gmail.com>
2026-03-22 07:34:33 +08:00
yxxhero 43b426892e
fix: cleanup hooks not receiving error signal (#2475)
* fix: cleanup hooks not receiving error signal

Closes #1041

Signed-off-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Signed-off-by: yxxhero <aiopsclub@163.com>

* Add tests for cleanup hooks error propagation

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-21 14:29:32 +08:00
dependabot[bot] 57c2b51eb0
build(deps): bump github.com/fatih/color from 1.18.0 to 1.19.0 (#2494)
Bumps [github.com/fatih/color](https://github.com/fatih/color) from 1.18.0 to 1.19.0.
- [Release notes](https://github.com/fatih/color/releases)
- [Commits](https://github.com/fatih/color/compare/v1.18.0...v1.19.0)

---
updated-dependencies:
- dependency-name: github.com/fatih/color
  dependency-version: 1.19.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-21 08:38:08 +08:00
dependabot[bot] cbe383136e
build(deps): bump k8s.io/client-go from 0.35.2 to 0.35.3 (#2492)
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.35.2 to 0.35.3.
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.35.2...v0.35.3)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-version: 0.35.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-20 07:55:30 +08:00
yxxhero df01afbbeb
fix: helmfile list now reflects version from helmfile.lock (#2486)
* fix: helmfile list now reflects version from helmfile.lock

The list command now resolves locked dependencies before returning
release information, ensuring the version field reflects the pinned
version from helmfile.lock when present.

Fixes #1953

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: address PR review comments

- Remove redundant maps.Copy in list() - labels already merged by GetReleasesWithLabels()
- Fix default lockfile path to use basePath for multi-file mode
- Update test to expect basePath-joined lockfile path
- Add multi-file test for lockfile resolution in helmfile.d directory

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix more test

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: propagate errors instead of panic in list()

When skipCharts=false, errors from list() now properly propagate instead
of causing a crash. Uses a closure variable to capture the error and
propagates it after withPreparedCharts completes.

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-19 14:25:03 +08:00
dependabot[bot] 2ccd899399
build(deps): bump google.golang.org/grpc from 1.79.2 to 1.79.3 (#2490)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.79.2 to 1.79.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.79.2...v1.79.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-version: 1.79.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-19 12:58:18 +08:00
Thomas Arrow 06d0994b84
Fix interactive apply asks in no change situation (#945)
This commit makes the apply logic exit early in the event there are no
changes to releases. I believe this effectively reverts helmfile#522.

Updates relevant snapshots

Clarify conditions under which preapply hooks are triggered to include that they will no longer fire if there is a no-op.
Docs as requested by the maintainer from a copilot request made by them.

Fixes: helmfile#679

Signed-off-by: Thomas Arrow <thomas.arrow@wikimedia.de>
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
2026-03-19 08:45:42 +08:00
yxxhero 8e68dd0dd7 fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 13:54:22 +08:00
yxxhero 20a2e1f5ec fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 13:23:03 +08:00
yxxhero 97a2f343f9 fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 11:33:23 +08:00
yxxhero 3e75fa5a06 fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 11:07:01 +08:00
yxxhero 573e8b00b6 fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 09:06:14 +08:00
yxxhero f1d3b93079 add more files
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 92205e827a fix: prevent duplicate isReleaseInstalled checks in DetectReleasesToBeDeletedForSync
When a release with 'installed: false' appears multiple times in the release list
(due to duplicate entries or being included via needs), the isReleaseInstalled
function was being called multiple times for the same release, resulting in
duplicate 'Listing releases' log messages.

This fix adds a deduplication check using a 'checked' map to ensure each release
is only checked once, preventing duplicate helm list calls and log messages.

This fixes the diff-args integration test where 'Listing releases matching
^uninstalled$' appeared twice in stderr output.

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero f2e6c9a7ac fix: prevent duplicate disabled releases in withDAG for Diff command
When running helmfile diff with releases that have 'installed: false',
(flagging them as to-be-uninstalled), the release was being disabled
flag would be included in toRender. Later, these disabled releases were
added again via releasesToUninstall when includeDisabled is true,
causing them to appear twice in the final releases list.

This resulted in duplicate 'Listing releases' log messages and
potentially duplicate helm list calls.

The fix filters out disabled releases from toRender before passing it
to withDAG. This ensures disabled releases are only included once
in the final list (via releasesToUninstall at line 2378-2382).

Fixes the test failure in test/integration/test-cases/diff-args
where 'Listing releases matching ^uninstalled$' appeared twice
instead of once.

Note: diff-live-stderr still shows two messages because that test
was updated separately to match that behavior (with trailing spaces).
The non-live diff should now correctly shows only one message.

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 20928620a8 fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 48254a990b fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero e8994292d8 fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 33ae276b83 fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 8e40e7c29d fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 86912d17f1 fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 1ce35648bf fix tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 1737bd83f5 fix more tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 2542988fbc fix: include-needs should only include direct dependencies, not transitive
- Fix collectDirectNeedsOnly to correctly match needs by full ID
- Fix PlanReleases to respect SelectedReleases when provided
- Fix unmarkNeedsDirectOnly to use full release IDs
- Update tests to expect correct behavior for include-needs vs include-transitive-needs
- Add SkipNeeds flag when needs are pre-included in withNeeds

This fixes CI issues in PR #2485

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 3815ce1143 Fix include-needs to correctly handle direct vs transitive dependencies
The withNeeds function was calling getSelectedReleases with false, false
for includeNeeds and includeTransitiveNeeds, which caused it to ignore
the --include-needs and --include-transitive-needs flags.

This fix:
1. Computes includeNeeds before calling getSelectedReleases
2. Passes the correct flags to getSelectedReleases
3. Sets st.Releases to selectedAndNeededReleases instead of deduplicated
4. Passes IncludeNeeds=false and IncludeTransitiveNeeds=false to PlanReleases
   since the needs are already included in selectedReleases

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 2cabadb81e test: update integration test with valid Helm release names
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 869a3c92c1 fix: include-needs should only include direct dependencies, not transitive
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero b06d390ade test: add integration test for include-needs vs include-transitive-needs
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero f2702416ae fix: log should show only releases matching selector, not including needs
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 03e7338eae fix: IncludeTransitiveNeeds should also enable WithDependencies in DAG planning
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00
yxxhero 9cf1c05f6d fix: add IncludeNeeds to all ChartPrepareOptions
- Add IncludeNeeds to diff, template, lint, unittest, sync, apply ChartPrepareOptions
- All ConfigProviders already have DAGConfig embedded which includes IncludeNeeds()

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-18 08:25:32 +08:00