Release Pipelines are a feature of the Google Cloud Platform that allows you to automate the process of releasing an App Engine application from source code stored in a Git repository.
Each Cloud project can have one Release Pipeline that defines the steps in a release. These steps can include the following:
- Building the application (Java only)
- Running unit tests (Java only)
- Deploying the application to App Engine
- Sending notifications when a deployment is complete
You trigger the Release Pipeline when you push your application source code
from a local Git repository to the
Cloud Repository
associated with
your project or to a
connected GitHub repository
.
Triggering the Pipeline starts the process of executing its steps on the
Cloud Platform backends. A Release Pipeline is only triggered when you
push code to the
master
repository branch.
Release Pipelines extend the older Git and Push-to-Deploy feature. If you previously set up a Push-to-Deploy configuration for your App Engine application, you can continue to use it with no changes to your deployment workflow. However, if you want to make changes to your existing Push-to-Deploy configuration, you must use the new Release Pipelines interface in the Cloud Developers Console.
Release Pipelines are an optional feature. If you are using the native SDK methods for App Engine deployment, you can continue to do so. Note, however, that only Release Pipelines push source code to the Cloud Repository.
Language support
Release Pipelines work for App Engine applications written in Python, PHP and Java.
Python/PHP
For App Engine applications written in Python PHP, Release Pipelines support deployment only. Execution of unit tests is not supported. Release Pipelines also do not support the Python Modules feature in App Engine. Google does not bill you for using Release Pipelines for Python and PHP applications.
Java
For App Engine applications written in Java, Release Pipelines support building, testing and deployment. Release Pipelines use Jenkins and Maven to build and test Java applications, and execute unit tests using JUnit and the Maven Surefire plugin . Release Pipelines for Java require you to set up billing for your account.
Maven
Note the following Maven requirements:
- Only Maven version 3.1.0 is supported.
-
pom.xml
must be in the root folder of the source repository. -
Release Pipelines build the Java application with the following
command:
mvn clean package -Dmaven.test.skip=true
. -
Unit tests are run by executing the Maven goal
test
in the root directory. -
Unit tests must generate XML test reports in the
target/surefire-reports
directory. -
The single WAR file in the
target
directory is deployed to App Engine if there are no test failures or errors.
Java version
The Java compiler plugin for Maven version 3.1 defaults to version 1.5
for the source and target. If you need a later Java version, you must
explicitly specify it in your
pom.xml
file. The following code shows how
to specify Java version 1.7:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>2.5.1</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Jenkins, GCE and GCS
Use of Release Pipelines for Java results in the creation of an always-on n1-standard-1 Google Compute Engine (GCE) VM for running your Java builds and tests. This VM hosts the Jenkins master used to build your project and continues running as long as Java: Maven Build, Unit Test and Deploy is specified as your deployment type. In addition, the build logs and WAR file produced by your build are uploaded to a Google Cloud Storage (GCS) bucket owned by your project.
Billing
You must set up billing for your account before you can use Release Pipelines for Java. If you have not already enabled billing, you will be prompted to do so when you set up your deployment.
Note the following:
- See GCE VM pricing for details on pricing for the always-on n1-standard-1 GCE VM used by Release Pipelines.
- The cost of GCS storage depends on the size of logs and WAR file produced by your build. Please see GCS pricing for details. You can reduce costs by deleting the logs and/or WAR files that are no longer needed. By default, logs and WAR files are deleted after 14 days
Setting up a Release Pipeline
To set up a Release Pipeline:
-
If Git is not installed on your local system, download and install it.
-
If you haven't already set up a Cloud Repository for your project, do so now .
-
Open your project in the Cloud Developers Console .
-
Select Cloud Development > Releases in the left-hand navigation panel.
-
Optionally, enter a name for the Release Pipeline in the Release Pipeline Name field.
-
Choose a pipeline task:
- Deploy Source . Use this option for Python and PHP applications.
- Java: Maven Build, Unit Test and Deploy . This option builds your Java application, runs unit tests and deploys the WAR file produced by the build if there are no test failures or errors.
-
Select Send E-mail and enter an e-mail address to enable notifications on deployment.
-
Click Create Pipeline .
Triggering a Release Pipeline
To trigger the release pipeline, commit your changes to your local Git
repository and run the
git push
command.
If you are pushing directly to the Cloud Repository, use the following command:
git push origin master
If you are pushing to the repository via a repository on GitHub , use the following:
git push <remote> master
where
<remote>
is the remote name for the repository on GitHub.
Viewing release history and build status
You can view the release history and current deployment status for your application in the Cloud Developers Console.
To view the status and history:
-
Open your project in the Cloud Developers Console .
-
Select Cloud Development > Releases in the left-hand navigation panel.
A list of application deployments appears. For each deployment in the list, the last task successfully completed appears in the Tasks column.
-
Click a task in the Tasks column to see a full list of tasks completed.
Viewing build logs and WAR files in Cloud Storage
When Push-to-Deploy builds a Java application, it generates an archive named
upload.war
that contains the application source. The WAR file and saved
build logs are stored in Google Cloud Storage.
To view build logs and WAR files:
-
Click Cloud Storage in the left-hand navigation panel of the Cloud Console.
-
Click the bucket whose name begins with
p2d_
to display a list of folders. To see the build logs and WAR file for a specific commit ID, click on the folder whose name matches the ID.