其中一个 google 容器构建器步骤失败,因为它取决于上一步生成的文件。
构建规范中的所有步骤都在一台机器上执行吗?请建议是否有更好的方法来执行此操作,或者我是否需要在构建规范中添加任何额外的步骤?
构建规范:
steps:
- name: 'gcr.io/cloud-builders/mvn'
args: ['install:install-file', '-Dfile=locallib/wlthint3client.jar', '-DgeneratePom=true', '-DgroupId=com.oracle.weblogic', '-DartifactId=wlthint3client', '-Dversion=10.3', '-Dpackaging=jar']
- name: 'gcr.io/cloud-builders/gradle'
args: ['build']
步骤 0:直接在 maven 本地存储库中安装 JAR。
第 1 步:依赖于此 JAR 的 Gradle 构建
在步骤 0 成功而步骤 1 不成功的云构建器的日志下方,步骤 1 找不到步骤 0 安装的 jar:
Step #0: [INFO] Installing /workspace/locallib/wlthint3client.jar to /root/.m2/repository/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.jar
Step #0: [INFO] Installing /tmp/mvninstall2626838898258363583.pom to /root/.m2/repository/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.pom
Step #0: [INFO] ------------------------------------------------------------------------
Step #0: [INFO] BUILD SUCCESS
Step #0: [INFO] ------------------------------------------------------------------------
Step #0: [INFO] Total time: 3.529 s
Step #0: [INFO] Finished at: 2018-01-24T05:11:36Z
Step #0: [INFO] Final Memory: 10M/56M
Step #0: [INFO] -
Step #1: * What went wrong:
Step #1: Could not resolve all dependencies for configuration ':detachedConfiguration5'.
Step #1: > Could not find com.oracle.weblogic:wlthint3client:10.3.
Step #1: Searched in the following locations:
Step #1: file:/root/.m2/repository/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.pom
Step #1: file:/root/.m2/repository/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.jar
Step #1: https://repo1.maven.org/maven2/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.pom
Step #1: https://repo1.maven.org/maven2/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.jar
Step #1: Required by:
Step #1: project :
Step #1:**
根据我的经验,我所理解的是,在谷歌容器构建器中,每个构建步骤都在不同的虚拟机中执行。所以我通过修改我的构建规范解决了上述问题。
只需一步即可构建规范以上传工件并构建项目。
steps:
- name: 'gcr.io/cloud-builders/gradle'
args: ['uploadResultArchives','build']