Chapter 6. Automatically rebuilding updated applications using webhooks

You can configure an OpenShift application to automatically rebuild and redeploy whenever updates are made to the Git repository that contains the application code. This ensures that the latest working version of your application is always available.

Prerequisites

  • An OpenShift application created using a GitHub repository as a source.
  • Permissions to change webhook settings in the GitHub repository.

Procedure

  1. In OpenShift Dedicated, change into the Developer perspective and set the Project dropdown to the appropriate project.
  2. Click Topology and click on your application to view the application details pane.
  3. Under Builds, click the name of the build configuration, marked with BC, to view the build configuration page.
  4. Under Webhooks, locate the entry for GitHub and click Copy URL with Secret.
  5. Navigate to your project page in GitHub and click Settings.
  6. Click WebhooksAdd webhook.
  7. Enter the following details on the Add webhook page:

    1. Paste the copied URL with secret into the Payload URL field.
    2. Set Content type to application/json.
    3. Leave all other options as the default.
    4. Click Add webhook.

Verification

  • Make an update to your application code and verify that the application rebuilds and deploys correctly.