What do you someone breaks something? I post the solution here...

Kubernetes (K8s/K3d) / Terraform / Ansible / Linux / AWS / Docker / Bash / Python / ELK / CI/CD / Java / Traefik / Nginx / CentOs / Ubuntu


Managing Artifacts and Repositories with Sonatype Nexus

What is an Artifact?
The term artifact in connection with software development is largely associated with specific development methods or processes. An artifact occasionally may be used to refer to the released code (in the case of a code library) or released executable (in the case of a program) produced.

What is a Repository?
A collection of binary software artifacts and metadata stored in a defined directory structure which is used by clients such Maven, Mercury, or Ivy to retrieve binaries during a build process.

Repository Manager
A repository manager is a dedicated server application designed to manage repositories of binary components through the software development, quality assurance and production release lifecycle.
In addition, a repository manager can search software artifacts, audit development and release transactions, and integrate with external security systems such as LDAP. A repository manager is a powerful tool that encourages collaboration and provides visibility into the workflow which surrounds binary software artifacts.

Detailed description of the features of a repository manager include:
  • Management of Software Artifacts
  • Management of Software Metadata
  • Proxying of External Repositories
  • Deployment to Hosted Repositories
  • Searching an Index of Artifacts
  • Infrastructure for Artifact Management

Let's start with Sonatype Nexus OSS (open source)

Nexus Repository Manager requires a Java 8 Runtime Environment (JRE) from Oracle. The distributions for OSX and Windows include suitable runtime environments for the specific operating system. The distributions for Unix do not include the runtime environment.

1. Download the install-able zip from https://www.sonatype.com/download-oss-sonatype
    (OS X, Windows and Unix are the supported platforms, we'll use windows platform here)
2. Extract the zip and move the folder to appropriate installation location.
3. Go to '..\nexus-3.3.1-01-win64\nexus-3.3.1-01\bin' and run the 'nexus.exe /run' command to start nexus repository manager. (if everything goes fine you will be able to see 'Started Sonatype Nexus OSS' on Console)
4. Nexus web UI can be accessed on 'http://localhost:8081'.
5. The Default Username and Password are 'admin' and 'admin123' respectively.
 

How to create a Repository and Upload artifacts to it?

1. Login to Nexus web UI console and click on Repository Management icon.











2. Click on Repositories.














3. Click on Create Repository.



















Nexus supports different types of development artifacts including Docker images, npm modules,           
Maven packages and many more.

There are three kind of repositories: Hosted, Proxy and Grouped.

4. We don't have any specific Development artifact, so we will create Raw Repository.






























5. Provide the Repository Name (which will also be Identifier in Repository URL) and Deployment Policy. Click on Create Repository to finish the creation.
























6. Now we can see our Repository in Repository management window. Click on the Repository to open the detail pan.














7. Copy the Repository URL from Repository detail pan.

















8. Using Repository URL, we can Upload and Download the Artifacts. So lets upload a artifact to our Repository using 'Curl' command.
curl -v --user admin:admin123 --upload-file ./test_artifact.jpg http://localhost:8081/repository/test/

9. We can browse Assets of our Repository and can see if Artifact was uploaded successfully, Also we can copy the Asset path URL which can be used to download the Artifact.


No comments:

Powered by Blogger.