Showing posts with label Artifactory. Show all posts
Showing posts with label Artifactory. Show all posts

Friday, November 10, 2023

How to Integrate Artifactory with Azure DevOps | Upload Artifacts from Azure DevOps YAML Pipelines to Artifactory | Artifactory and Azure DevOps Integration | Upload Java WAR file into Artifactory from Azure Pipelines

How to integrate Artifactory with Azure DevOps for uploading build artifacts?



Artifactory is one of the popular binary repository managers. It is Java based open source tool, used for storing build artifacts and docker images.

Some of the key features of Artifactory:
  • Supports 27 different package types including helm charts, docker images regardless of tech stack.
  • A single source of truth for all your binaries
  • Integration with all CICD tools
  • role based authorization with teams to manage artifacts 
  • you can create local, remote and virtual repositories
Pre-requisites:

We will automate building a Java project configured in GitHub and we will use Maven to build, package in Azure YAML pipeline and upload WAR file into Artifactory.

Steps to be followed to create a pipeline:

Create a Pipeline:
Login to your Azure Devops dashboard https://dev.azure.com


Go to Pipelines, Click New
select your SCM, in my case, Java Web App code is in GitHub.



Select the Java Repo, select Maven from the option. This will generate YAML file for us.

Add a task for uploading WAR file.
Click on Show assistant, search for generic and select JFrog Generic Artifacts


Choose Upload as command, choose service connection for Artifactory, enter *.war as pattern, enter repo name where artifact will be uploaded. Click on Add.


Now save the pipeline.. Run the pipeline

Azure DevOps YAML Pipeline Code

using the pipeline code we can automate build using Maven and upload WAR file into Artifactory

# Build your Java project using Maven and Upload WAR file to Artifactory

trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: Maven@3
inputs:
mavenPomFile: 'MyWebApp/pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
- task: JFrogGenericArtifacts@1
inputs:
command: 'Upload'
connection: 'Artifactory_svc_conn'
specSource: 'taskConfiguration'
fileSpec: |
{
"files": [
{
"pattern": "*.war",
"target": "libs-snapshot-local"
}
]
}
failNoOp: true

Now login to Artifactory..Click on Artifactory --> Artifacts. We can see the WAR file being uploaded.


This is how we can easily integrate Artifactory with Azure DevOps for uploading build artifacts.

Watch Steps in YouTube channel:

Sunday, October 8, 2023

How to Install JFrog Artifactory on Ubuntu | Setup JFrog Artifactory on Ubuntu | Install JFrog Artifactory 7.X on Ubuntu 22.0.4

Artifactory is one of the popular binary repository managers. It is Java based open source tool, used for storing build artifacts and docker images.

Some of the key features of Artifactory:
  • Supports 27 different package types including helm charts, docker images regardless of tech stack.
  • A single source of truth for all your binaries
  • Integration with all CICD tools
  • role based authorization with teams to manage artifacts 
  • you can create local, remote and virtual repositories



Artifactory can be integrated with many Continuous integration and Continuous delivery tools. Artifactory is mainly used by Ant, Maven and Gradle build tools. Let us see how to install Artifactory on Ubuntu 22.0.4 using Deb packages.

Pre-requisites:
  • VM needs to have at least 4GB RAM, for AWS choose at least medium instance type.
  • Default ports 8081 and 8082 needs to be opened. 8081 for Artifactory REST APIs. 8082 for everything else (UI, and all other product’s APIs).
Change Host Name to Artifactory
sudo hostnamectl set-hostname Artifactory

Update Ubuntu OS
sudo apt update

Add JFrog Artifactory APT repository
echo "deb https://releases.jfrog.io/artifactory/artifactory-debs xenial main" | sudo tee -a /etc/apt/sources.list.d/artifactory.list


Import repository GPG key by running the following commands
curl -fsSL  https://releases.jfrog.io/artifactory/api/gpg/key/public|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/artifactory.gpg

Update the package
sudo apt update

