I got a use case to run Jenkins jobs through vRA code stream and publish it as a cataloge item. In this post I’ll discuss about Code Stream and how to integrate Jenkins as a Endpoint in Code Stream and create a Pipeline.
Code Stream provides a Jenkins plug-in, which triggers Jenkins jobs that build and test your source code. The Jenkins plug-in runs test cases and can use custom scripts.
To run a Jenkins job in your pipeline, you use a Jenkins server, and add the Jenkins endpoint in Code Stream. Then, you create a pipeline and add a Jenkins task to it.
When you use the Jenkins task and a Jenkins endpoint in Code Stream, you can create a pipeline that supports multi-branch jobs in Jenkins. The multi-branch job includes individual jobs in each branch of a Git repository. When you create pipelines in Code Stream that support multi-branch jobs:
- The Jenkins task can run Jenkins jobs that reside in multiple folders on the Jenkins server.
- You can override the folder path in the Jenkins task configuration so that it uses a different folder path, which overrides the default path defined in the Jenkins endpoint in Code Stream.
- Multi-branch pipelines in Code Stream detect Jenkins job files of type.groovy in a Git repository or a GitHub repository, and start creating jobs for each branch that it scans in the repository.
- You can override the default path defined in the Jenkins endpoint with a path provided in the Jenkins task configuration and run a job and pipeline that is associated with any branch inside a main Jenkins job.
- Set up a Jenkins server that runs version 1.561 or later.
- Verify that you are a member of a project in Code Stream. If you are not a member, ask a Code Stream administrator to add you as a member of a project.
- Verify that a job exists on the Jenkins server so that your pipeline task can run it.
- Go to Code Stream àConfigure àEndpoints and click on NEW ENDPOINT
- Select Project, type as Jenkins, give a Name to endpoint, give Jenkins URL, username and Password (for password you have to create variable, click on create variable and put name and value and click Create. ). Folder path is optional if you have jobs in specific folder in Jenkins give the folder name.
- Once all the value are filled click on validate to verify the details. Upon successful verification click create to create the endpoint.
- Once Endpoint created it will show as below in endpoint.
Now we have our endpoint integrated to code steam, we will create a Job to run our Jenkins job.
- Go to Code Stream à Pipelines àNEW PIPELINE and click on Blank Canvas
- Select project and give you pipeline a name.
- Click on Stage0 à Sequential task
- Give you task a name, select task type as Jenkins and select your endpoint created earlier.
- From the drop-down menu, select a job from the Jenkins server that your pipeline will run.
- Enter the parameters for the job.
- Enter the authentication token for the Jenkins job.
- Validate your task by clicking on VALIDATE TASK
- Once validated successfully click on Save button to save the task
- Then go to Action and Enable the task.
- To run the job, go to Actions and click on Run.
- From Actions àView execution we can see the execution status.
- Click on the execution name to see more details of the execution status. You can see the last execution was successful.
That’s it from this post. I hope you like it and share if you think it’s worth sharing.
In my next post I will demonstrate how to release a Code Stream job and publish as cataloge Item.
2 thoughts on “vRealize Automation 8 Code Stream- Integrate Jenkins as Endpoint and create CI/CD Job”
Do objects that get created show under Deployments for a project?
No under deployment you will only see execution, but if you will click on you specific deployment you can see detail from here.