Quickstart Jenkins
Trigger Octomind in your Jenkins pipeline via GitHub webhook
1. Create an API key
The option to create your API key can be found within the settings menu.
Settings menu button, 7/2024
Click on Create an API key
.
Create an API key button
You then will be navigated to our auth provider where you can create a new org-level API key.
Create an API key
Copy the API key
You can only copy the API key once, so make sure to do that now. You should not share it with anyone.
Add the API key to your CI provider as a secret to run test reports from the CI.
2. Copy your test target ID
You can get your test target ID from the octomind landing page once signed-in. If you are greeted with the 'Setup your autonomous end-to-end tests' message, please sign-in first
The option to copy your test target ID can be found within the settings menu.
Settings menu button
Click on the copy test target id
.
Copy test target ID
3. Adding webhook
If you have a way to trigger your pipeline already, you can skip this step.
Select your repository Settings
, go to Webhooks
and click Add webhook.
Adding webhook to repository, screenshot 07/2023
For the URL set <your-jenkins-url>/github-webhook/
and select application/json
for Content type.
Select triggers that best suite your need.
In general, the push event
is enough, but for this example we also want to trigger Octomind on pull request
.
Configuring webhook, screenshot 07/2023
Check Pull requests
and Pushes
and after that click on Add webhook
.
Configuring webhook permissions, screenshot 07/2023
If everything is OK, you should see a green checkmark after a few moments.
Validating webhook, screenshot 07/2023
4. Jenkins
Jenkinsfile script can be found here. Copy that code to the desired step in your pipeline.
Add your AUTOMAGICALLY_TOKEN
to your secrets. Navigate to Dashboard -> Manage jenkins -> Credentials -> System -> Global credentials (unrestricted)
and click on Add Credentials
.
For the Kind
you need to select Secret text
. Be careful that your ID
matches the ID
that you call within the Jenkinsfile script. Copy your token value to the Secret
field and click Create
.
AUTOMAGICALLY_TOKEN is API key created in first step.
Configuring AUTOMAGICALLY_TOKEN, Jenkins 2.401.2
If you want, you can enable safe parsing of HTML so you can click the link to the test report the pipeline output for you.
Navigate to Dashboard -> Manage jenkins -> Security
and for Markup Formatter
select Safe HTML
and then save.
Enabling safe parsing of HTML, Jenkins 2.401.2
Creating Jenkins pipeline
Here is an example of creating a pipeline to test the script.
On your Dashboard page, click on + New Item
Creating new Pipeline, Jenkins 2.401.2
Give your Project a name, select Pipeline and press OK
Creating new Pipeline, Jenkins 2.401.2
You can check GitHub project
and paste an url to your repo so you will have a button on your dashboard to take you to your repo.
You need to check GitHub hook trigger for GITScm polling
so our previously created hook can trigger our pipeline.
Configuring triggers from GitHub webhook, Jenkins 2.401.2
For the Definition
select Pipeline script from SCM
.
For SCM
you select Git
After adding your Repository URL
, you’ll need to provide credentials if it’s a private repository.
Loading Jenkinsfile from GitHub repository, Jenkins 2.401.2
You’ll need to specify a branch, in this example */*
will trigger the pipeline on pushing to any branch.
If you want to trigger pipeline only on specific branch changes, e.g. main, put in */main
.
The last field asks you to set the path and name to Jenkinsfile, but it’s on the top level in our repository and it’s named Jenkinsfile, so no changes are required.
Lastly, click on Save
.
Loading Jenkinsfile from GitHub repository, Jenkins 2.401.2