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
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:
- Create a new Multibranch Pipeline Project
- Select DAGsHub as a branch source
- (Optional) If the repo is private, you need to supply Jenkins with credentials to access it. We suggest using an access token.
- Input your repo URL, e.g.:
- 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.
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:
- Install the Multibranch Scan Webhook Trigger Jenkins plugin
- Configure the "Scan Multibranch Pipeline Triggers" - activate the "Scan by webhook" option
- Choose a secret token
- Copy the URL:
https://YOUR-JENKINS-SERVER/multibranch-webhook-trigger/invoke?token=[YOUR-TRIGGER-TOKEN], replace the server address and trigger token.
- Go to your DAGsHub repo's webhook settings screen, e.g. https://dagshub.com/username/reponame/settings/hooks
- Click on "Add Webhook" then choose the "DAGsHub" hook type
- 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:
- 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.