Jenkinsfile 881 B

12345678910111213141516171819202122232425262728293031323334
  1. wrappedNode(label: 'linux && x86_64') {
  2. deleteDir()
  3. checkout scm
  4. def image
  5. try {
  6. stage "build image"
  7. image = docker.build("dockerbuildbot/libcompose:${gitCommit()}")
  8. stage "validate"
  9. makeTask(image, "validate")
  10. stage "test"
  11. makeTask(image, "test", ["TESTVERBOSE=1", "DAEMON_VERSION=all"])
  12. stage "build"
  13. makeTask(image, "cross-binary")
  14. } finally {
  15. try { archive "bundles" } catch (Exception exc) {}
  16. if (image) { sh "docker rmi ${image.id} ||:" }
  17. }
  18. }
  19. def makeTask(image, task, envVars=null) {
  20. // could send in the full list of envVars for each call or provide default env vars like this:
  21. withEnv((envVars ?: []) + ["LIBCOMPOSE_IMAGE=${image.id}"]) { // would need `def image` at top level of file instead of in the nested block
  22. withChownWorkspace {
  23. timeout(60) {
  24. sh "make -e ${task}"
  25. }
  26. }
  27. }
  28. }