This repository contains a Jenkins Shared Library that provides reusable Groovy scripts for various CI/CD tasks. These scripts are designed to streamline the development and deployment processes within a Jenkins pipeline.
- Purpose: Allows waiting for a Quality Gate status without aborting the pipeline.
- Usage:
QualityGateStatus(credentialsId)
- Purpose: Builds a Docker image based on provided project, image tag, and Docker Hub username.
- Usage:
dockerBuild(project, ImageTag, hubUser)
- Purpose: Cleans up a Docker image based on provided project, image tag, and Docker Hub username.
- Usage:
dockerImageCleanup(project, ImageTag, hubUser)
- Purpose: Pushes a Docker image to a Docker registry (e.g., Docker Hub) after logging in with provided credentials.
- Usage:
dockerImagePush(project, ImageTag, hubUser)
- Purpose: Performs a vulnerability scan on a Docker image using Trivy.
- Usage:
dockerImageScan(project, ImageTag, hubUser)
- Purpose: Checks out a specific branch from a Git repository.
- Usage:
gitCheckout(stageParams)
- Purpose: Pushes a JAR artifact to JFrog Artifactory.
- Usage:
jarPushJFrog()
- Purpose: Builds a Maven project while skipping tests.
- Usage:
mvnBuild()
- Purpose: Runs integration tests for a Maven project while skipping unit tests.
- Usage:
mvnIntegrationTest()
- Purpose: Runs unit tests for a Maven project.
- Usage:
mvnTest()
- Purpose: Performs static code analysis using SonarQube.
- Usage:
statiCodeAnalysis(credentialsId)
You can add this line in the "How to Use" section of your README, right after the instructions for configuring Jenkins to use the shared library. Here's how you can incorporate it:
- Clone this repository to your Jenkins server or to a location accessible by your Jenkins pipeline.
- Configure Jenkins to use this repository as a Shared Library.
- Ensure that the Jenkinsfile in your project references this Shared Library. If you're using the example repository java-docker-build-pipeline, it already utilizes this Shared Library. Otherwise, make necessary adjustments to your Jenkinsfile to incorporate the library's scripts.
- Utilize the provided scripts in your Jenkins pipelines by calling them with the appropriate parameters.