Github Organization Plugin - Multiple Jenkins File

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Github Organization Plugin - Multiple Jenkins File

dockertry
Hi,
I am new to Github. I am trying to use the Github Organization Plugin to set
up my pipelines in Jenkins.
I am able to get the corresponding pipelines per branch in Jenkins. What I
do want to do is to set up multiple pipelines based off multiple JenkinsFile
in one branch.
For eg. I would have a JenkinsFile trigger a Develop Build..
           I would have a QA-JenkinsFile trigger a QA Build..
           I would have a Release-JenkinsFile trigger a Release Build..
Firstly, Is this doable? If not, is there an alternate solution that would
allow me to do something like this?
Thanks,




--
Sent from: http://jenkins-ci.361315.n4.nabble.com/Jenkins-users-f361316.html

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1506959861840-0.post%40n4.nabble.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Github Organization Plugin - Multiple Jenkins File

dandeliondodgeball
I think you can have a "build" variable (https://jenkins.io/doc/pipeline/tour/environment/), or parameter (below), and use the value assigned to that.  

Using parameters in a Jenkinsfile.  When this runs you will get an interactive window.

pipeline {
agent any
parameters {
string(name: 'Stack', defaultValue: 'Production', description: 'Which environment is this for?')
}
stages {
stage('Build') {
steps {
echo "Running BuilId [${env.BUILD_ID}] on JenkinsUrl [${env.JENKINS_URL}] for Job [${env.JOB_NAME}]"
//
sh "<something> <something> ${params.Stack} buildIt"


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a5dbe640-eaab-48c2-8a52-1d24135a8b08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Github Organization Plugin - Multiple Jenkins File

dandeliondodgeball
In reply to this post by dockertry
I think the most common solution is to have one Jenkinsfile (per branch), and manage everything from that.  

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7e3bfb8f-f8dc-475e-8f9b-3de85de66498%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Github Organization Plugin - Multiple Jenkins File

Robert Hales
In reply to this post by dandeliondodgeball
I agree with this answer. With a pipeline, it is so easy to make logic decisions and much easier to maintain a single Jenkinsfile that has all the logic. There is surely going to be some duplicated logic, so now only the special differences have to be handled, and you don't duplicate code across the Jenkinsfiles. I have taken several other peoples jobs and consolidated them exactly like this, with just a parameter. If you have 3 different pipeline files, but all in the same branch, then things get complicated when you try to decide which build should be triggered from polling or a hook, anyway. You might as well put it all in one place and handle the logic there. 

On Monday, October 2, 2017 at 1:23:43 PM UTC-6, dandeliondodgeball wrote:
I think you can have a "build" variable (<a href="https://jenkins.io/doc/pipeline/tour/environment/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fdoc%2Fpipeline%2Ftour%2Fenvironment%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEDdIR0VDXrTjLqBC_I-kqBrzQ1IQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fdoc%2Fpipeline%2Ftour%2Fenvironment%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEDdIR0VDXrTjLqBC_I-kqBrzQ1IQ&#39;;return true;">https://jenkins.io/doc/pipeline/tour/environment/), or parameter (below), and use the value assigned to that.  

Using parameters in a Jenkinsfile.  When this runs you will get an interactive window.

pipeline {
agent any
parameters {
string(name: 'Stack', defaultValue: 'Production', description: 'Which environment is this for?')
}
stages {
stage('Build') {
steps {
echo "Running BuilId [${env.BUILD_ID}] on JenkinsUrl [${env.JENKINS_URL}] for Job [${env.JOB_NAME}]"
//
sh "<something> <something> ${params.Stack} buildIt"


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7c332a1e-9531-4a0b-b63c-db48ee5e278a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.