gcloud run jobs: --args with comma-delim values

gcloud run jobs update --args="--my_arg my,comma,delim,value"

results in the following job config yaml settings:

args:
- --my_arg my
- comma
- delim
- value

Using single quotes does NOT help:

gcloud run jobs update --args="--my_arg 'my,comma,delim,value'"

results in:

args:
- --my_arg 'my
- comma
- delim
- value'

So, the gcloud run jobs CLI appears to not comma-delimited arg values AT ALL, since for some reason, users MUST provide multiple args with comma delimiters (e.g., `

–args=“–arg1=foo,–arg2=bar”`).

Why doesn’t gcloud run jobs allow for multiple --args parameters, as is done for --env with docker run? That would make more sense, given the limitations of requiring comma-delimitation among parameters in --args.

1 Like

More generally, when will this forum finally support standard markdown formatting (e.g., ``` for code blocks)?

Stumbling on the same issue with


gcloud run jobs create my_job --command="tfds" --args="build,--beam_pipeline_options=${beam_pipeline_options}"

where beam_pipeline_options is a comma-delimited list of name=value pairs.

There’s a workaround to change the delimiter as per https://cloud.google.com/run/docs/configuring/services/environment-variables#setting that works with --args too in case the value uses commas.

my_value="hello,there"
my_other_value="general,kenobi"

--args="^|^build|${my_value}|${my_other_value}"
1 Like

Thanks @carlthome !

I guess that works, but it’s a bit of a hack. I’m quite surprised that there parser doesn’t properly handle quoted text. It seems like a simple edit to the codebase.

That’s interesting, and I’m glad there’s a workaround!

gcloud run jobs uses standard gcloud libraries for parsing text. For what it’s worth, I raised this to that team’s attention.

1 Like

The workaround works as expected, it should be added in the documentation here https://cloud.google.com/sdk/gcloud/reference/run/jobs/create#–args,

It is well written in Cloud Run doc but not in Jobs docs, I lost so many hours trying to escape that comma. Thanks