Skip to content

Commit

Permalink
fix: don't break on --substitute values which have commas
Browse files Browse the repository at this point in the history
The following:

  stacker build --substitute a=b,c

used to work, until commit 3baba64:

  fix(ci): convert ci is failing due to perms (project-stacker#439)

This squashed PR included 'chore(go.mod): update cli to
github.com/urfave/cli/v2'.  Switching from urfave/cli/v1 to v2 changes
string slice flag behavior to automatically split on commas.

Luckily there is an app.DisableSliceFlagSeparator flag we can set to
tell it not to do that.  Set that flag.  And add a test for this.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
  • Loading branch information
hallyn committed Jan 5, 2024
1 parent d54e250 commit 4af746a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/stacker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ func main() {
&checkCmd,
}

app.DisableSliceFlagSeparator = true

app.Flags = []cli.Flag{
&cli.StringFlag{
Name: "work-dir",
Expand Down
12 changes: 12 additions & 0 deletions test/build-only.bats
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,15 @@ EOF
[ -f dest/rootfs/2 ]
[ -f dest/rootfs/3 ]
}

@test "commas in substitute flags ok" {
cat > stacker.yaml <<"EOF"
one:
from:
type: oci
url: $BUSYBOX_OCI
run: |
touch /1
EOF
stacker build --substitute "a=b,c"
}

0 comments on commit 4af746a

Please sign in to comment.