fix: drop additional command line arguments the step sets for itself - #234
Open
NickJosevski wants to merge 1 commit into
Open
fix: drop additional command line arguments the step sets for itself#234NickJosevski wants to merge 1 commit into
NickJosevski wants to merge 1 commit into
Conversation
Every command the plugin builds sets --project, --space and --output-format from
the step's own fields, but none of the three ignore lists covered them
consistently, so a copy in "Additional command line arguments" was appended
after the plugin's own and the CLI kept the last one.
--output-format is the one with teeth. These commands are run for their JSON:
CommandUtils.getReleaseVersion and getServerTaskId parse it. With
--output-format table in the field, verified against a live Octopus:
release create --output-format json --output-format table -> table wins
isCreateReleaseCommand(output) -> false, no
capital-V "Version" in table output, so version extraction is skipped
silently rather than throwing
getVersion("", null) -> ""
release deploy (no --version) -> "release
version must be specified"
So the release is created, nothing complains at the step that caused it, and
the deploy fails with a message unrelated to the actual cause. --space and
--project are quieter but worse in kind: they silently retarget the command
away from what the step's fields say.
Six of these were stripped before #220 as accidental substring matches
(-p of --force-package-download, -s of --skip/--snapshot, -f of --force-*
and --release-notes-file); exact Set matching correctly stopped matching
substrings and so stopped covering them. The long forms were never covered.
Rather than restoring the accident, this collects the arguments the plugin owns
into one set and folds it into all three per-command lists, so a fourth command
gets it by construction.
The now-redundant -p/--project/--space entries are removed from the runbook
list, leaving one source of truth.
--version is deliberately left out: release create takes it from the Release
number field but runbook run has no such flag, and unlike these three it was
never covered by the old matching either, so bringing it in would be a new
behaviour change rather than part of this one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #220, which is where six of these stopped being stripped.
What's wrong
Every command
CommandHelperbuilds sets--project,--spaceand--output-formatfrom the step's own fields. None of the three ignore lists covered them consistently, so a copy in Additional command line arguments is appended after the plugin's own and the CLI keeps the last one.--output-formatis the one with teeth — these commands are run for their JSON, whichCommandUtils.getReleaseVersionandgetServerTaskIdparse. Verified against a live Octopus with--output-format tablein the field:release create --output-format json --output-format tableisCreateReleaseCommand(output)false— no capital-VVersionin table output, so version extraction is skipped silently rather than throwinggetVersion("", null)""release deploy(built with no--version)release version must be specifiedThe release is created, nothing complains at the step that caused it, and the deploy fails with a message unrelated to the cause.
--spaceand--projectare quieter but worse in kind: they silently retarget the command away from what the step's fields say.Restoration vs new coverage
Being honest about which is which — measured by running both matching implementations over all three lists:
-p--project-s--space-f--output-formatrelease createrelease deployrunbook runThe six regressions were accidental substring matches under the old
String.contains(-pinside--force-package-download,-sinside--skip/--snapshot,-finside--force-*and--release-notes-file). #220 correctly stopped matching substrings, and so stopped covering them.Approach
Rather than restore the accident, collect the arguments the plugin owns into one set and fold it into all three per-command lists via
commandArgumentSet, so a fourth command gets it by construction:The now-redundant
-p/--project/--spaceentries come out of the runbook list, leaving one source of truth.--versionis deliberately excluded:release createtakes it from the Release number field butrunbook runhas no such flag, and unlike these three it was never covered by the old matching either — so including it would be a new behaviour change rather than part of this one.Tests
One parameterised test over all six forms, asserting each of the three commands keeps exactly one
--project,--spaceand--output-formatwith the step's own values. All six cases fail against the unfixed source.CommandHelperTestis 27 tests, andmain's two runbook tests pass unchanged against the trimmed runbook list../gradlew check distZipgreen.Verified against a live Octopus
Commands generated from
CommandHelperitself, then executed against a local instance with a prompted variable, for--output-format table,-f table, and--space Other --project Other— each creates and deploys cleanly with the prompted variable arriving (PROBE ImageTag=[1.5.2]). Therunbook runpath shares the same code and is covered by unit tests only, since the probe project has no runbook.🤖 Generated with Claude Code