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.

  1. From the Bluemix App dashboard, click menu > Services > DevOps.
  2. 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.

  3. 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.

  4. 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.

  5. Navigate back to the Delivery pipeline.
  6. 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.

  7. You will keep the Cloud Foundry deployer type, and just edit the script. Scroll down to the script to make your edits.
  8. Add a command to add an additional route to the application after deployment.

  9. The CF_APP environment 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.
  10. Click ADD PROPERTY > Text property.

  11. Assign a unique value name to MY_HOST.

  12. Click the SAVE button to save the changes to the Deploy stage.
  13. 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.

  14. 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.

  15. To add a dummy test stage, navigate back to the delivery pipeline and click the Add Stage button.

  16. Change the name of the stage to “Test Stage” and the input type to “None.”

  17. Add a new “Test” job.

  18. Select the Simple Tester type, and add this line in the Test Command window:
    echo "These are dummy tests. We are good to go."

  19. Save the stage, and click the Run button to manually run it.
  20. When the run completes, view the logs and history. You should see the message you added in the Test command.

  21. To test the changes, in another browser, navigate to the route you added in step #8 as http://<MY_HOST>