Hi, You can try something like this to get started:
def gitUrl = "https://github.com/twisted/twisted.git" def gitBranch = "trunk" node { stage "Check out from Git" git branch: "$gitBranch", url: "$gitUrl" stage "Build code" sh "sudo -Hs build_tool arg1 $gitUrl subproject_a $gitBranch" } I would recommend going further. Make your Pipeline job parameterized. Add a parameter GIT_BRANCH, and set the default value of that to the branch you want to build in that specific job. def gitUrl = "https://github.com/twisted/twisted.git" def gitBranch if (getBinding().hasVariable("GIT_BRANCH")) { gitBranch = GIT_BRANCH } node { stage "Check out from Git" git branch: "$gitBranch", url: "$gitUrl" stage "Build code" sh "sudo -Hs build_tool arg1 $gitUrl subproject_a $gitBranch" } You can add more build parameters as you need. -- Craig On Fri, Jun 10, 2016 at 8:40 AM, Jerry Steele <[email protected]> wrote: > Hello, > > I'm looking into getting Jenkins to build feature branches for our github > projects, but I'm not entirely sure where to start. Pipeline looks like it > might fit the bill, but I'm having trouble getting my head round the > Jenkinsfile. I've found the online docs and the "Groovy" generator but am > not really sure how to tie it all together. If anyone has a bit oftime to > help me, that would be great :) > > We currently use our own build tool to test code as deployed to github, > then build the artifacts into a debian package which is uploaded to Amazon > S3 and deployed by hand later. > > We currently have separate jobs for each of the major branches of our > project: > > subproject_a-qa > subproject_a-staging > subproject_a-production > > subproject_b-qa > subproject_b-staging > subproject_b-production > > subproject_c-qa > subproject_c-staging > subproject_c-production > > The jobs are very simple - they poll github, looking at a specific branch, > then if that has changed, they will execute a shell script which looks like > this (generic): > > sudo -Hs build_tool arg1 $GIT_URL <subproject_a> <environment(qa/staging/ > prod)> > > So, what I'd need is something that builds the following jobs when a > feature branch is pushed to look something like: > > sudo -Hs build_tool arg1 $GIT_URL <subproject_a> <feature_branch_name> > sudo -Hs build_tool arg1 $GIT_URL <subproject_b> <feature_branch_name> > sudo -Hs build_tool arg1 $GIT_URL <subproject_c> <feature_branch_name> > > Or else, know how to build those. > > Is this possible with Pipeline? Or am I looking at the wrong tool here? > I've started a multibranch test project, but am basically stuck at the > Jenkinsfile stage, and most tutorials appear to refer to using mvn, which > I'm not familiar with. the build tool is written in Python and is testing > building for Ruby on Rails :) > > Any help very much appreciated. Any more info needed, please let me know... > > Thanks > > Jerry > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAG%3DrPVcHvoExjTDciveK%3DjF%3DtmCHEQASxZ%3DANXwUy2O4MLn4aw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
