我正在尝试使用 Google App Engine 的构建触发器在 Google Cloud Platform 上实现自动构建和部署。当我推送到链接的 Github 存储库的主分支时,当前会触发构建。
该应用程序是一个带有 Maven 的 Spring Boot 应用程序,它提供一个简单的 API。我正在尝试mvn appengine:deploy
在我的cloudbuild.yaml
文件中发布,如下所示:
# cloudbuild.yaml
steps:
- name: 'gcr.io/cloud-builders/mvn'
args: ['appengine:deploy']
当mvn appengine:deploy
我在 Google Cloud Shell 中运行它时,它按预期工作,但当它由构建触发器执行时它不起作用。
触发的构建运行了大约 20 秒,然后失败并显示以下错误消息:
Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:deploy failed: The Google Cloud SDK could not be found in the customary locations and no path was provided.
这是我的pom.xml
配置
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.api</groupId>
<artifactId>api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>api</name>
<description>API</description>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<appengine.maven.plugin>1.3.2</appengine.maven.plugin>
<jetty-maven-plugin>9.3.7.v20160115</jetty-maven-plugin>
<gcloud-maven-plugin>2.0.9.121.v20160815</gcloud-maven-plugin>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.9.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.7.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-maven-plugin}</version>
</plugin>
</plugins>
</build>
</project>
我的配置中可能缺少什么想法?我很难在网上找到任何cloudbuild.yaml
使用 Maven 在 Google App Engine 上部署的示例。