Continuous Delivery for Java with CloudBees Jenkins Enterprise
Note: CloudBees Jenkins Platform for PCF is deprecated, and no further development will be made against this tile.
This is a guide using CloudBees Jenkins Enterprise for Pivotal Cloud Foundry (PCF) and integrate with your Cloud Foundry installation.
This guide covers the following topics:
- Cloning an application from Github
- Building your Java application
- Pushing your application to Cloud Foundry Elastic Runtime
Create the Initial Build Job
Navigate to the Jenkins Home and access the folder belonging to your user or organization.
new item, give it a name, and select
Build a Maven project. Click
Source Code Management, select
Git, and supply your repository URL and credentials. This guide uses the Spring PetClinic Application as an example. You can find the Spring PetClinic Application at
Build Triggers, select
Build when a change is pushed to GitHub.
Build Environment, check
Set up Cloud Foundry CLI.
- API EndPoint: Use
- Skip SSL Validation: Check this.
- API Credentials: Select your PCF/UAA Credentials. Note that Cloud Foundry CLI credentials can only be configured at the folder-level. See the credentials section of this topic for more details.
- Organization: Use the organization that you belong to on PCF.
- Space: Use the space in your organization where you want to deploy the application.
- API EndPoint: Use
cf CLI Configuration Section
In the Build section, insert
Post Steps, add an
Execute Shellpost-build step and insert
cf push APP-NAME -p PATH-TO-APP. Replace
APP-NAMEwith the name of your application. Replace
PATH-TO-APPwith the local path to your application, including the application itself. In our example, we use insert the following:
cf push petclinic -p target/petclinic.war
- Save the configuration. Click “Build Now” to run the build.
Managing the Deployed Application
After executing the job, the application is deployed in your Elastic Runtime environment (
in the organization and space that you defined in the cf CLI configuration section of this topic.
Elastic Runtime Console
From the Pivotal Cloud Foundry Elastic Runtime Console Page, you can scale, manage, and monitor your application.
Github Set Up
Both the Github plugin and git are already installed in your Jenkins instance. You must only specify the URL of the project that you want to build and deploy, and the GitHub credentials to use, if any. For our example, no GitHub credentials are needed.
Note: You can only specify credentials at the folder level.
Credentials Set Up
Only Administrators can create global credentials.
For this reason, the
Add Credentials Button in the job configuration page is disabled to users.
A user can still create credentials at the folder level, for example, in any of the job parent folders.
Follow the step below to create credentials at the folder level:
Only Administrators have the permission to create global credentials.
For this reason, in the job configuration page (when setting up the i.e. git project, CF CLI, …) the
Add Credentials Button is disabled to the user.
However, a non-administration user can still create credentials at folder level i.e. in any of the job parent folder.
The procedure is quite straightforward:
- Access the folder where you want to configure the credentials (i.e. CloudBees folder) and click on
- In the Credentials section, click
Add Credentials, and configure the desired credentials.
The credentials that you configure at this level are accessible by all of the jobs created in any of the child-folders of the current one.