Install Artifactory
sudo apt install jfrog-artifactory-oss -y
The above message should confirm Artifactory have been successfully installed.
Now let us start Artifactory service.

Start Artifactory 
sudo systemctl start artifactory.service
Create symbolic link
sudo systemctl enable artifactory.service


Check whether Artifactory is running?
sudo systemctl status artifactory.service

Press q to quit 

You can also check the logs

sudo tail -f /var/opt/jfrog/artifactory/log/artifactory-service.log


Check if service is running locally on 8081 port

curl localhost:8081

Access Artifactory App
Go to browser and open public IP/DNS name along with port no:8081
http://your_public_dns_name:8081

You should see Artifactory welcome page, login with default username and password which is
admin/password



After Login, click on Get started. 

Now reset admin password. enter as Admin1234/Admin1234

Skip for base URL and skip proxy setup
Click Next, click on Finish


That's it! Artifactory is setup successfully.

How to Integrate Artifactory and Jenkins?
https://www.coachdevops.com/2020/04/integrate-artifactory-with-jenkins.html

You can watch the steps in details on our YouTube channel:
  

Thursday, February 2, 2023

How to create regular Artifactory Admin user in JFrog Artifactory? | How to create admin user in JFrog Artifactory?

Login to Artifactory server

Click on Tools--> User Management --> Users

Click on New user


Create an admin user 


Make sure you follow password policy as mentioned. Click on Save


that's it..that is how you create an admin user in Artifactory.

How to Integrate Artifactory with Jenkins | Upload Artifacts from Jenkins to Artifactory | Artifactory and Jenkins Integration

 How to Integrate Artifactory with Jenkins?

You can install plug-in called Artifactory plug-in to integrate Artifactory with Jenkins. Let us see how to integrate Jenkins with Artifactory and able to upload any binary file such as War/Ear/Jar/Exe/DLLs from Jenkins.

            go to Jenkins, Manage Jenkins, Click on Available plug-ins, type Artifactory. Click on Artifactory             and click install without restart


  • Configure Maven in Jenkins
Make sure Maven 3 is also configured under Manage Jenkins--> Global Tool configuration
Enter Name as Maven3
/usr/share/maven as MAVEN_HOME

Configure Artifactory in Jenkins:
1. Go to Manage Jenkins, Click on configure system. Look for JFrog section, click on Add JFrog Platform instance


2. Enter some name and Artifactory url like given below. Enter admin user name as ciadmin and admin password of ciadmin user you have configured.

You should get the message like below:



3. Once you configured Artifactory in Jenkins, let us integrate from our Jenkins job.

How to Integrate from Jenkins Job
1. Create a new free style job in Jenkins


2. Provide your repo details to check out the project you want to build

3. Go under Build environment
Select Maven 3 - Artifactory integration check box
and click on refresh Repositories and choose repos as mentioned below:

 4.Click on Add Build step and choose Invoke Artifactory Maven 3

5. Enter value as below, MyWebApp/pom.xml as root POM
and goal as install

6. Now click on Build, Jenkins should build using Maven and upload WAR file into Artifactory.

7. Login to Artifactory, Click on Artifactory --> Artifacts





That's it folks!

Please watch the steps in details in my YouTube channel:

Tuesday, January 31, 2023

How to Setup JFrog Artifactory using Docker-Compose | Install Artifactory using Docker Compose | Install Artifactory using Docker Compose on Ubuntu 18.0.4

How to setup Artifactory using Docker compose?

Artifactory is open source, binary repository manager. Artifactory is the single solution for managing all the artifacts, binaries, files and containers throughout your software supply chain. 

Some of the key features of Artifactory:
  • Supports 27 different package types including helm charts, docker images regardless of tech stack.
  • A single source of truth for all your binaries
  • Integration with all CICD tools
  • role based authorization with teams to manage artifacts 
  • you can create local, remote and virtual repositories
