I am very new to Jenkins.
There are multiple jobs already configured in Jenkins, As of now we are running all the jobs manually one after the other. I want to make it a single job by pipeline plugin, So that manual effort is reduced.
I had gone through the links, It states we should have JenkinsFile in our repository it basically contains command's to execute the different tasks.
But if i am configuring it in JenkinsFile how can give the existing job names ?
Is it the only way to do a pipeline or is there any other way to achieve this ?
Ex : I have three jobs
I would like to pipeline all the three jobs,
deploy-stage-ci
So that it contains all the 3 above mentioned jobs.
You don't always need a Jenkinsfile to use Pipeline. In your Pipeline job, choose "Pipeline Script" from the dropdown to get a script editor. To build your three jobs sequentially, in a pipeline, use the following script (using names from your example). It simply wraps each job in a stage and builds it.
Create Multibranch Pipeline on Jenkins (Step by Step Guide) Step 1: From the Jenkins home page create a “new item”. Step 2: Select the “Multibranch pipeline” from the option and click ok. Step 3: Click “Add a Source” and select Github.
In your Pipeline job, choose "Pipeline Script" from the dropdown to get a script editor. To build your three jobs sequentially, in a pipeline, use the following script (using names from your example). It simply wraps each job in a stage and builds it.
Step 1: From the Jenkins home page create a “new item”. Step 2: Select the “Multibranch pipeline” from the option and click ok. Step 3: Click “Add a Source” and select Github. Step 4: Under the credentials field, select Jenkins, and create a credential with your Github username and password.
You don't always need a Jenkinsfile to use Pipeline. In your Pipeline job, choose "Pipeline Script" from the dropdown to get a script editor.
To build your three jobs sequentially, in a pipeline, use the following script (using names from your example). It simply wraps each job in a stage and builds it. This will also give you a pretty stage view while it runs your jobs:
stage('Build') {
build 'build-dev-code'
}
stage('Test') {
build 'test-dev-code'
}
stage('Deploy') {
build 'deploy-stage'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With