Hi guys,

I saw that at devoxx fr and it seems a great way of working with Jenkins.

So I’ve done some POC over the week end, following:
* https://jenkins.io/doc/
* https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md

Here are the features we could use:

* Commit a Jenkinsfile in the SCM (in each branch we use) —> Solves a big part 
of the issue of saving the jenkins setup + version it (we know who’s modified 
what and when and it’s in sync with the branches).
* Jenkins can automatically create jobs when a Jenkinsfile is noticed. So for 
example on my local machine I’ve configured a special job for the xwiki-contrib 
org on github and whenever a project there adds a Jenkinsfile, a job is created 
(and executed) on jenkins
* It’s very visual and very powerful. You program the jenkinsfile in groovy and 
you have a great DSL to control fully all the steps to execute.
* It’s possible to create some reusable libraries so that we don’t duplicate 
Jenkinsfile content across modules. I still need to finish my research on how 
to do that. There’s a readFile() API but I need to check how to package them so 
that they’re not on the FS.

For ex this is what I got locally:
* https://www.evernote.com/l/AHdeHR61ufBJxrWGIz6FOLtxvwdFf6LXBic
* With this simple jenkinsfile:

————
#!groovy

node (){
  stage "Checkout"
  env.PATH = "${tool 'Maven 3'}/bin:${env.PATH}"
  checkout scm
  stage "Build"
  def pom = readMavenPom()
  def projectName = pom.name
  def projectVersion = pom.version
  echo "Building ${projectName} - ${projectVersion}"
  sh 'mvn clean package'
  stage "Collect Results"
  step([$class: 'ArtifactArchiver', artifacts: '**/target/*.jar', fingerprint: 
true])
  try {
    step([$class: 'JUnitResultArchiver', testResults: 
'**/target/surefire-reports/TEST-*.xml'])
  } catch (all) {
  }
 }
————

Some examples:
* https://github.com/jenkinsci/pipeline-examples
* https://gist.github.com/chinshr/aa87da01ec28335e3ffd
* https://github.com/cloudbees/zendesk-java-client/blob/master/Jenkinsfile

Thanks
-Vincent

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to