错误:(gcloud.beta.run.deploy)资源名称只能使用小写字母、数字和"-"。...最大长度为 63 个字符



我正在编写一个GitHub Action,用Action deploy-cloudrun将我的应用程序部署到Cloud Run(一种GCP服务(。它成功地创建并将我的应用程序映像推送到工件注册表,但未能部署到Cloud Run。

我不知道什么名字太长,也不知道该怎么改?

从Github操作控制台:

Running: gcloud beta run deploy xxxxxxxxxxxxx --quiet --platform managed --region xxxxxxxxxxxx --tag 1.0.0 --revision-suffix v1.0.0 --project xxxxxxxx --format json
Error: failed to execute gcloud command `gcloud beta run deploy xxxxxxxxxxxxx --quiet --platform managed --region xxxxxxxxxxxx --tag 1.0.0 --revision-suffix v1.0.0 --project xxxxxxxx --format json`: This command is equivalent to running `gcloud builds submit --tag [IMAGE] .` and `gcloud run deploy xxxxxxxxxxxxx --image [IMAGE]`
Building using Dockerfile and deploying container to Cloud Run service [xxxxxxxxxxxxx] in project [xxxxxxxx] region [xxxxxxxxxxx]
Building and deploying...
Uploading sources.........done
Building Container..................................done
failed
Deployment failed
ERROR: (gcloud.beta.run.deploy) Resource name must use only lowercase letters, numbers and '-'. Must begin with a letter and cannot end with a '-'. Maximum length is 63 characters.

我的工作流程:

name: Deploy to production
...
jobs:
deployment-job:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v2
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v0
with:
...
- name: Deploy to Cloud Run
uses: google-github-actions/deploy-cloudrun@v0
with:
service: ${{ env.SERVICE_NAME }}
image: ${{ env.RUN_REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/cloud-run-source-deploy/${{ env.SERVICE_NAME }}:latest
project_id: ${{ env.PROJECT_ID }}
region: ${{ env.RUN_REGION }}
tag: ${{ env.PACKAGE_VERSION }}

根据您的错误消息:

ERROR: (gcloud.beta.run.deploy) Resource name must use only lowercase letters, numbers and '-'. Must begin with a letter and cannot end with a '-'. Maximum length is 63 characters

您可以检查包含env-varenv.SERVICE_NAME的内容,并使其符合错误的要求。

  • 资源名称只能使用小写字母、数字和'-'
  • 必须以字母开头,不能以"-"结尾
  • 最大长度为63个字符

上述内容在本GCP文档中进行了定义,该文档指向本K8s关于RFC 1035标签名称的参考。这与GCP Docs 类似

..This means the name must:
contain at most 63 characters
contain only lowercase alphanumeric characters or '-'
start with an alphabetic character
end with an alphanumeric character

最新更新