Skip to content

Pipelines used for connecting Git repository and Docker with Jenkins.

License

Notifications You must be signed in to change notification settings

8Altair/Jenkins-pipeline-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenkins-pipeline-project

First pipeline

The first Jenkins pipeline is designed to perform the following steps:

  1. Check out code from a Git repository: The pipeline uses the checkout function to check out code from the specified Git repository. The repository URL is specified as an argument to the checkout function.

  2. Build the code using Maven: The pipeline uses the "sh" step to run the "mvn clean install" command, which will build the code using Maven. The tools directive at the beginning of the pipeline specifies that the MavenTool should be available to the pipeline.

  3. Build an image: The pipeline includes a build step that is named "ImagePipeline".

Overall, this Jenkins pipeline appears to be designed to build code from a Git repository and create an image using the resulting build artifacts.

Second pipeline

The second Jenkins pipeline appears to be designed to perform the following steps:

  1. Check out code from a Git repository: The pipeline uses the checkout function to check out code from the specified Git repository. The repository URL is specified as an argument to the checkout function.

  2. Build a Docker image: The pipeline uses the "sh" step to run the docker build command, which builds a Docker image based on the Dockerfile in the current directory. The image is given the name altair8/image_test:$BUILD_NUMBER, where $BUILD_NUMBER is a Jenkins environment variable that represents the current build number.

  3. Log in to Docker Hub: The pipeline uses the withCredentials directive to provide credentials to the docker login command, which logs in to Docker Hub using the specified username and password.

  4. Push the image to Docker Hub: The pipeline uses the "sh" step to run the docker push command, which pushes the previously built Docker image to Docker Hub.

  5. Log out of Docker Hub: The post directive specifies that the docker logout command should be run after all stages have completed. This logs out of Docker Hub.

Overall, this Jenkins pipeline is designed to build a Docker image from source code stored in a Git repository, log in to Docker Hub, push the built image to Docker Hub, and then log out of Docker Hub. The pipeline is written in the Jenkins Domain-Specific Language (DSL) and uses various Jenkins functions and directives to perform these tasks.

Third pipeline

The third Jenkins pipeline is designed to perform a conditional action based on the value of an "action" variable. The pipeline consists of a single stage called "Action" that contains a "parallel" block with two branches called "Branch 1" and "Branch 2."

The "parallel" block causes the "Branch 1" and "Branch 2" branches to be executed concurrently, rather than sequentially. Each branch contains a single step that uses a script block to check the value of the "action" variable and perform an action based on its value. If the value of "action" is "closed," the pipeline will trigger a build of a Jenkins job called "Pipeline 1" or "Pipeline 2," respectively. If the value of "action" is anything else, the pipeline will simply print the message "Opened."

The "agent any" directive at the beginning of the pipeline specifies that the pipeline should be executed on any available Jenkins agent. Jenkins agents are machines that are configured to run Jenkins jobs, and the "agent any" directive tells Jenkins to choose an available agent to execute the pipeline on. This is useful if you have a pool of agents with different capabilities and you want to allow Jenkins to choose the most appropriate one for the job.

The "parameters" block at the beginning of the pipeline defines the "action" variable as a string parameter that can be specified when the pipeline is run. This allows you to pass a value for the "action" variable to the pipeline either through the Jenkins UI or using the Jenkins CLI. The "defaultValue" and "description" attributes provide a default value for the parameter and a description of its purpose, respectively.

Overall, this Jenkins pipeline is designed to perform multiple actions concurrently based on the value of the "action" variable, using Jenkins agents to execute the pipeline. It can be triggered in various ways, such as manually, on a schedule, or in response to certain events, and can be parameterized to allow for flexibility and reuse.

About

Pipelines used for connecting Git repository and Docker with Jenkins.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published