gcloud alpha 运行 deploy --set-secrets 标志不起作用:"should be either `latest` or a positive integer"
gcloud alpha run deploy --set-secrets flag does not work: "should be either `latest` or a positive integer"
我尝试将我的云密钥作为环境变量注入我的云 运行 服务时失败了。我遵循了 https://cloud.google.com/sdk/gcloud/reference/alpha/run/deploy#--set-secrets
上的文档
这里是 cloudbuild.yml
文件的相关部分:
steps:
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'eu.gcr.io/$PROJECT_ID/backend:$BUILD_ID', '.' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', 'eu.gcr.io/$PROJECT_ID/backend:$BUILD_ID' ]
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'alpha'
- 'run'
- 'deploy'
- 'backend'
- '--image=eu.gcr.io/$PROJECT_ID/backend:$BUILD_ID'
- '--concurrency=10'
- '--cpu=1'
- '--memory=512Mi'
- '--region=europe-west4'
- '--min-instances=1'
- '--max-instances=2'
- '--platform=managed'
- '--port=8080'
- '--timeout=3000'
- '--set-env-vars=SQL_CONNECTION=10.0.0.3, SQL_USER=root, SQL_PASSWORD=root, SQL_DATABASE=immobilien'
- '--set-env-vars=^#^SPRING_PROFILES_ACTIVE=prod'
- '--set-env-vars=MAIL_SMTP_HOST=smtp.foo.com'
- '--set-env-vars=MAIL_SMTP_PORT=993'
- '--set-env-vars=MAIL_SMTP_USER=root'
- '--set-secrets=[MAIL_SMTP_PASSWORD=mail_smtp_password:1]'
- '--ingress=internal'
- '--vpc-connector=cloud-run'
- '--vpc-egress=private-ranges-only'
- '--set-cloudsql-instances=abc-binder-3423:europe-west4:data'
这是错误输出:
Step #2: Status: Downloaded newer image for gcr.io/google.com/cloudsdktool/cloud-sdk:latest
Step #2: gcr.io/google.com/cloudsdktool/cloud-sdk:latest
Step #2: Skipped validating Cloud SQL API and Cloud SQL Admin API enablement due to an issue contacting the Service Usage API. Please ensure the Cloud SQL API and Cloud SQL Admin API are activated (see https://console.cloud.google.com/apis/dashboard).
Step #2: Deploying container to Cloud Run service [backend] in project [abc-binder-3423] region [europe-west4]
Step #2: Deploying...
Step #2: failed
Step #2: Deployment failed
Step #2: ERROR: (gcloud.alpha.run.deploy) should be either `latest` or a positive integer
Finished Step #2
ERROR
ERROR: build step 2 "gcr.io/google.com/cloudsdktool/cloud-sdk:latest" failed: step exited with non-zero status: 1
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.builds.submit) build caf4fae8-daae-49d4-9349-6995b1f275e8 completed with status "FAILURE"
我不明白
是什么意思
should be either `latest` or a positive integer
不要用方括号将值括起来。
--set-secrets=MAIL_SMTP_PASSWORD=mail_smtp_password:1
我尝试将我的云密钥作为环境变量注入我的云 运行 服务时失败了。我遵循了 https://cloud.google.com/sdk/gcloud/reference/alpha/run/deploy#--set-secrets
上的文档这里是 cloudbuild.yml
文件的相关部分:
steps:
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'eu.gcr.io/$PROJECT_ID/backend:$BUILD_ID', '.' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', 'eu.gcr.io/$PROJECT_ID/backend:$BUILD_ID' ]
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'alpha'
- 'run'
- 'deploy'
- 'backend'
- '--image=eu.gcr.io/$PROJECT_ID/backend:$BUILD_ID'
- '--concurrency=10'
- '--cpu=1'
- '--memory=512Mi'
- '--region=europe-west4'
- '--min-instances=1'
- '--max-instances=2'
- '--platform=managed'
- '--port=8080'
- '--timeout=3000'
- '--set-env-vars=SQL_CONNECTION=10.0.0.3, SQL_USER=root, SQL_PASSWORD=root, SQL_DATABASE=immobilien'
- '--set-env-vars=^#^SPRING_PROFILES_ACTIVE=prod'
- '--set-env-vars=MAIL_SMTP_HOST=smtp.foo.com'
- '--set-env-vars=MAIL_SMTP_PORT=993'
- '--set-env-vars=MAIL_SMTP_USER=root'
- '--set-secrets=[MAIL_SMTP_PASSWORD=mail_smtp_password:1]'
- '--ingress=internal'
- '--vpc-connector=cloud-run'
- '--vpc-egress=private-ranges-only'
- '--set-cloudsql-instances=abc-binder-3423:europe-west4:data'
这是错误输出:
Step #2: Status: Downloaded newer image for gcr.io/google.com/cloudsdktool/cloud-sdk:latest
Step #2: gcr.io/google.com/cloudsdktool/cloud-sdk:latest
Step #2: Skipped validating Cloud SQL API and Cloud SQL Admin API enablement due to an issue contacting the Service Usage API. Please ensure the Cloud SQL API and Cloud SQL Admin API are activated (see https://console.cloud.google.com/apis/dashboard).
Step #2: Deploying container to Cloud Run service [backend] in project [abc-binder-3423] region [europe-west4]
Step #2: Deploying...
Step #2: failed
Step #2: Deployment failed
Step #2: ERROR: (gcloud.alpha.run.deploy) should be either `latest` or a positive integer
Finished Step #2
ERROR
ERROR: build step 2 "gcr.io/google.com/cloudsdktool/cloud-sdk:latest" failed: step exited with non-zero status: 1
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.builds.submit) build caf4fae8-daae-49d4-9349-6995b1f275e8 completed with status "FAILURE"
我不明白
是什么意思should be either `latest` or a positive integer
不要用方括号将值括起来。
--set-secrets=MAIL_SMTP_PASSWORD=mail_smtp_password:1