reactjs - 运行 Cloud Build 时 GCP 引用格式无效
问题描述
嗨 StackOverflow 偷看。
在尝试创建 Google Cloud Platform CI/CD 管道并卡在测试部分时寻求帮助。我有以下 Dockerfile 创建图像,当我推送到 github 存储库时会触发这些图像:
FROM node:alpine as builder
WORKDIR /usr/app
COPY package.json .
RUN npm install
COPY . .
RUN npm run build
# Run phase
FROM nginx
COPY --from=builder /usr/app/build /usr/share/nginx/html
然后我有以下cloudbuild.yaml
文件构建容器,将其推送到我的仓库,并尝试运行我拥有的纱线测试:
# Start cloudbuild
# we just want to install and run tests for now
steps:
# build the docker image
- name: gcr.io/cloud-builders/docker
id: buildinstaller
args:
[
"build",
"-t",
"gcr.io/$PROJECT_ID/docker-react-ci:$BRANCH_NAME-$SHORT_SHA",
"-f",
"Dockerfile",
"."
]
# this step pushes the image to Container Registry
- name: "gcr.io/cloud-builders/docker"
id: Push
args:
- "push"
- "gcr.io/$PROJECT_ID/docker-react-ci:$BRANCH_NAME-$SHORT_SHA"
# fires the jest tests of the app so far
- name: 'gcr.io/cloud-builders/docker'
id: test
args:
- "run"
- "-e"
- "CI=true"
- "gcr.io/$PROJECT_ID/docker-react-ci:$BRANCH_NAME-$SHORT_SHA"
- "npm"
- "run"
- "test"
- "--"
- "--coverage"
Cloud Build Logs 的输出是:
starting build "f06de889-d88f-480d-bb51-9734cdf9447a"
FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://github.com/landon-sturgeon/docker-react
* branch 3daf6a3fc0bf951b2b4de1a06d75fdeef9178e8b -> FETCH_HEAD
HEAD is now at 3daf6a3 hard code the right project name again
BUILD
Starting Step #0 - "buildinstaller"
Step #0 - "buildinstaller": Already have image (with digest): gcr.io/cloud-builders/docker
Step #0 - "buildinstaller": Sending build context to Docker daemon 921.1kB
Step #0 - "buildinstaller": Step 1/8 : FROM node:alpine as builder
< INSTALLS CONTAINER CORRECTLY REMOVED LOGS FOR BREVITY >
Step #0 - "buildinstaller": Successfully tagged gcr.io/docker-react-306100/test:latest
Finished Step #0 - "buildinstaller"
Starting Step #1 - "Push"
Step #1 - "Push": Already have image (with digest): gcr.io/cloud-builders/docker
Step #1 - "Push": The push refers to repository [gcr.io/docker-react-306100/test]
Step #1 - "Push": 446f1465778a: Preparing
Step #1 - "Push": 2acf82036f38: Preparing
Step #1 - "Push": 9f65d1d4c869: Preparing
Step #1 - "Push": 0f804d36244d: Preparing
Step #1 - "Push": 9b23c8e1e6f9: Preparing
Step #1 - "Push": ffd3d6313c9b: Preparing
Step #1 - "Push": 9eb82f04c782: Preparing
Step #1 - "Push": ffd3d6313c9b: Waiting
Step #1 - "Push": 9eb82f04c782: Waiting
Step #1 - "Push": 9b23c8e1e6f9: Layer already exists
Step #1 - "Push": 9f65d1d4c869: Layer already exists
Step #1 - "Push": 2acf82036f38: Layer already exists
Step #1 - "Push": 0f804d36244d: Layer already exists
Step #1 - "Push": ffd3d6313c9b: Layer already exists
Step #1 - "Push": 9eb82f04c782: Layer already exists
Step #1 - "Push": 446f1465778a: Pushed
Step #1 - "Push": latest: digest: sha256:26172522a0d7199af3e8b044f0fa73d9efed0ed278b7af16062b00060369b96a size: 1780
Finished Step #1 - "Push"
Starting Step #2 - "test"
Step #2 - "test": Already have image (with digest): gcr.io/cloud-builders/docker
Step #2 - "test": /usr/bin/docker: invalid reference format: repository name must be lowercase.
Step #2 - "test": See '/usr/bin/docker run --help'.
Finished Step #2 - "test"
ERROR
ERROR: build step 2 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 125
这是/usr/bin/docker: invalid reference format: repository name must be lowercase
我坚持的错误。我已经尝试对 repo 名称进行硬编码,但我仍然遇到同样的错误。不知道从这里做什么,但希望 SO 神能进来拯救这一天!
谢谢!
解决方案
推荐阅读
- c# - 在 linq 查询中使用字典
- r - 无法转换标题或转换时间取决于在新版本的 gganimate 中使用 transition_states 或 transition_times
- java - 从 android 将媒体上传到 S3 存储桶时出错
- c# - 遍历天蓝色存储绝对路径c#
- regex - 如何查找长度为 5 且恰好包含一个数字和 4 个字母的所有字符串
- angular - 如何让 app-root 组件等待服务初始化其变量?
- c# - 带有 RadioButtonFor 的 ID
- jquery - wordpress 中的 jQuery ajax 请求
- c# - 看不到我的自定义应用事件(Facebook 分析)
- c# - 当值相同时循环不进入