Jenkinsfile-basic 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. {
  24. // Poll gitlab explicitly every 15mn
  25. pollSCM('00-59/15 * * * *')
  26. }
  27. stages
  28. {
  29. stage('Tarball')
  30. {
  31. steps
  32. {
  33. node('autotools')
  34. {
  35. checkout scm
  36. sh 'contrib/ci.inria.fr/job-0-tarball.sh'
  37. script
  38. {
  39. env.tarballgz = sh (script: 'ls *.tar.gz', returnStdout: true).trim()
  40. }
  41. stash includes: "${env.tarballgz}", name: 'tarballgz'
  42. stash includes: "starpu.pdf", name: 'doc'
  43. // Stash those scripts because they are not in make dist
  44. dir('contrib/ci.inria.fr')
  45. {
  46. stash includes: "job-1-check.sh", name: 'script-unix-check'
  47. }
  48. archiveArtifacts artifacts: "${env.tarballgz},starpu.pdf", fingerprint: true, onlyIfSuccessful: true
  49. deleteDir()
  50. }
  51. }
  52. }
  53. stage('Check')
  54. {
  55. steps
  56. {
  57. script
  58. {
  59. labelToSelect = 'unix'
  60. listOfNodeNames = jenkins.model.Jenkins.instance.nodes.collect
  61. {
  62. node -> node.getLabelString().contains(labelToSelect) ? node.name : null
  63. }
  64. listOfNodeNames.removeAll(Collections.singleton(null))
  65. def p = listOfNodeNames.collectEntries
  66. {
  67. [ (it):
  68. {
  69. node(it)
  70. {
  71. dir('check-unix')
  72. {
  73. unstash 'tarballgz'
  74. unstash 'script-unix-check'
  75. sh 'chmod 755 job-1-check.sh && ./job-1-check.sh'
  76. deleteDir()
  77. }
  78. }
  79. }
  80. ]}
  81. parallel p;
  82. }
  83. }
  84. }
  85. }
  86. post
  87. {
  88. // hooks are called in order: always, changed, aborted, failure, success, unstable
  89. changed
  90. {
  91. echo "Build status has changed."
  92. script
  93. {
  94. statusHasChanged = true
  95. }
  96. }
  97. success
  98. {
  99. echo "Build success."
  100. // email when changed to success
  101. script
  102. {
  103. if (statusHasChanged)
  104. {
  105. emailext(body: '${DEFAULT_CONTENT}',
  106. subject: '${DEFAULT_SUBJECT}',
  107. replyTo: '$DEFAULT_REPLYTO',
  108. to: '$DEFAULT_RECIPIENTS',
  109. recipientProviders: [[$class: 'CulpritsRecipientProvider'],[$class: 'RequesterRecipientProvider']])
  110. }
  111. }
  112. }
  113. failure
  114. {
  115. echo "Build failure."
  116. // always email on failure
  117. emailext(body: '${DEFAULT_CONTENT}',
  118. subject: '${DEFAULT_SUBJECT}',
  119. replyTo: '$DEFAULT_REPLYTO',
  120. to: '$DEFAULT_RECIPIENTS',
  121. recipientProviders: [[$class: 'CulpritsRecipientProvider'],[$class: 'RequesterRecipientProvider']])
  122. }
  123. }
  124. }