Configure Salesforce Pipeline Webhook Events Help Documentation
The Opsera Salesforce Pipeline now supports webhook-based start events.
With this functionality user can manage what branches the trigger event will occur off of. User can select a primary and secondary branch and any time a commit occurs on one of these branches, the pipeline will be triggered.
Note: When a pipeline is running and user makes a commit, the pipeline will finish its current run and only IF the run was successful, it will run a second time. If the user makes multiple commits during a run, the pipeline will always use the most recent commit for the next run. The pipeline will only run once after the current run no matter how many run requests it gets for that time period.
Â
The salesforce pipeline webhook setup contains 3 steps:
1. Source Repository Configuration in Start of Workflow
In the salesforce pipeline Workflow, in Start of Workflow box, open up the Source Repository settings by selecting the gear icon(⚙︎). This will open Source Repository configurations.
To restrict a Pipeline based webhook trigger to a particular project and branch (master or non-master) select a source repository management Platform from the drop down. Choose from GitLab, GitHub or Bitbucket.
Upon selecting a Platform, corresponding accounts stored in the Tool Registry will be fetched and provided in the Account drop down. Select the account containing the project you wish to configure your webhook trigger events to.
Once the Account is selected, a list of Repositories and then Branches will be fetched and provided in drop downs. Select the Repository of your project and then select a Primary Branch. You have the option to select a Secondary Branch as well. Once the webhook is successfully registered in the following steps, this pipeline will be triggered any time a commit occurs on the selected Primary and Secondary Branch.
Enable the ‘Trigger Active’ toggle to proceed with webhook registration.
Complete webhook registration by copying the webhook URL shown. You will need to paste the copied webhook URL In your SCM account’s webhook settings.
Note: The ‘Register Webhook’ button will not automatically register your webhook. Register it manually in the next steps.
2. Webhook Registration - GitHub
Use the following instructions to manually configure your webhook in GitHub webhook settings.
In GitHub, navigate to the selected repository containing the branches the trigger event will occur off of. Click on ‘Settings’ to access webhook settings.
In Settings, select ‘Webhooks’ then click ‘Add Webhook’ button.
Fill out the form, pasting the copied URL from Source Repository step configurations in the Payload URL.
IMPORTANT: ‘Content type’ by default is set to ‘application/x-www-form-urlencoded’. You must select ‘application/json’ from the dropdown in order for webhook to trigger the pipeline.
4. Select ‘Add webhook’ button to save the settings.
3. Salesforce Package Job Creation Step Configuration
Salesforce pipeline webhook events require further configuration within the first pipeline step in the Workflow - the Salesforce Package Job Creation step (Using Jenkins tool with a Salesforce package Job and SCM Account). The Account in the Jenkins tool must including the repository selected in the Source Repository step. The Repository and Branch selected in this step must match those selected in the Source Repository step or this step (pre-start action in pipeline activity logs) will fail and the modified branch will not contain the altered files.
In the first pipeline step Step Setup, select ‘Jenkins Tool’.
Once the Jenkins Tool is selected, continue with Step Configuration:
Jenkins Tool - Select a configured Jenkins tool from the Tool Registry which has a configured Salesforce CreateJob, XML Package Salesforce Fon
Jenkins Job Type - Select Salesforce Package Generation Job from the dropdown.
Specify Salesforce Credentials - Select a configured SFDC Configurator tool from the Tool Registry.
Account - Select an SCM Account registered in the Jenkins tool. This should match Account selected in Source Repository setup.
Repository - Select the Repository selected in the Source Repository setup.
Branch - Select the Branch selected in the Source Repository setup.
3. Click ‘Save’.
Once the salesforce pipeline webhook has been correctly configured using the above instructions, the pipeline should be triggered upon any commit to the configured repository and branch. Use Pipeline Logs to verify the altered components.
Pipeline Logs
Click on ‘Console Output’
The altered files of which commits occured in the Repository and Branch will be viewable in Console Logs:
Â