最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

serverless - Passing --args to cloud run jobs - Stack Overflow

programmeradmin4浏览0评论

I'm trying to pass argument to cloud run jobs in this way:

gcloud run jobs execute aa-hello-world --args="--test1","hello","--test2","world"

(In local works as expected)

but in logs I see this:

it seems to omit arguments beginning with --

I also tried from console and from nodejs script but in both cases occurs the same.

what am I doing wrong??

thanx

I'm trying to pass argument to cloud run jobs in this way:

gcloud run jobs execute aa-hello-world --args="--test1","hello","--test2","world"

(In local works as expected)

but in logs I see this:

it seems to omit arguments beginning with --

I also tried from console and from nodejs script but in both cases occurs the same.

what am I doing wrong??

thanx

Share Improve this question asked Mar 18 at 15:28 jrgito89jrgito89 304 bronze badges 2
  • Try --args="--test1=hello","--test2=world" – DazWilkin Commented Mar 18 at 18:38
  • I also tried but not works – jrgito89 Commented Mar 20 at 10:40
Add a comment  | 

1 Answer 1

Reset to default 1

Based on the document, –args value is comma-separated, which you are already applying. But with a value that starts with “--” it could be that Cloud Run's gcloud command doesn’t directly interpret arguments that start with “--” the same way as a typical local shell environment.

When you pass --args="--test1" "hello" "--test2" "world", Cloud Run might treat the double-dash (--) arguments (like --test1, --test2) as flags or options for the gcloud command itself, rather than arguments for the container being executed.

I tried to replicate this with the sample app, but was unable to produce the same log (maybe it’s a different setup from your environment).

Likewise, here are some workarounds you can try:

  • Space before the prefix:
gcloud run jobs execute aa-hello-world --args=" --test1","hello"," --test2","world"
  • Multiple args (somehow I didn’t receive error doing this):
gcloud run jobs execute job-quickstart --args=" --test1" --args="hello" --args=" --test2" --args="world"
发布评论

评论列表(0)

  1. 暂无评论