Migrate Jenkins CI from SVN to Git

Hoca Chen
3 min readJun 29, 2022

--

Photo by Yancy Min on Unsplash

This article address how to modify the Jenkins setting from SVN to Azure DevOps Git. The connection of Git is via SSH.

Step 1: Prepare the SSH key

In your local, type the “ssh-keygen” to create a new key.

in the generate process, I keep the “Enter passphrase (empty for no passphrase):” is empty

in the end, two keys will be generated to folder “C:\User\[User Name]\.ssh” (root\.ssh)

/root/.ssh/id_rsa -> this is private key

/root/.ssh/id_rsa.pub -> this is public key

Step 2: Setup the Azure SSH Public key

In the Azure DevOps page, navigate to the Repos page and click “Clone”.

Azure DevOps repos page

Click the Manage SSH Key

Prepare the Manage SSH Key

Click the “New Key”

Add new Key

Give the name and key, the name can be typed as what you need.

The public key data needs to provide content from “id_rsa.pub”. The beginning of the text is “ssh-rsa”. The content can copy from the “id_rsa.pub” file.

Prepare the SSH Key Data

Verify:

Now you can try to check out the code from Azure DevOps Repos via SSH.

$ git checkout <branch>

Step 2: Setup Jenkins request

In Jenkins, the plugin “Git plugin” needs to install.

Plugin in Jenkins

setup the Credentials in Jenkins

Navigate to “Manage Jenkins” and “Manage Credentials” in Security.

Navigate to “Add Credentials” to input a new credential key.

Add new Azure DevOps key

In Kind, please select “SSH Username with private key”.

Username can type what you want and copy the “private” key from the “id_rsa” file. The content beginning and end is

— — -BEGIN OPENSSH PRIVATE KEY — — -

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

— — -END OPENSSH PRIVATE KEY — — -

Now, you can prepare the project for Jenkins that different compare SVN is below

Repository URL: Copy the address from Rops of SSH address

Credentials: select that you just create

Branch: you can select what branch you want

Done

Hope this article can help if you need the same setup with me.

--

--

No responses yet