agent icon indicating copy to clipboard operation
agent copied to clipboard

Argparse bug when using quoted values

Open brandonhoughton opened this issue 2 years ago • 1 comments

When trying to enable shallow git clones and fetches via arguments if you specify the flags via spaces as the help usage suggests, e.g. buildkite-agent start --git-clone-flags "-v --depth=1" --git-fetch-flags "-v --depth=1" an error is thrown: flag provided but not defined: -v --depth however if you use key=value, the flags are accepted buildkite-agent start --git-clone-flags="-v --depth=1" --git-fetch-flags="-v --depth=1"

brandonhoughton avatar May 24 '22 00:05 brandonhoughton

Thanks for the report @brandonhoughton 🤔

Presumably a bug in github.com/urfave/cli v1, or maybe in how we pass those args through to git etc.

We can't jump on this right away, but we do have it tracked to look at when time permits.

pda avatar Jul 05 '22 01:07 pda

I believe this was fixed in https://github.com/buildkite/agent/pull/1619, and we did not even notice! The latest version of the agent does support parsing flags with = in them. I've tested it with version v3.43.1 and the agent started with --git-clone-flags "-v --depth=1" --git-fetch-flags "-v --depth=1" set. I could see the fetch flag propagated to the build as well. Let us know if you still have problems with it.

triarius avatar Jan 24 '23 11:01 triarius