Continuous Integration using Jenkins and Git plugin
- Create a new Jenkins item as a ‘Pipeline’.
- Add ‘Git’ as branch source and give the Project repository url.
- Every time source code is pushed to the remote git repository from the local git repo;
- Jenkins job gets started(triggered).
- Jenkins build the code and the output is available under “console output”
- In the git repository add a ‘jenkinsfile’ commit and push the code to git repository.
- Add a Jenkinsfile in the git repository
pipeline {
agent { docker { image 'ubuntu:latest' } }
stages {
stage('build') {
steps {
sh 'uname -a'
}
}
stage('Test') {
steps {
sh './jenkins/scripts/test.sh'
}
}
}
}