Hello Dear DevOps/DevSecOps engineers and automation team members. Today we will experiment on JFrog Artifactory integration with Jenkins. To do this we need to break down the task into two phases in the first phase we will do JFrog Artifactory setup. after that next phase we will do integrate it in Jenkins.
Pre-requisites:
- Virtual Boxes or VM instance on the Cloud is the basic requirements
On the AWS Cloud: An AWS t2.small EC2 instance (Linux) if other cloud please select at least 2GB RAM providing instance. Open port 8081 and 8082 in the Security Group or on the firewall allow ports.
Vagrant boxes for Jenkins and jfrog artifactory
# Ubuntu boxes for Jenkins and Jfrog Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |vb| vb.memory = "4096" end config.vm.define "master" do |master| master.vm.box = "ubuntu/focal64" master.vm.network "private_network", ip: "192.168.33.100" master.vm.hostname = "master.vybhava.com" end config.vm.define "jfrog" do |jfrog| jfrog.vm.box = "ubuntu/focal64" jfrog.vm.network "private_network", ip: "192.168.33.110" jfrog.vm.hostname = "jfrog.vybhava.com" end end
2. The 'master' box intended to have installed with latest Jenkins on it.
3. The other box jfrog instance we need to install the JFrog Artifactory.(Below section dedicated for installation of JFrog Artifactory)
4. You must have GitHub account setup ready for this experiment
5. Jenkins Plugins we must install -- deploy artifacts, Artifactory
JFrog Artifactory integration with Jenkins CI/CD |
What is JFrog Artifactory all about?
JFrog Artifactory is the single solution for housing and managing all the artifacts, binaries, packages, files, containers, and components for use throughout your software supply chain.
Why JFrog?
- It's Frictionless
- unified management of your software supply chain artifacts
Benefits of JFrog
- Binary lifecycle management
- Global scale availability
- Package proxying
- Secured Binaries
- Repository optimization and flexibility
- artifacts delivery to the edge (CDN, PDN)
How to install JFrog Artifactory 7 on Ubuntu?
In the following we do step-by-step installation on and configure JFrog.
Step 1: Install Java
Login to EC2 Ubuntu instance and switch user as a root user and check for Java if it is not exists then install Java as mentioned below
java -version #Check JDK availability # If not install JDK # for RHEL/CentOS yum install java-1.8* -y # for Ubuntu apt install -y openjdk11 # confirm it java -version
Step 2: Create jfrog user
Best practice to have a dedicated user as 'jfrog' for security purpose isolating with other users data should not have any issues during their clean up process.sudo useradd -m -d /opt/jfrog -U -s /bin/false jfrog id jfrog
Step 3: Download and Extract JFrog Artifactory
cd /tmp; wget tar.gz option download the file.
apt install -y unzip #Generally on AWS Ubuntu you need to install unzip utility # JFrog 6.x sudo unzip jfrog*.zip "artifactory-oss-6.23.3" -d "/opt/jfrog" sudo chown -R jfrog:jfrog /opt/jfrog/ sudo chmod -R u+x /opt/jfrog/bin # JFrog 7.x sudo tar xzvf jfrog*tar.gz -C /opt/jfrog --strip-components=1 sudo chown -R jfrog:jfrog /opt/jfrog/ sudo chmod -R u+x /opt/jfrog/app/bin
Go inside JFrog installed path then go to the bin directory and start the services
cd /opt/jfrog/bin ./artifactory.sh startJFrog Artifactory 6.x running on the Ubuntu as normal Tomcat embedded server start command as shown below.
Jfrog Artifactory 6 start command execution |
JFrog after extraction of the installer file |
[Unit] Description=Setup Systemd script for Artifactory in Tomcat Servlet Engine After=network.target [Service] Type=forking GuessMainPID=yes Restart=always RestartSec=5 PIDFile=/var/opt/jfrog/run/artifactory.pid ExecStart=/opt/jfrog/artifactory/bin/artifactoryManage.sh start ExecStop=/opt/jfrog/artifactory/bin/artifactoryManage.sh stop User=artifactory Group=artifactory LimitNOFILE=32000 [Install] WantedBy=multi-user.target Alias=artifactory.service
Reload the systemd daemon so that it becomes aware of the new service:
sudo systemctl daemon-reload
You can then start the artifactory service by typing:
sudo systemctl start artifactoryCheck the status using :
sudo systemctl status artifactory
To enable artifactory at the time of starting up box with the systemd, run the following command:
sudo systemctl enable artifactory
Step 4: Access JFrog Artifactory URL
http://JFROGPUBLICIP:8081
JFrog Artifactory Welcome Screen |
Reset the Artifactory Credentials |
Now we all set for the Artifactory use in the Jenkins. In the left side select Artifact Repository browser choose the build info.
Jenkins Artifactory integration
Navigate to Manage plugin in the availability tab search for "Artifactory" and in the bottom click on the "Install it without re-start".
How to Configure system - JFrog Artifactory in Jenkins?
JFrog Artifactory Configuration in Jenkins |
Create Job for Archive Artifacts
- You can choose an existing or a new Freestyle job configuration. Here I've chosen new with name "ArchiveArtifacts-Free"
- In the Source code management section Chose Git and enter the GIT URL as per your project needs
- Go under Build Environment section Select Maven3-Artifactory Integration, You need to confirm the Artifactory server details and provide the local repository details that depends on Release repo or Snapshot repo names.
- In the Build section Invoke Artifactory Maven3 and under that Chose Goals: clean install
- Save the configuration and click on the "Build Now" to execute this job
No comments:
Post a Comment