【问题标题】:gcloud run deploy keeps erroring when I add args: '--args: expected one argument'当我添加 args 时,gcloud run deploy 不断出错:'--args: expected one argument'
【发布时间】:2021-03-16 11:58:41
【问题描述】:

我正在尝试使用以下参数运行gcloud run deploy

gcloud run deploy "$SERVICE_NAME" \
    --quiet \
    --region "$RUN_REGION" \
    --image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \
    --platform "managed" \
    --allow-unauthenticated \
    --args "--privileged"

但是当我向args 添加任何内容时,我不断收到以下错误:

ERROR: (gcloud.run.deploy) argument --args: expected one argument

我显然错误地使用了args 参数,但对于我的一生,我无法弄清楚为什么。 example in the docs 和我一样使用它。

我错过了什么?

编辑: 甚至文档中的示例也不起作用,并返回相同的错误:

gcloud run deploy  \
  --args "--repo-allowlist=github.com/example/example_demo" \
  --args "--gh-webhook-secret=XX" \

【问题讨论】:

    标签: docker gcloud google-cloud-run


    【解决方案1】:

    所以,我终于让它工作了。我不确定为什么我需要添加 =,因为文档中没有指定,但这里是解决方案:

    --args="--privileged"
    

    【讨论】:

    • 将长标志--flag= 的值相关联是一种很好的做法。我就是这种情况,gcloud 的命令行(Python 的)解析器将"--privileged" 视为gcloudflag。 (好像引号不存在)。使用= 可以解决这个问题。它要么是gcloud,要么是它的解析器,要么是你安装的版本。请向 Google 报告您的反馈。
    猜你喜欢
    • 1970-01-01
    • 2018-12-02
    • 1970-01-01
    • 1970-01-01
    • 2021-05-28
    • 2023-02-11
    • 2020-11-06
    • 1970-01-01
    • 2017-03-26
    相关资源
    最近更新 更多