Jenkinsfile-basic 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!groovy
  2. // StarPU --- Runtime system for heterogeneous multicore architectures.
  3. //
  4. // Copyright (C) 2018 CNRS
  5. //
  6. // StarPU is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Lesser General Public License as published by
  8. // the Free Software Foundation; either version 2.1 of the License, or (at
  9. // your option) any later version.
  10. //
  11. // StarPU is distributed in the hope that it will be useful, but
  12. // WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. //
  15. // See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. //
  17. def statusHasChanged = false
  18. pipeline
  19. {
  20. agent none
  21. // Trigger the build
  22. triggers {
  23. // Poll gitlab explicitly every 15mn
  24. pollSCM('00-59/15 * * * *')
  25. }
  26. stages
  27. {
  28. stage('Tarball')
  29. {
  30. steps
  31. {
  32. node('autotools')
  33. {
  34. checkout scm
  35. sh 'contrib/ci.inria.fr/job-0-tarball.sh'
  36. script
  37. {
  38. env.tarballgz = sh (script: 'ls *.tar.gz', returnStdout: true).trim()
  39. }
  40. stash includes: "${env.tarballgz}", name: 'tarballgz'
  41. stash includes: "starpu.pdf", name: 'doc'
  42. // Stash those scripts because they are not in make dist
  43. dir('contrib/ci.inria.fr')
  44. {
  45. stash includes: "job-1-check.sh", name: 'script-unix-check'
  46. }
  47. archiveArtifacts artifacts: "${env.tarballgz},starpu.pdf", fingerprint: true, onlyIfSuccessful: true
  48. deleteDir()
  49. }
  50. }
  51. }
  52. stage('Check')
  53. {
  54. steps
  55. {
  56. script
  57. {
  58. labelToSelect = 'unix'
  59. listOfNodeNames = jenkins.model.Jenkins.instance.nodes.collect
  60. {
  61. node -> node.getLabelString().contains(labelToSelect) ? node.name : null
  62. }
  63. listOfNodeNames.removeAll(Collections.singleton(null))
  64. def p = listOfNodeNames.collectEntries
  65. {
  66. [ (it):
  67. {
  68. node(it)
  69. {
  70. dir('check-unix')
  71. {
  72. unstash 'tarballgz'
  73. unstash 'script-unix-check'
  74. sh 'chmod 755 job-1-check.sh && ./job-1-check.sh'
  75. deleteDir()
  76. }
  77. }
  78. }
  79. ]}
  80. parallel p;
  81. }
  82. }
  83. }
  84. }
  85. post
  86. {
  87. // hooks are called in order: always, changed, aborted, failure, success, unstable
  88. changed
  89. {
  90. echo "Build status has changed."
  91. script
  92. {
  93. statusHasChanged = true
  94. }
  95. }
  96. success
  97. {
  98. echo "Build success."
  99. // email when changed to success
  100. script
  101. {
  102. if (statusHasChanged)
  103. {
  104. emailext(body: '${DEFAULT_CONTENT}',
  105. subject: '${DEFAULT_SUBJECT}',
  106. replyTo: '$DEFAULT_REPLYTO',
  107. to: '$DEFAULT_RECIPIENTS',
  108. recipientProviders: [[$class: 'CulpritsRecipientProvider'],[$class: 'RequesterRecipientProvider']])
  109. }
  110. }
  111. }
  112. failure
  113. {
  114. echo "Build failure."
  115. // always email on failure
  116. emailext(body: '${DEFAULT_CONTENT}',
  117. subject: '${DEFAULT_SUBJECT}',
  118. replyTo: '$DEFAULT_REPLYTO',
  119. to: '$DEFAULT_RECIPIENTS',
  120. recipientProviders: [[$class: 'CulpritsRecipientProvider'],[$class: 'RequesterRecipientProvider']])
  121. }
  122. }
  123. }