To trigger automagically from your GitHub repo inside Jenkins, you need to:
- Create API key
- Create Test Target
- Add a WebHook to your GitHub Repository
- Extend your Jenkinsfile with the script in this repo
You can get your API key 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 create your API key can be found within the settings menu in the top right corner. Click on create API key.
You then will be navigated to our auth provider where you can create a new org-level API key.
You can only copy the API key once, so make sure to do that now. You should not share it with anyone.
Please add the API key to your CI provider as a secret.
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 in the top right corner. Click on copy test target id.
- Select your repository
Settings, go toWebhooksand clickAdd webhook.
- For the URL set
<your-jenkins-url>/github-webhook/and selectapplication/jsonfor Content type. Also select triggers that best suite your need. In general,the push eventis enough, but for this example, we also want to trigger automagically onPull Request.
Check Pull requesuts and Pushes, after that click on Add webhook.
- If everything is ok, you should see a green checkmark after a few moments.
You should copy Jenkinsfile script in this repo to the desired step in your pipeline.
You should 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.
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.
If you're new to Jenkins, this is how you can create a pipeline to test the script
- On your Dashboard page, click on
+ New Item
- Give your Project a name, select Pipeline and press OK
- You can check
GitHub projectand paste an url to your repo so you will have a button on your dashboard to take you to your repo. You need to checkGitHub hook trigger for GITScm pollingso our previously created hook can trigger our pipeline.
- For the
Definition, you should selectPipeline script from SCM. ForSCMyou should selectGitAfter adding yourRepository URL, you also need to provide credentials if it is Private repository.
You also 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, you should put */main.
The last field asks you to set the path and name to Jenkinsfile, but in our repository, it is on top level, and it is named Jenkinsfile, so no changes required.
Lastly, click on save













