0% found this document useful (0 votes)
3 views3 pages

Jenkins GitHub Pipeline Setup Guide

Uploaded by

24202014
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Jenkins GitHub Pipeline Setup Guide

Uploaded by

24202014
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PROGRAM 2: JENKINS PIPELINE FOR GITHUB INTEGRATION

Algorithm:

Step1: Open Jenkins Dashboard:

● Access your Jenkins server through your web browser.

Step2: Create a New Pipeline Job:

● Click on "New Item" from the Jenkins dashboard.


● Enter a name for your new pipeline job.
● Select "Pipeline" and click "OK".

Step3: Configure Pipeline Job:

● In the pipeline configuration page, scroll down to the "Pipeline" section.


● Select "Pipeline script" and paste your pipeline code into the script area.

Step4: Save the Job:

● Click on "Save" at the bottom of the configuration page.

Step5: Run the Pipeline Job:

● From the pipeline job page, click on "Build Now" to start the pipeline.
● The job will be added to the build queue and will start executing.

Step6: Monitor the Pipeline:

● Click on the build number under the "Build History" to view the console output.
● Monitor each stage's output to ensure the pipeline is running correctly.

Pipeline Stage

Checkout Stage:

● This stage checks out the code from the specified Git repository and branch.

Build Stage:

● This stage contains build steps. You can replace the echo 'Building...' with actual
build commands, such as sh 'make'.
Test Stage:

● This stage contains test steps. You can replace the echo 'Testing...' with actual
test commands, such as sh 'make test'.

Deploy Stage:

● This stage contains deployment steps. You can replace the echo 'Deploying...'
with actual deploy commands, such as sh 'make deploy'.

Post Actions:

● The post section defines actions to take after the pipeline run, such as printing a
success or failure message.

PIPELINE CODE:
pipeline {
agent any
stages {
stage('Checkout') {
steps {
// Checkout code from Git repository
git url: '[Link] branch: 'main'
}
}
stage('Build') {
steps {
// Example build step, replace with your build commands
echo 'Building...'
// sh 'make' // Uncomment and replace with your build command
}
}
stage('Test') {
steps {
// Example test step, replace with your test commands
echo 'Testing...'
// sh 'make test' // Uncomment and replace with your test command
}
}
stage('Deploy') {
steps {
// Example deploy step, replace with your deploy commands
echo 'Deploying...'
// sh 'make deploy' // Uncomment and replace with your deploy command
}
}
}
post {
success {
echo 'Pipeline completed successfully!'
}
failure {
echo 'Pipeline failed!'
}
}}

OUTPUT:

You might also like