我已经将我的github回购与谷歌云构建集成,在github每次提交之后,我都会自动构建一个码头映像。这是很好的工作,但现在我想做声纳分析之前,码头形象建设过程中的代码。为此,我将声纳部分集成到cloudbuild.yaml文件中。但无法运行。
我遵循了链接:https://github.com/GoogleCloudPlatform/cloud-builders-community/tree/master/sonarqube中提供的步骤
并把声纳扫描仪的图像推到谷歌集装箱注册中心。我的声纳服务器运行在一个GCP实例上。在github中的每次提交中,会社构建都会自动触发并开始执行cloudbuild.yaml文件中提到的任务
Dockerfile:
FROM nginx
COPY ./ /usr/share/nginx/htmlcloudbuild.yaml:
steps:
- name: 'gcr.io/PROJECT_ID/sonar-scanner:latest'
args:
- '-Dsonar.host.url=sonarqube_url'
- '-Dsonar.login=c2a7631a6e402c338739091ffbc30e5e3d66cf19'
- '-Dsonar.projectKey=sample-project'
- '-Dsonar.sources=.'
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'gcr.io/PROJECT_ID/html-css-website', '.' ]
images:
- 'gcr.io/PROJECT_ID/html-css-website'错误:
Status: Build failed
Status detail: failed unmarshalling build config cloudbuild.yaml: yaml: line 3: did not find expected key发布于 2019-07-19 11:41:28
如果您粘贴的格式实际上与项目中的格式匹配,那么您的问题是第一个steps块中的steps属性缩进得太远了:它应该与上面的name属性对齐。
---
steps:
- name: "gcr.io/PROJECT_ID/sonar-scanner:latest"
args:
- "-Dsonar.host.url=sonarqube_url"
- "-Dsonar.login=c2a7631a6e402c338739091ffbc30e5e3d66cf19"
- "-Dsonar.projectKey=sample-project"
- "-Dsonar.sources=."
- name: "gcr.io/cloud-builders/docker"
args:
- "build"
- "-t"
- "gcr.io/PROJECT_ID/html-css-website"
- "."
images:
- "gcr.io/PROJECT_ID/html-css-website"https://stackoverflow.com/questions/57087524
复制相似问题