DevOps Classroom notes 08/Dec/2024

Artifact Repositories

  • Artifact Repositories store the packages with history and versioning
  • For maintaining Artifacts, we have softwares such as
    • Artifactory/Jfrog
    • Nexus
    • Azure Artifacts
    • Github Packages
  • Artifact Repositories will have support for technologies
    • Maven
    • nuget (.net)
    • npm (node/java script)
    • pip (python)
    • apt
    • yum
    • docker registry
    • Generic
  • Jfrog cloud free trail. Refer classroom video for setup instructions
  • Jfrog supports uploading artifacts in pipelins from
    • jfrog cli
    • jfrog integrations:
      • Jenkins
      • Github Actions
      • Azure DevOps
      • ..
        Preview

Using Jfrog CLI

To deploy Maven artifacts to JFrog Artifactory using JFrog CLI, you can follow these steps. This approach allows you to manage your deployments efficiently without modifying your Maven pom.xml file.

Steps for Deploying Maven Artifacts Using JFrog CLI

1. Install JFrog CLI

First, ensure that you have JFrog CLI installed on your machine. You can download it from the JFrog website.

2. Configure Your Artifactory Server

Set up your Artifactory server details with the following command:

jfrog c add

You will be prompted to enter your Artifactory URL, username, and API key or password.

3. Set Up Your Project

Clone your Maven project repository and navigate to its root directory:

git clone https://github.com/jfrog/project-examples.git && cd project-examples/maven-example

4. Configure Maven Resolution and Deployment

Use the following command to configure the repositories for resolving dependencies and deploying artifacts:

jfrog rt mvn-config

During this configuration, specify the release and snapshot repositories where you want to deploy your artifacts.

5. Build and Deploy Artifacts

Instead of using the default Maven deploy plugin, you will use the following command to build and deploy your artifacts:

jfrog rt mvn clean install

This command will compile your project, run tests, and deploy the artifacts to the configured Artifactory repositories.

6. Publish Build Information (Optional)

If you want to publish build information to Artifactory after deployment, use:

jfrog rt bp <build-name> <build-number>

For example:

jfrog rt bp my-maven-build 1.0.0

Summary of Commands

Command Description
jfrog c add Configure Artifactory server details
jfrog rt mvn-config Set up Maven resolution and deployment repositories
jfrog rt mvn clean install Build and deploy artifacts
jfrog rt bp <build-name> <build-number> Publish build information

Additional Notes

  • You can add any Maven flags to the jfrog rt mvn command as needed.
  • This method keeps your deployment logic separate from your codebase, enhancing security by not exposing repository details in your pom.xml or code.

By following these steps, you can effectively manage your Maven deployments using JFrog CLI with Artifactory, streamlining your CI/CD processes without altering existing configurations significantly [1][2][4].

Citations:
[1] https://jfrog.com/blog/take-full-control-of-your-maven-deployments/
[2] https://stackoverflow.com/questions/75396095/jfrog-cli-maven-snapshot-and-release-deployments/75398637
[3] https://www.youtube.com/watch?v=yFBjopDjhQ0
[4] https://jfrog.com/help/r/get-started-with-the-jfrog-platform/step-3-add-maven-repositories-and-artifacts
[5] https://jfrog.com/help/r/jfrog-artifactory-documentation/maven-repository
[6] https://jfrog.com/help/r/jfrog-artifactory-documentation/deploying-artifacts
[7] https://github.com/jfrog/artifactory-maven-plugin

Integrating Azure DevOps with Jfrog

  • Official docs
  • Refer Here for reusable template created to build and publish into jfrog
  • Next Steps:

    • sonar cloud
    • Intro to Gitub Actions

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube