Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1. #!groovy​
  2.  
  3. def isMaster = env.BRANCH_NAME == 'master'
  4. def isDevelop = env.BRANCH_NAME == 'dev'
  5. def source_dir = ''
  6.  
  7. println "Current branch: ${env.BRANCH_NAME}"
  8.  
  9. @NonCPS
  10. def branchParser(branchName) {
  11. def matcher = (branchName =~ /([A-Za-z]+)/.+/)
  12. matcher ? matcher[0][1] : null
  13. }
  14.  
  15. def deployToChannel() {
  16. node('master') {
  17. unstash name: "package"
  18. sh 'conda index'
  19. }
  20. }
  21.  
  22. node('NODE 01') {
  23. catchError {
  24. def gitSCM = [$class: 'GitSCM', branches: [[name: '**']],
  25. browser: [$class: 'Stash', repoUrl: 'https://bitbucket.mydomain.local/projects/myteam/repos/myrepo'],
  26. doGenerateSubmoduleConfigurations: false,
  27. extensions: [[$class: 'CleanBeforeCheckout']],
  28. submoduleCfg: [],
  29. userRemoteConfigs: [[credentialsId: 'my-id',
  30. url: 'ssh://git@bitbucket.mydomain.local/myteam/myrepo.git']]
  31. ]
  32. stage('Preparation') { // for display purposes
  33. checkout(gitSCM)
  34. }
  35. withEnv(["PREFIX=/home/myuser/miniconda2/envs/CPP"]) {
  36. stage('Conda Build') {
  37. sh 'conda build purge'
  38. sh 'source activate CPP'
  39. sh 'conda build . --output-folder=${WORKSPACE}/package'
  40. dir('package/linux-64') {
  41. stash name: "package", includes: 'myrepo-*.bz2'
  42. }
  43. source_dir = pwd()
  44. }
  45. }
  46.  
  47. if (isMaster) {
  48. properties([parameters([[$class: 'JiraVersionParameterDefinition', description: '', jiraProjectKey: 'MRM',
  49. jiraReleasePattern: 'MySoftware_v([0-9]+\.[0-9]+\.[0-9]+)', jiraShowArchived: 'false', jiraShowReleased: 'false', name: 'JIRA_VERSION']]),
  50. pipelineTriggers([])])
  51.  
  52. stage("Approval") {
  53. mail to: 'myuser@myemail.com',
  54. subject: "Job '${JOB_NAME}' (${BUILD_NUMBER}) is waiting for input",
  55. body: "Please go to ${BUILD_URL} and verify the build"
  56. timeout(time:5, unit:'DAYS') {
  57.  
  58. input message:"Approve deployment for ${JIRA_VERSION}?", submitter: 'myuser'
  59. }
  60. }
  61. }
  62. }
  63. step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'myteam@myemail.com', sendToIndividuals: false])
  64. }
  65.  
  66. Started by user Me
  67. > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
  68. Fetching changes from the remote Git repository
  69. > /usr/bin/git config remote.origin.url ssh://git@bitbucket.mydomain.local:22/myteam/mysoftware.git # timeout=10
  70. Fetching upstream changes from ssh://git@bitbucket.mydomain.local:22/myteam/mysoftware.git
  71. > /usr/bin/git --version # timeout=10
  72. using GIT_SSH to set credentials
  73. > /usr/bin/git fetch --tags --progress ssh://git@bitbucket.mydomain.local:22/myteam/mysoftware.git +refs/heads/master
  74. Checking out Revision 3eb504016bda1917e98fca212956794c268dfd55 (master)
  75. > /usr/bin/git config core.sparsecheckout # timeout=10
  76. > /usr/bin/git checkout -f 3eb504016bda1917e98fca212956794c268dfd55
  77. > /usr/bin/git rev-list 3eb504016bda1917e98fca212956794c268dfd55 # timeout=10
  78. [Bitbucket] Notifying commit build result
  79. [Pipeline] echo
  80. Current branch: master
  81. [Pipeline] properties
  82. [Pipeline] node
  83. Running on DR 01 in /app/work_area/jenkins/workspace/mysoftware_master-AUYR5WAYEZV3SPAZGC3TOFOWOUPPHOV5VWO3PMTHXXULXWISTSFA
  84. [Pipeline] {
  85. [Pipeline] catchError
  86. [Pipeline] {
  87. [Pipeline] stage
  88. [Pipeline] { (Preparation)
  89. [Pipeline] checkout
  90. > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
  91. Fetching changes from the remote Git repository
  92. > /usr/bin/git config remote.origin.url ssh://git@bitbucket.mydomain.local/myteam/mysoftware.git # timeout=10
  93. Cleaning workspace
  94. > /usr/bin/git rev-parse --verify HEAD # timeout=10
  95. Resetting working tree
  96. > /usr/bin/git reset --hard # timeout=10
  97. > /usr/bin/git clean -fdx # timeout=10
  98. Fetching upstream changes from ssh://git@bitbucket.mydomain.local/myteam/mysoftware.git
  99. > /usr/bin/git --version # timeout=10
  100. using GIT_SSH to set credentials
  101. > /usr/bin/git fetch --tags --progress ssh://git@bitbucket.mydomain.local/myteam/mysoftware.git +refs/heads/*:refs/remotes/origin/*
  102. Seen branch in repository origin/dev
  103. Seen branch in repository origin/master
  104. Seen 2 remote branches
  105. Checking out Revision 315c3e7dd90583bd57070e908dbf70de2e09c3e0 (origin/dev)
  106. > /usr/bin/git config core.sparsecheckout # timeout=10
  107. > /usr/bin/git checkout -f 315c3e7dd90583bd57070e908dbf70de2e09c3e0
  108. > /usr/bin/git rev-list 315c3e7dd90583bd57070e908dbf70de2e09c3e0 # timeout=10
  109. [Bitbucket] Notifying commit build result
  110. [Pipeline] }
  111. [Pipeline] // stage
  112.  
  113. Seen branch in repository origin/dev
  114. Seen branch in repository origin/master
  115. Seen 2 remote branches
  116. Checking out Revision 315c3e7dd90583bd57070e908dbf70de2e09c3e0 (origin/dev)
  117. /usr/bin/git config core.sparsecheckout # timeout=10
  118. /usr/bin/git checkout -f 315c3e7dd90583bd57070e908dbf70de2e09c3e0
  119. /usr/bin/git rev-list 315c3e7dd90583bd57070e908dbf70de2e09c3e0 # timeout=10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement