Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fcli fod action run XXX --release fails if Application or Release Name contains spaces #603

Closed
kadraman opened this issue Sep 19, 2024 · 3 comments
Labels
bug Something isn't working effort:low Easy to implement/fix fcli-actions prio:high High priority; important new feature or bug fix

Comments

@kadraman
Copy link
Collaborator

kadraman commented Sep 19, 2024

Current Behavior

Currently any invocation of fcli action commands which require an FoD Application or Release to be specified fail if either of them includes a space in their name. See error in "Steps to Reproduce" below.

I assume the same would be true for SSC Application and Application Version but have not tested.

Expected Behavior

All existing fcli commands support spaces in names - the action commands should work in the same way.

Steps To Reproduce

Execute a command similar to the following:

fod action run setup-release --release "FcliDemoApp [KAL]:test1" --sdlc-status Development -t sast 
com.fortify.cli.common.action.runner.ActionRunner$StepProcessingException: Error processing:
  com.fortify.cli.common.action.model.ActionStepFcli:
    {
      "args" : "fod release create ${parameters.release} ${relCreateArgs}",
      "name" : "createRelease",
      "if" : null,
      "forEach" : null
    }
        at com.fortify.cli.common.action.runner.ActionRunner$ActionStepsProcessor.processStep(ActionRunner.java:440)
        at com.fortify.cli.common.action.runner.ActionRunner$ActionStepsProcessor.lambda$processStepEntries$0(ActionRunner.java:419)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at com.fortify.cli.common.action.runner.ActionRunner$ActionStepsProcessor.processStepEntries(ActionRunner.java:419)
        at com.fortify.cli.common.action.runner.ActionRunner$ActionStepsProcessor.processStep(ActionRunner.java:407)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at com.fortify.cli.common.action.runner.ActionRunner$ActionStepsProcessor.processSteps(ActionRunner.java:395)
        at com.fortify.cli.common.action.runner.ActionRunner$ActionStepsProcessor.processSteps(ActionRunner.java:391)
        at com.fortify.cli.common.action.runner.ActionRunner.run(ActionRunner.java:165)
        at com.fortify.cli.common.action.cli.cmd.AbstractActionRunCommand.run(AbstractActionRunCommand.java:80)
        at com.fortify.cli.common.action.cli.cmd.AbstractActionRunCommand.call(AbstractActionRunCommand.java:63)
        at com.fortify.cli.common.action.cli.cmd.AbstractActionRunCommand.call(AbstractActionRunCommand.java:40)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2118)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2538)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2530)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2492)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2350)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2494)
        at picocli.CommandLine.execute(CommandLine.java:2247)
        at com.fortify.cli.app.runner.DefaultFortifyCLIRunner.run(DefaultFortifyCLIRunner.java:55)
        at com.fortify.cli.app.FortifyCLI.execute(FortifyCLI.java:38)
        at com.fortify.cli.app.FortifyCLI.main(FortifyCLI.java:32)
Caused by: picocli.CommandLine$UnmatchedArgumentException: Unmatched argument at index 4: '[KAL]:test1'
        at picocli.CommandLine$Interpreter.validateConstraints(CommandLine.java:13724)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:13676)
        at picocli.CommandLine$Interpreter.processSubcommand(CommandLine.java:13962)
        at picocli.CommandLine$Interpreter.processArguments(CommandLine.java:13858)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:13653)
        at picocli.CommandLine$Interpreter.processSubcommand(CommandLine.java:13962)
        at picocli.CommandLine$Interpreter.processArguments(CommandLine.java:13858)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:13653)
        at picocli.CommandLine$Interpreter.processSubcommand(CommandLine.java:13962)
        at picocli.CommandLine$Interpreter.processArguments(CommandLine.java:13858)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:13653)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:13621)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:13516)
        at picocli.CommandLine.parseArgs(CommandLine.java:1629)
        at com.fortify.cli.common.cli.util.FcliCommandExecutor.parse(FcliCommandExecutor.java:95)
        at com.fortify.cli.common.cli.util.FcliCommandExecutor.parse(FcliCommandExecutor.java:91)
        at com.fortify.cli.common.cli.util.FcliCommandExecutor.<init>(FcliCommandExecutor.java:44)
        at com.fortify.cli.common.action.runner.ActionRunner$ActionStepsProcessor.processFcliStep(ActionRunner.java:661)
        at com.fortify.cli.common.action.runner.ActionRunner$ActionStepsProcessor.processStep(ActionRunner.java:434)
        ... 21 more

Environment

OS: Ubuntu 24.2
FoD: 24.3
fcli: 2.6.0

Anything else?

No response

@kadraman kadraman added the bug Something isn't working label Sep 19, 2024
@rsenden rsenden added prio:high High priority; important new feature or bug fix effort:? fcli-actions labels Sep 19, 2024
@rsenden
Copy link
Contributor

rsenden commented Sep 19, 2024

Thanks for reporting, this is definitely something that needs to be fixed sooner rather than later. Given that the upcoming Fortify GitHub Action release makes extensive use of fcli actions, this should ideally be fixed before the new GitHub Action release.

It looks like my prototype for using picocli rather than our own action options parser doesn't exhibit this bug, so maybe good to prioritize #602 rather than trying to fix our custom options parser.

image

@rsenden
Copy link
Contributor

rsenden commented Sep 19, 2024

After some testing, it's actually not that bad ;). It's not the action framework itself that is improperly parsing arguments with spaces, but rather the setup-release action that improperly passes the provided release name to the various fcli commands.

Just adding quotes around ${parameters.release} in the various fcli instructions seems to fix this:

image
image

@rsenden rsenden added effort:low Easy to implement/fix and removed effort:? labels Sep 19, 2024
@kadraman
Copy link
Collaborator Author

Yes, this is correct - will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working effort:low Easy to implement/fix fcli-actions prio:high High priority; important new feature or bug fix
Projects
None yet
Development

No branches or pull requests

2 participants