This integration allows your build jobs to deploy artifacts and resolve dependencies to and from Artifactory, and then have them linked to the build job that created them.
In order for Artifactory to be able to communicate with Jenkins we should install the Artifactory plugin. To achieve this, we should navigate to the Manage Jenkins tab. There, we should go to the Manage Plugins section. Here we have four options; Updates, Available, Installed and Advanced. In order to install Artifactory plugin, we should go to the Available tab, and search for it.
As you can see, my search ended with zero results. The reason for that is because I already installed the plugin before I recorded this video. To verify that, let’s go to the Installed tab. Here we can see that, indeed, Artifactory plugin is installed with version 3.8.1. The last tab is the Advanced tab. Here we can manually upload a plugin. Why would we want to upload a plugin manually? There are several possible reasons for that.
One of them, when using an environment that is not connected to the internet. For example, an air gap environment. In this case, we should download the plugin to the file system and then upload it manually to Jenkins, in order to install it. Once the plugin is installed successfully a JFrog section will be created in the Configure System section. Let’s look at it.
As you can see, we have two available options. In this video, we will focus only the Artifactory Servers option. Here we have four fields, four parameters, that we must fill for successful communication. The first is intended for future use, writing scripts, for example. In the second field, we should configure the URL we are connecting to. It is important to note that we should add the /Artifactory at the end. And the last one is the Credentials spot. As a result, we are expected to see our Artifactory version.
Now, all that is left is to see the interaction in action. To achieve this, we will use Jenkins to publish a build to Artifactory. Let’s create a new Jenkins pipeline job. Here we have multiple options to customize our build. For additional information you should visit the JFrog Wiki pages.
I have prepared a script in advance. Let’s paste it. Let’s go over the script content quickly. In the first section, I declared three parameters. To run Maven build with Artifactory from your pipeline script, you first need to create an Artifactory server instance. Hence, the first definition involves the Artifactory factory ID that I mentioned earlier. The next definition is an Artifactory Maven build instance. And the last one is the build information that has not yet been published to Artifactory, but it is stored locally in the building for instance.
The first stage defines the get repository we’re pulling from. You may find additional information on the JFrog GitHub page. The second stage defines where our build artifacts should be deployed to. Both repositories are located on the Artifactory server instance, we defined about. Let’s see it in Artifactory. The third stage defines the POM file path, which runs through Maven build and execute it. And the last, but not least, is publishing our build to Artifactory. Let’s find the build and see things in action.
Once the build process ended successfully, we will be able to see it in Artifactory.
This was my video on how to integrate Jenkins with Artifactory. Thank you for watching, and I hope you have enjoyed. Feel free to leave your comments, feedback, or questions in the comments section below.