Published on

GitHub Action: Maven using JF CLI to create jar package, buildInfo, RBv2

Introduction

Welcome back! In today's article, we will explore how to use JFrog CLI in conjunction with GitHub Actions to create a JAR package from a Spring Boot project, specifically the Spring Pet Clinic. This guide will provide a comprehensive walk-through, covering everything from creating a GitHub action to running a Maven build pipeline.

Creating the GitHub Action

To start, you should have your GitHub repository set up with a Spring Boot project, like our Spring Pet Clinic application. We will trigger the GitHub action when a comment is made on an issue. This approach allows for easy manual triggering without the need for a push action.

Configuring the Pipeline

The GitHub Action is defined in a YAML file located in the .github/workflows directory of your repository. The primary components of this file include:

  1. Triggers: We set up the action to trigger whenever a comment is made.
  2. Permissions: Specifying required permissions for the action.
  3. Environment Setup: Configuring to use an Ubuntu environment with Java 17, as required by Spring Boot.

Build Execution

When a comment is made, the GitHub action starts running. In our case, we observe the following:

  • The action starts and is assigned a job number.
  • The job will build the project, perform necessary configurations, and package the application.

During the build, JFrog CLI is employed to handle artifact management. JFrog CLI is installed on an Ubuntu image and configured correctly to use Java 17.

Using JFrog CLI

  1. Installation: JFrog CLI is installed using the standard procedures for Ubuntu.
  2. Configuration: After installation, the CLI is configured with necessary parameters and environment variables.
  3. Build Process: The pipeline includes steps to create a JAR package using Maven commands and performs an X-Ray scan for security vulnerabilities.

Build Promotion

The created artifacts are promoted through various environments, such as Development (Dev) and Quality Assurance (QA). This process ensures that every step in your CI/CD pipeline maintains quality checks.

Consolidated Overview

We're able to capture essential metadata during the build, such as build numbers and VCS information from GitHub. This data is invaluable for tracking builds and understanding their history. Integration with GitHub allows easy access to the action history and context for each build.

Conclusions and Future Work

The integration between GitHub Actions and JFrog CLI streamlines the build and deployment process, allowing for effective artifact management. In future articles, we will explore Docker images and other aspects of DevOps pipelines. Stay tuned for more insightful content!


Keywords

GitHub Actions, JFrog CLI, Maven, JAR package, Spring Boot, CI/CD, build pipeline, artifact management, DevOps, Spring Pet Clinic.


FAQ

Q1: What is GitHub Actions?
GitHub Actions is a CI/CD tool that allows developers to automate tasks within their GitHub repositories.

Q2: What is JFrog CLI used for?
JFrog CLI is a command-line tool for interacting with JFrog Artifactory, enabling users to manage artifacts and automate workflows.

Q3: How do you trigger a GitHub Action?
A GitHub Action can be triggered by various events such as push, pull request, or comments on issues.

Q4: What is the significance of using Java 17 for Spring Boot projects?
Java 17 is a Long-Term Support (LTS) version that ensures compatibility and access to the latest language features.

Q5: Can I integrate JFrog CLI with other CI/CD tools?
Yes, JFrog CLI can be integrated with various CI/CD tools, including Jenkins, CircleCI, and others.