Working with the Delivery Pipeline
In this lab, associate a different route to the application using a CLI command inside of a deployment script in Delivery Pipeline.
- From the Bluemix App dashboard, click menu > Services > DevOps.
- Select your toolchain to get the toolchain overview, and then click the icon for Delivery Pipeline.
This simple pipeline has two stages: a Build stage that runs a build job based on commits to a source code repository, and a Deploy stage that has a deploy job, which takes the build artifacts and deploys them as a Cloud Foundry application.
There’s one more type of job (besides build and deploy) that can be configured in a stage, and that is a test job. You won’t need one of those today, but test jobs can be used, as you might expect, to run code tests, or to test an application deployed to a staging environment before continuing to run later stages that would deploy to production.
- To view the configuration of the build job script in the Build stage, click on the settings icon in the upper, right corner of the stage, and select Configure Stage.
The JOB tab shows you the build configuration. The run conditions section allows you to stop the delivery pipeline in event of any failure in the job.
- Click the Input tab to view the input parameters for the build job.
You do not need to change anything on this screen. However, note the stage trigger. By default, the build job will run on every commit in the Git repository. In case you need to turn off automated builds, you can select the run manually option in the stage trigger.
- Navigate back to the Delivery pipeline.
- To modify the deploy job script in the Deploy stage, click the settings icon in the upper right corner of the stage, and select Configure Stage.
This defaults to the Jobs panel. This stage has a single job, called deploy, and the details of the job are shown.
- You will keep the Cloud Foundry deployer type, and just edit the script. Scroll down to the script to make your edits.
- Add a command to add an additional route to the application after deployment.
CF_APPenvironment variable is already defined, but you need to add a value for MY_HOST. Scroll up, and click ENVIRONMENT PROPERTIES to bring up the editor to set properties within the stage.
- Click ADD PROPERTY > Text property.
- Assign a unique value name to
- Click the SAVE button to save the changes to the Deploy stage.
- Click the Run Stage button to trigger the manual execution of the Deploy stage.
When you trigger a manual run of a stage, it will start running with the latest artifacts from the input to the stage.
- Click on Logs in the stage to be able to follow along with the deployment process and, hopefully, the assignment of the additional route after the CF app is deployed.
If all goes well, there will be a message after the application shows a running status that the route was added to the application.
- To add a dummy test stage, navigate back to the delivery pipeline and click the Add Stage button.
- Change the name of the stage to “Test Stage” and the input type to “None.”
- Add a new “Test” job.
- Select the Simple Tester type, and add this line in the Test Command window:
echo "These are dummy tests. We are good to go."
- Save the stage, and click the Run button to manually run it.
- When the run completes, view the logs and history. You should see the message you added in the Test command.
- To test the changes, in another browser, navigate to the route you added in step #8 as http://<MY_HOST>.mybluemix.net/.