Skip to content
Reader Mode

Found a problem?
Let us know (or fix it):

Edit this Page

Have a question?
Join our community now:

Discord Chat

Jenkins Integration

Jenkins is the most popular and mature open source tool for CI/CD and automation, and it's also usable for automating Data Science and Machine Learning workflows.

DAGsHub has an official Jenkins plugin that you can use to automatically scan your DAGsHub repos, and execute custom pipelines on each: * Git branch push * Git tag creation * Pull request

Installation instructions

Just go to your Jenkins' plugin management UI, and search for DAGsHub. The plugin should be listed as "Available", and you can just install it.

To use it:

  1. Create a new Multibranch Pipeline Project
  2. Select DAGsHub as a branch source
    DAGsHub branch srouce
  3. (Optional) If the repo is private, you need to supply Jenkins with credentials to access it. We suggest using an access token.
  4. Input your repo URL, e.g.: https://dagshub.com/username/reponame
  5. Select the behaviors you want - whether to build on all branch pushes, only pull requests, etc. All behaviors supported by the DAGsHub plugin start with the word (DAGsHub) for your convenience.

DAGsHub branch source settings

Automatically triggering builds using webhooks

The DAGsHub plugin currently doesn't automatically install any webhook on the repo for you. This means new builds won't run after pushing branches etc. until you manually trigger a branch scan in the Jenkins project.

To solve this, you can:

  1. Install the Multibranch Scan Webhook Trigger Jenkins plugin
  2. Configure the "Scan Multibranch Pipeline Triggers" - activate the "Scan by webhook" option
  3. Choose a secret token
    Jenkins multibranch webhook trigger
  4. Copy the URL: https://YOUR-JENKINS-SERVER/multibranch-webhook-trigger/invoke?token=[YOUR-TRIGGER-TOKEN], replace the server address and trigger token.
  5. Go to your DAGsHub repo's webhook settings screen, e.g. https://dagshub.com/username/reponame/settings/hooks
  6. Click on "Add Webhook" then choose the "DAGsHub" hook type
    DAGsHub webhook creation
  7. Define the Jenkins webhook URL from the previous steps, and chosoe the event types which should trigger it. The recommended set is marked in the following screenshot:
    DAGsHub webhook definition
  8. Click on "Add Webhook".
    Now, whenever a branch or pull request is created/updated/deleted, Jenkins will receive a notification, rescan your project and trigger any required builds.