What is Docker Compose?
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. Since Docker Compose lets you configure related containers in a single YAML file, you get the same Infrastructure-as-Code abilities as Kubernetes. But they come in a simpler system that’s more suited to smaller applications that don’t need Kubernetes’ resiliency and scaling.
 
The purpose of docker-compose is to function as docker cli but to issue multiple commands much more quickly. To make use of docker-compose, you need to encode the commands you were running before into a docker-compose.yml file
 
Run docker-compose up and Compose starts and runs your entire app.

Watch the Steps in YouTube channel: 

Pre-requisites:
  • Ubuntu EC2 up and running with at least t2.medium (4GB RAM), 2GB will not work
  • Port 8081, 8082 is opened in security firewall rule
  • instance should have docker-compose installed

Change Host Name to Artifactory
sudo hostnamectl set-hostname Artifactory

Perform System update
sudo apt update

Install Docker-Compose
sudo apt install docker-compose -y

Create docker-compose.yml
this yml has all the configuration for installing Artifactory on Ubuntu EC2.
sudo vi docker-compose.yml 

(Copy the below code high-lighted in yellow color)
version: "3.3"
services:
  artifactory-service:
    image: docker.bintray.io/jfrog/artifactory-oss:7.49.6
    container_name: artifactory
    restart: always
    networks:
      - ci_net
    ports:
      - 8081:8081
      - 8082:8082
    volumes:
      - artifactory:/var/opt/jfrog/artifactory

volumes:
  artifactory:
networks:
  ci_net:

Save the file by entering :wq!

Now execute the compose file using Docker compose command to start Artifactory Container
sudo docker-compose up -d 

-d means detached mode

Make sure Artifactory is up and running
sudo docker-compose logs --follow


Once you see the message, that's it. Artifactory is been setup successfully. Now press Control C and enter to come out of the above screen.

Check Artifactory is up and running by typing below command:
curl localhost:8081
This confirms that Artifactory is up and running locally.

How to access Artifactory in the browser?

Now access Artifactory UI by going to browser and enter public dns name with port 8081
http://change to_artifactory_publicdns_name:8081

How to integrate Artifactory with Jenkins?

How to stop Artifactory container
sudo docker-compose down



Sunday, November 14, 2021

Integrate Artifactory with Jenkins - Upload Artifacts from Jenkins to Artifactory - How to Integrate Jenkins with Artifactory

How to Integrate Jenkins with Artifactory?

You can install Artifact plug-in to integrate Artifactory with Jenkins. Let us see how to integrate Jenkins with Artifactory and able to upload War/Ear/Jar files using Maven.



Pre-requisites:
Install Artifactory plugin in Jenkins.
go to Jenkins, Manage Jenkins, Manage plug-ins page, search for artifactory under available tab.

Make sure Maven 3 is also configured under Manage Jenkins--> Global Tool configuration
Enter Name as Maven3
/usr/share/maven as MAVEN_HOME

Configure Arifactory in Jenkins:
Once you successfully install Artifactory plug-in, 
1. Go to Manage Jenkins, Click on configure system. Look for JFrog section, click on JFrog Platform instance.
Enter some name for Instance_ID and enter Artifactory url like below:
http://public_dns_name:8081/artifactory
 


2. Click on Advanced configuration
Enter Artifactory URL again
http://public_dns_name:8081/artifactory

 and also distribution URL as below
http://public_dns_name:8081/distribution

3. Add Credentials Entry


Enter admin as username and enter Artifactory password as Admin123
Click on Test connection to verify everything is right.

4. Once you installed the above plug-in, click on existing Freestyle job configuration.
4. Go under Build environment
Select Maven 3 - Artifactory integration check box
and click on refresh Repositories and choose repos as mentioned below:


 5.Click on Add Build step and choose Invoke Artifactory Maven 3

6. Enter value as below, MyWebApp/pom.xml as root POM
and goal as install

7. Now click on Build, Jenkins should build using Maven and upload WAR file into Artifactory.

8. Login to Artifactory, Click on Artifactory --> Artifacts


Click on Builds to see the artifacts



That's it folks!