Skip to content

OctoMind-dev/jenkins-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

jenkins-integration

To trigger automagically from your GitHub repo inside Jenkins, you need to:

  1. Create API key
  2. Create Test Target
  3. Add a WebHook to your GitHub Repository
  4. Extend your Jenkinsfile with the script in this repo

Creating API key

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.

create-api-key

You then will be navigated to our auth provider where you can create a new org-level API key.

create-api-key-propelauth

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.

Creating Test Target

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.

copy-test-target

Adding webhook

  1. Select your repository Settings, go to Webhooks and click Add webhook.

Webhook-01

  1. For the URL set <your-jenkins-url>/github-webhook/ and select application/json for Content type. Also select triggers that best suite your need. In general, the push event is enough, but for this example, we also want to trigger automagically on Pull Request.

Webhook-02

Check Pull requesuts and Pushes, after that click on Add webhook.


Webhook-03

  1. If everything is ok, you should see a green checkmark after a few moments.

Webhook-04

Jenkins

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.


Jenkins-06

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.


Jenkins-07

Creating Jenkins Pipeline

If you're new to Jenkins, this is how you can create a pipeline to test the script

  1. On your Dashboard page, click on + New Item

Jenkins-01

  1. Give your Project a name, select Pipeline and press OK

Jenkins-02

  1. 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.

Jenkins-03

  1. For the Definition, you should select Pipeline script from SCM. For SCM you should select Git After adding your Repository URL, you also need to provide credentials if it is Private repository.

Jenkins-04

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


Jenkins-05

About

Example Jenkins integration with octomind

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published