jenkins-x-plugins / jenkins-x-plugins/jx-gitops

`helm release`: --ignore became a substring match in v1.4.0, silently skipping charts whose name contains "preview"

Open Beginner friendly
#1,098 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
35
Forks
53
Avg merge
1d 12h
Merged PRs (30d)
7

Description

### Summary

Since **v1.4.0**, `jx gitops helm release` silently skips any chart whose directory name *contains* `preview` as a substring — not just a chart directory named `preview`. It logs `not releasing chart ` and **exits 0**, so the release pipeline reports success and publishes nothing.

A chart named e.g. `acme-preview-infrastructure` becomes unpublishable with no error anywhere.

### Cause

`3df787ec` ("feat: support specifying chart to release") changed the filter in `pkg/cmd/helm/release/release.go`:

```go
- if stringhelpers.StringArrayIndex(o.IgnoreChartNames, name) >= 0 {
+ if !stringhelpers.StringContainsAny(name, includeRepos, o.IgnoreChartNames) {
```

`StringArrayIndex` is an **exact** match. `StringContainsAny` matches `excludes` by substring:

```go
for _, x := range excludes {
if strings.Index(text, x) >= 0 {
return false
}
}
```

Combined with the long-standing default `--ignore [preview]` (added in `9c539684`, 2021, "lets ignore by default the preview chart from releases"), the guard silently widened from one exact directory name to any name containing the word.

The default was harmless under exact matching for four years, so this is a behaviour change in a minor release with no accompanying flag change.

### `--ignore` cannot be worked around by the new include argument

Excludes are evaluated **first** and return early, so the feature added in the same commit cannot compensate:

```
jx gitops helm release acme-preview-infrastructure # still skipped
```

The only workaround is to override `--ignore` with a sentinel that cannot appear in a directory name, and then re-supply the chart directories as includes — because neutralising `--ignore` alone re-enables publishing of a genuine `preview` chart, which the default exists to prevent.

### Reproduction

```
charts/
acme-preview-infrastructure/Chart.yaml
acme-service/Chart.yaml
```

```
$ jx gitops helm release
not releasing chart acme-preview-infrastructure
releasing chart acme-service
released 1 charts from the charts dir: charts
$ echo $?
0
```

Verified directly against the helper:

| `--ignore` | includes | `acme-preview-infrastructure` | `preview` |
|---|---|---|---|
| `[preview]` (default) | — | **SKIP** | SKIP |
| sentinel | — | RELEASE | **RELEASE** |
| sentinel | explicit dirs | RELEASE | SKIP |

### Versions

| jx-boot | bundled jx-gitops | behaviour |
|---|---|---|
| 3.16.59 | 1.1.7 | exact — chart publishes |
| 3.17.99 | 1.4.15 | substring — chart skipped |

`git tag --contains 3df787ec` excludes `v1.1.7`, includes `v1.4.15`; earliest is `v1.4.0`.

Because the plugin is baked into the `jx-boot` image, a routine minor bump of a pipeline task's image is enough to trigger this, with no change to the repo being released.

### Impact

Nine consecutive releases of one chart published normally, then every subsequent release published nothing while reporting success. Because the version tag is created by an earlier pipeline step, git tags kept advancing while the registry did not — so consumers pinning a tagged version fail at deploy time with `:: not found`, far from the cause. It went unnoticed for days.

The silent `exit 0` is the main problem: a skip that nobody asked for is indistinguishable from a successful release.

### Suggested fixes

1. Match `IgnoreChartNames` exactly, as before — keep `StringContainsAny` for `includeRepos` only.
2. If substring matching is intended, change the default from `preview` to something anchored, and document it.
3. Either way, make a skipped chart visible — a warning, or a non-zero exit when `released 0 charts` and the charts dir was non-empty.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in pkg/cmd/helm/release/release.go and inspect StringContainsAny alongside the default --ignore [preview] behavior described here. Reproduce with preview and acme-preview-infrastructure chart names, then verify regression coverage for exact ignore semantics and the reported successful no-release behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, helm, kubernetes
Domain
cli, devops, release
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.