当我推送到github时,我试图自动部署一个容器,我在GCP上启用了这个功能,但是它没有工作,当触发它时它会发出抱怨:
generic::invalid_argument: invalid build: invalid image name "us.gcr.io/cifar-clf/CIFAR-10_classification/cifar-clf:f2d5c55fad600b733fc5bcc84550fdd9a325b05b": could not parse reference: us.gcr.io/cifar-clf/CIFAR-10_classification/cifar-clf:f2d5c55fad600b733fc5bcc84550fdd9a325b05bDockerfile(位于项目的根):
FROM python:3.8
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
RUN pip install -r requirements.txt
EXPOSE 8080
CMD python app.py但我得到了上面的错误。
对于顺序部署,使用以下方法可以很好地工作:
gcloud builds submit --tag gcr.io/cifar-clf/cifar-clf --project=cifar-clfgcloud run deploy --image gcr.io/cifar-clf/cifar-clf --platform managed --project=cifar-clf --allow-unauthenticated任何帮助或建议都将不胜感激,谢谢各位!
发布于 2021-06-21 12:49:02
图像引用的命名组件只允许小写字符从分发的实现。
// alphaNumericRegexp defines the alpha numeric atom, typically a
// component of names. This only allows lower case characters and digits.
alphaNumericRegexp = match(`[a-z0-9]+`)
// separatorRegexp defines the separators allowed to be embedded in name
// components. This allow one period, one or two underscore and multiple
// dashes. Repeated dashes and underscores are intentionally treated
// differently. In order to support valid hostnames as name components,
// supporting repeated dash was added. Additionally double underscore is
// now allowed as a separator to loosen the restriction for previously
// supported names.
separatorRegexp = match(`(?:[._]|__|[-]*)`)
// nameComponentRegexp restricts registry path component names to start
// with at least one letter or number, with following parts able to be
// separated by one period, one or two underscore and multiple dashes.
nameComponentRegexp = expression(
alphaNumericRegexp,
optional(repeated(separatorRegexp, alphaNumericRegexp)))所以你应该改变:
us.gcr.io/cifar-clf/CIFAR-10_classification/cifar-clf:f2d5c55fad600b733fc5bcc84550fdd9a325b05b至:
us.gcr.io/cifar-clf/cifar-10_classification/cifar-clf:f2d5c55fad600b733fc5bcc84550fdd9a325b05b发布于 2022-10-19 12:49:52
下面的方法将帮助您修复所面临的错误。
在使用Build触发器通过cloudbuild.yaml部署时,我也发生了同样的错误。

您可以使用变量$REPO_NAME覆盖您的reponame的值,如前面提到的这里。
为了解决你和我一样的错误,
cifar-10_classification重写回购名称

这归功于https://stackoverflow.com/users/596285/bmitch,因为我在做这个POC时偶然发现了bmitch的根本原因解释。
发布于 2022-11-03 18:27:55
如果您的回购名称包含大写字符,直接在云构建上使用$REPO_NAME作为工件注册库名称的一部分,则会由于工件注册组件的名称验证而引起问题。只有小写字符是可以接受的。
https://stackoverflow.com/questions/68067977
复制相似问题