As
we are aware Jenkins pipeline is set of the plugin which is used for implementation
and integration of the CI/CD process.
What is Continuous Integration?
Continuous Integration (CI) is a
development practice that requires developers to integrate code into a
shared repository several times a day. Each check-in is then verified by an
automated build, allowing teams to detect problems early.
What is Continuous Delivery?
Continuous delivery (CD) is a
software engineering approach in which teams produce software in short cycles,
ensuring that the software can be reliably released at any time and, when
releasing the software, doing so manually. It aims at building, testing, and
releasing software with greater speed and frequency.
So, In this
Blog we are going to learn how to create a Jenkins declarative pipeline using
Jenkinsfile.
In our
previous blogs we already have seen how to Create Continuous Build and Delivery
Pipeline in Jenkins.
Before Jumping
into Jenkins Configuration we first need to create Jenkinsfile with the list of
Dev-ops stages we want our build to pass through for e.g Build, Test, Deploy
etc.
In this blog I am using the below Jenkinsfile you can create your own Jenkinsfile with the list of Dev-ops stage you wanted to configure. To Know more about Jenkinsfile please click it over here.
For demo
purpose i have created one java program and for each commit, I will fetch all
the code from the source control system such as GIT then build, test and deploy
it.
To make sure
that this pipeline will trigger for each build commit we can push this
Jenkinsfile along with our project code in GIT or any other source code
repository.
To Create
Jenkins Pipeline using Jenkinsfile we need to follow the below process:
1) From the Jenkins Home Page, Manage
Jenkins-->Manage Plugin-->Install Pipeline declarative.
2) Now Click on Create
New item, Provide Jenkins Job Name, and Select Pipeline Project.
3) Now inside Pipeline Section, Select
Definition as pipeline Script from SCM
4) SCM as GIT and provide the path of
GIT Repository
5) Also, provide the Branch which we
want to build under Branches to build.
6) Under ScriptPath
Provide the path of Jenkinsfile.
7) Click on Apply and Save Job.
Now we would be able to view all the Dev-ops stages getting executed which we have configured in Jenkinsfile.
Can you tell how we can restrict input string parameters to one. No comma separated multiple parameters but restrict input just to one parameter.
ReplyHi Ankur,
ReplyMy name is Prasanjeet Singh. Currently, working at infosys with carrying 3.4 years of experience.
My question is:
If multiple developers are pushing the code on the same master branch in git what will it impact. How can we avoid the same. If this is possible then how?
Please reply to me
Thanks,
Prasanjeet Singh
victorsunny.85@gmail.com
8051017083,8296769356
Hi Prasanjeet,
ReplyUsually No developer push there code directly to Master Branch as it is production copy.Below is the process that needs to be followed e
every developer/tester needs to create there own feature branch (local copy) and work on that.Once this activity is completed and code reviewed internally all can push the code to our GITHUB branch created for that particular release.Normally in this process lot of internal GIT Review and approvals are required.Once this local GITHUB branch is tested sucesfully this complete code can be push to Master.
Hi Ankur,
ReplyWhich is the best branching strategy in git.
Cloning the existing branch or creating a new branch from master locally.
Can u suggest any recommendations on the above.
Hi Ankur, Do we have any pipeline script build and deployment for Front end applications written using ReactJS and backend applications using ruby ?
Reply