Repository navigation
Open
Labels
enhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed
Description
Background
helm rollback reverts a release to a previous revision. Without it, recovering from a bad install/upgrade requires uninstall + re-install, losing release history. See helm rollback docs.
Helm SDK action: action.NewRollback (upstream).
Acceptance criteria
-
Helm.rollback("release").call()rolls a release back one revision and returns the resultingRelease -
.toRevision(int)targets a specific revision;0(or unset) = previous - Flags supported:
--cleanup-on-fail,--dry-run,--force,--no-hooks,--wait,--timeout,--history-max,--namespace,--debug, kube-config (path + contents) - Integration tests in
HelmKubernetesTest.Rollback(nested class — shares the KinD container) - Non-existent release surfaces a meaningful
IllegalStateException
Proposed Java API
Release r = Helm.rollback("my-release")
.toRevision(2)
.cleanupOnFail()
.waitReady()
.withTimeout(300)
.withKubeConfig(kubeConfigPath)
.call();Implementation guide
Follow AGENTS.md → "Adding a new Helm command" for the 9-step workflow.
Reference impl to copy patterns from: StatusCommand — same shape (keyed by release name, returns Release, uses Release.parseSingle()).
Go (native/internal/helm/rollback.go)
- Build config with
NewCfg(&CfgOptions{ KubeConfig, KubeConfigContents, Namespace })— same asstatus.go. client := action.NewRollback(cfg). Map options:client.Version(= revision; 0 means previous),CleanupOnFail,DryRun,Force,DisableHooks,Wait,Timeout(time.Duration(seconds) * time.Second),MaxHistory.client.Run(releaseName)returns only anerror(no payload).- After success, fetch state with
action.NewStatus(cfg).Run(name)and returnStatusReport(rel, true, options.Debug)— same pattern asstatus.go.
CGO bridge (native/main.go)
- Add
struct RollbackOptions { ... }next to the other option structs. - Add
//export Rollbackwrappinghelm.Rollback(...)viarunCommand(func() (string, error) { ... }).
JNA + Java
lib/api/.../RollbackOptions.java: mirror the C struct field order exactly (@Structure.FieldOrder).- Add
Result Rollback(RollbackOptions options)toHelmLib. helm-java/.../RollbackCommand.javaextendsHelmCommand<Release>;call()returnsparseSingle(run(hl -> hl.Rollback(...))).- Add
Helm.rollback(String releaseName)static factory next toHelm.status(...).
Tests
- Add as a nested
Rollbackclass insideHelmKubernetesTest, not a separate file — the KinD container is shared via@BeforeAll. Use the statickubeConfigFile/kubeConfigContentsfields. - Scenario suggestions:
- Valid:
toPreviousRevision(install → upgrade → rollback → assert revision == "3"),toSpecificRevision,withNamespace,withKubeConfigContents - Invalid:
nonExistentRelease→assertThatThrownBy(cmd::call).hasMessageContaining("release: not found")
- Valid:
- Skeleton:
@Nested class Rollback { @Nested class Valid { @Test void toPreviousRevision() { helm.install().withKubeConfig(kubeConfigFile).withName("r1").call(); helm.upgrade().withKubeConfig(kubeConfigFile).withName("r1").call(); Release r = Helm.rollback("r1").withKubeConfig(kubeConfigFile).call(); assertThat(r).returns("3", Release::getRevision); } } }
Contributor checklist
- Java 8 syntax only (no
var,Path.of, records,Map.of) - Apache 2.0 header on new files (or run
make license) -
@authorJavadoc tag on each new class - DCO sign-off on every commit (
git commit -s) -
make build-native && ./mvnw test -pl helm-java -Dtest=HelmKubernetesTestpasses locally
References
- Helm CLI: https://helm.sh/docs/helm/helm_rollback/
- Helm SDK action: https://github.com/helm/helm/blob/v3.21.0/pkg/action/rollback.go
- Project workflow: AGENTS.md → Adding a new Helm command
- Reference impl:
StatusCommand.java+native/internal/helm/status.go
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed
Activity
chore(docs): refresh native codebase audit for 2026-05
chore(docs): refresh native codebase audit for 2026-05
💄 devtalks-2026: rebuild the leverage slide as a 3-step reveal (#51)