Continuous Integration and Deployment (CI/CD) pipelines can be built using gopaddle APIs and groovy script.

Pre-requisite:

  • Generic web hook Jenkins plugin is required to expose a webhook end point generic-webhook-trigger-plugin (Tested for 1.66)

  • Notification Endpoint : The notification endpoint defines the target to which an alert needs to be sent. Please check Creating Notifications article on how to register a webhook as the notification end point.

  • Alert Policy : A policy that defines the events, the resource which is watched for events and the notification end point. Please check Creating an Alert Policy article for the types of events that are supported.

Once the notification end point and an alert policy is defined, gopaddle can trigger a Jenkins webhook as soon as an event occurs within the gopaddle platform. For example, a Jenkins regression test job can be triggered as soon as a build succeeds in the platform.

403 No valid crumb was included in the request

Manage Jenkins -> Configure Global Security http://<jenkinsendpoint>/configureSecurity/
Under CSRF Protection, Enable Proxy Compatibility

Create a new pipeline job


Add webhook trigger


Add build token

Add variable 1


Add variable 2


Add groovy script

node {
    stage('rollingUpdate') {
        sh '''
        echo $serviceID $buildID $response
        curl -X PUT -H "Authorization:token <gpUser_token>" -d '{"updateType":"buildUpdate","deploymentTemplateVersion":0,"serviceGroups":[{"id":"sg7bb07a93sgafafsg4ddfsga68asge18d8f1c9cae","description":"build update","services":[{"id":"'"$serviceID"'","releaseConfig":{"buildID":"'"$buildID"'"}}]}]}' https://portal.gopaddle.io/gateway/v1/application/appsa7b57dc0c72acc41a6cb62ccb38dcfbb1b5f > response.txt
        cat response.txt
        '''
        }
}
Did this answer your question?