There are SO many CICD platforms. It's pretty hard to figure out which one to use and which one will be right for you. That's why a lot of organizations use two. Just as an example: you can use Azure DevOps to queue an Octopus Deploy release. The primary reason is because simply, different CICD tools give different features and functions. Some do continuous integration better, some do continuous delivery better, some have better plugins, some have better test features, some maintain artifacts better.. the list goes on and on.
I have used a few CICD tools together. Azure DevOps/Jenkins, Jenkins/GitLabCI, and Azure DevOps/Octopus Deploy. In my experience it all depends on your use-case. Sometimes it may not be relevant to use two together. For example, I personally like the power that you get from the Azure DevOps PowerShell task over the Jenkins PowerShell plugin, so in that case I would use Azure DevOps to deploy PowerShell, but use Jenkins to build my artifact.
What will you be doing?
In this tutorial you're going to get a hands-on approach to queuing a Jenkins job from Azure DevOps. This queue will kick off one of your existing jobs that exist in Jenkins.
If you'd like to follow along, you should have:
- Azure DevOps organization and project
- Jenkins Server
- At least one job in Jenkins
Authentication from Azure DevOps to Jenkins
The first thing that's needed is the authentication from Azure DevOps to Jenkins. You will be setting up a service connection in Azure DevOps for the authentication method.
Creating the service connection
To create the service connection you'll need to go into the project in your Azure DevOps organization that you wish to build your release pipeline from. In my case, I'm going to use my CloudDev.Engineering project.
Searching for the Jenkins service connection
Click the gear icon on the bottom left of your project and go to Service connections, per the screenshot below.
Now that you're in service connections, the needed service connection type is Jenkins since you're interacting with a Jenkins server.
Within the service connection types, search for Jenkins. As shown in the screenshot below, choose the Jenkins service connection type.
Adding the Jenkins Service Connection
Click the blue Next button to start configuring the Jenkins service connection type.
Configuring the Jenkins Service Connection type
Now you can start doing the configuration of connecting/authenticating to a Jenkins server.
As shown in the screenshot below, start with the Server URL. The server URL is your Jenkins server URL.
The next section is for authentication. Type in a good username/password that has logon rights to the Jenkins Server. As shown in the screenshot below, once you type in a username/password, you can verify the authentication. If the verification works, the username/password are correct.
Finally you can add a connection name and a description. For the security section, this is really up to you. I'll allow the service connection to have the ability to be used in all of my pipelines. The screenshot below is what I put in for my details.
Click the blue Verify and save button once you're complete. You should now have a new service connection.
Creating the pipeline
Now that your authentication is completed and you have a service connection, the release pipeline can now be created.
Start creating your release pipeline
Head over to Pipelines ---> Releases to create a new release pipeline.
Start off with an empty job and don't worry about adding an artifact. Since the artifacts live in Jenkins for the purposes of this tutorial, it's not really necessary to add an artifact.
Name your stage anything you'd like. In my case, I named mine Dev per the screenshot below.
Head into the tasks within your stage.
Add the task
Next we can start adding our Jenkins task. Click the blue + button on the Agent job section and search for Jenkins. The specific one you want is Jenkins queue job. Add that task.
Configuring the Jenkins task
It's time to start configuring the task. Per the screenshot below, there will be two fields that we need to utilize.
- Jenkins server connection
- Job name
The service connection is what we created in the previous section Creating the service connection. For the job name, this is going to be the job name itself within Jenkins. For example, I'm going to use one in my Jenkins server called CSharpDemo1 per the screenshot below.
Below is a screenshot of the information that I put in for my task to give you an idea of what it should look like.
Creating and queuing the release
After you put in the Jenkins queue job task information, it's time to save and create the release. Click the blue Save button on top then after you save click the blue Create release button.
After you click the Create release button, you will be prompted with a Create a new release screen. Leave this all default and click the blue Create button on the bottom, per the screenshot below.
You should now see your release queued.
After your release has finished running, you now have a successful queue in your Jenkins server for the job.
In this blog post you took a hands-on approach of using two CICD platforms together, Azure DevOps and Jenkins. After the authentication and release pipeline was created, you were able to see a successful job queued within your Jenkins portal. Having the ability to use two different CICD platforms together is a game-changer in terms of having multiple features to use at once.
I'd like to end with a question. The question is: What is CICD to you? How do you use CICD today and how would you like to use CICD tomorrow? Do you feel that there are any improvements that can be made by using two different CICD platforms?