Skip to content

Madhanchinna/DevOps-Pipeline_with_Jenkins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipeline Project

This repository contains a pipeline project that demonstrates the CI/CD (Continuous Integration/Continuous Deployment) process using Jenkins and Docker. The project includes a Jenkinsfile, Dockerfile, and several supporting scripts.

Jenkinsfile

The Jenkinsfile defines the stages of the pipeline, which are as follows:

  1. Build: This stage compiles and packages the Java application using Maven. The built artifacts are archived for later use.

  2. Test: This stage runs the unit tests for the Java application using Maven and generates test reports using JUnit.

  3. Push: This stage pushes the Docker image to a registry using the provided push.sh script. The image is tagged and pushed to the registry.

  4. Deploy: This stage executes the deployment script deploy.sh, which can be customized to deploy the application to a remote machine.

Dockerfile

The Dockerfile is used to build the Jenkins environment with necessary dependencies. Here's an overview of the steps:

  1. The base image is jenkins/jenkins.

  2. Python 3 and Ansible are installed using pip.

  3. Docker is installed, including Docker Compose.

  4. The Jenkins user is added to the docker group to enable Docker commands within Jenkins.

Scripts

The repository includes several scripts used in the pipeline:

  • jenkins/build/build.sh: This script copies the built JAR file and builds the Docker image using the provided docker-compose-build.yml file.

  • jenkins/build/mvn.sh: This script facilitates Maven execution within a Docker container to build the Java application.

  • jenkins/build/docker-compose-build.yml: This configuration file defines the Docker Compose build process for the Java application.

  • jenkins/deploy/deploy.sh: This script executes deployment-related actions, such as copying authentication credentials and running the publish script on a remote machine.

  • jenkins/deploy/publish: This script can be customized to define the deployment steps specific to your environment.

  • jenkins/push/push.sh: This script handles the Docker image pushing process, including tagging and pushing the image to the Docker registry.

  • jenkins/test/mvn.sh: This script enables Maven testing within a Docker container.

Usage

To use this pipeline project:

  1. Set up a Jenkins server with the required plugins and configurations.

  2. Create a new pipeline job in Jenkins and configure it to link to your Git repository.

  3. Copy the content of the Jenkinsfile into your pipeline job configuration.

  4. Copy the Dockerfile and other scripts to the appropriate locations on your Jenkins server.

  5. Customize the scripts as needed for your specific project and environment.

  6. Build and run the pipeline job in Jenkins to trigger the pipeline stages.

Make sure to configure any necessary credentials or environment variables for the pipeline stages to work correctly.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Feel free to explore and adapt this pipeline project according to your requirements. Happy pipeline building! happy learing

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published