Pre-requisites: Jenkin build with published artifacts
Azure web app
- First we need to build up a connection between Jenkins server and Azure DevOps server. To do that, go to Azure DevOps service connections section in the projects settings page.
- Select Jenkins from the New service connection drop down list
-
Service connection window will open. Give the name for the service connection. Add the server URL, user name and password. Finally, click on verify connection to verify the connection.
-
So far, we have created the connection between Jenkins server and the Azure DevOps server. Now we can create a deployment pipeline to deploy the build artifacts in the Jenkins server. In this example, we are going to deploy the build artifacts in the build1 in the Jenkin server.In this Jenkins build, we are building a .NET Core web application and package it as a NuGet package using a nuspec file.
- Go to Azure DevOps pipelines.
- Create new empty pipeline.
- Click on Add an artifacts to select an artifact.We are going to deploy artifacts of the Jenkins build. So, select Jenkins from the artifacts section.
1 - Select the Jenkins as the artifact
2 – Select the service collection we have created
3 – Jenkins builds (jobs) will list here. Select the relevant Jenkins build from the list.
- After select the all details, click on Add to add the artifacts to the Azure DevOps deployment pipeline.
- In the deployment pipeline, we download the artifacts. Then extract the files.Finally deploy to the azure. Let’s identify these steps in details.
-
Download Jenkins build artifacts
1 - Select the Jenkins service connection
2 - Select the relevant Jenkins build(job)
3 - Give the location to download the artifacts
- Extract Files. We have created nupkg as our build artifacts in Jenkins. So, if we need to deploy this package using the Azure DevOps deployment pipeline, we need to extract the file before deploy to the Azure.
1 - Select the package from the downloaded artifacts
2 - Give the destination to copy the extracted file content
- Azure app service deploy
1 - Select the Azure subscription
2 - Select the app service type
3 - Select the app service name
4 - Select the extracted file location - Create a release.After release succeeded, go to azure app you have created. You would be able to see the application has deployed successfully.
This post explained how to create a connection between Jenkins and Azure DevOps servers. Further, we have discussed how to deploy the Jenkins build artifacts to Azure web app using Azure DevOps deployment pipeline
No comments:
Post a Comment