Skip to content

Build On Push for Foundry apps

App Factory provides the ability to create triggers, which are specialized jobs that are used to automate and run tasks for your projects.

Consider a scenario in which a developer wants to build and publish a Foundry app after code changes are pushed to the source control. The administrator can create a watcher that runs the build job whenever a change is pushed to the source code.

Note: Build on push for Foundry is only supported for the buildFoundryApp job.

To create a watcher, you must create a Webhook in the SCM that you use for your App Factory projects. For more information about creating Webhooks, refer to the following sections.

After you create a webhook, you can create watcher jobs in App Factory. For more information, refer to Configuring a Watcher Job in App Factory.

Important: HCL recommends that you use the createFoundryAppTrigger job to create watcher jobs.

Other Trigger jobs such as createExportTrigger, createImportTrigger, and createMigrationTrigger will be deprecated soon. The functionality of these triggers is available in the createFoundryAppTrigger job.

Every project contains a sub-folder called Triggers in the Foundry folder. The Triggers folder contains a job called createFoundryAppTrigger (to create auto-triggered jobs), and two sub-folders called watchers and schedulers (to store the created jobs).

Creating Webhooks in GitHub

Prerequisites

Make sure that you have permissions to change the settings of the GitHub repository.

Configuring a Webhook

  1. Open your GitHub repository in a web browser, navigate to SettingsWebhooks, and then click Add webhook.
    The Add webhook page opens.

  1. Configure the following parameters in the Add webhook page:

    • Set the Payload URL to: https://<App Factory domain>/github-webhook/
      For example: https://a1001.ci.voltmxcloud.com/github-webhook/
      For more information, refer to Payload URL Format.

      Note: The last forward slash in the Payload URL is mandatory.

    • Content type must be application/x-www-form-urlencoded

    • Jenkins verification does not require a Secret. Leave the field empty.
    • Select the Just the push event option. Only pushes of code to a specific branch trigger the Flyway job.
    • The Active option should be marked by default.

  2. After you configure the necessary parameters, click Add Webhook.
    The webhook is created.

  1. You can Edit or Delete a Webhook by clicking the respective button. For more information about Webhooks, refer to the GitHub Webhook Documentation.

Creating Webhooks in Bitbucket

Prerequisites

Make sure that you have permissions to change the settings of the Bitbucket repository.

Make sure you have the Stash Webhook to Jenkins for Bitbucket add-on installed.

Configuring a Webhook

  1. Open your BitBucket repository in a web browser, navigate to Repository SettingsWebhooks, and then click Add webhook.
    The Add webhook page opens.
  2. On the Add new webhook page, configure the following parameters:

    • Set the title to App Factory
    • Set the URL to: https://<App Factory domain>/github-webhook/
      For example: https://a1001.ci.voltmxcloud.com/github-webhook/
      For more information, refer to Payload URL Format.

      Note: The last forward slash in the Payload URL is mandatory.

    • Leave the status set to Active

    • Select the Triggers option for Repository push

  3. After configuring all parameters, click Save.

Configuring a Watcher Job in App Factory

  1. From the Foundry folder of your project, navigate to Triggers.
  2. In the Triggers folder, click the build icon for the createFoundryAppTrigger job.
    Alternatively, select the createFoundryAppTrigger job, and then select the Build with Parameters option from the left panel.
  3. For the CRON_SCHEDULE parameter, make sure that the field is blank.
  4. Configure the remaining parameters for the job, which are the same as the buildFoundryApp job.
  5. After you configure the parameters, click BUILD.

Jobs that are triggered by a push to the SCM are stored in the watchers folder. Every Watcher includes the branch in the name of Job to simplify searches.

Reference: Payload URL Format

The format of the Payload URL depends on the type of Git server. App Factory supports the following Git servers:

Server TypePayload URL
GitHub Server<App Factory URL>/github-webhook/
Bitbucket Server (Stash)<App Factory URL>/bitbucket-hook/