Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!groovy
- def isMaster = env.BRANCH_NAME == 'master'
- def isDevelop = env.BRANCH_NAME == 'dev'
- def source_dir = ''
- println "Current branch: ${env.BRANCH_NAME}"
- @NonCPS
- def branchParser(branchName) {
- def matcher = (branchName =~ /([A-Za-z]+)/.+/)
- matcher ? matcher[0][1] : null
- }
- def deployToChannel() {
- node('master') {
- unstash name: "package"
- sh 'conda index'
- }
- }
- node('NODE 01') {
- catchError {
- def gitSCM = [$class: 'GitSCM', branches: [[name: '**']],
- browser: [$class: 'Stash', repoUrl: 'https://bitbucket.mydomain.local/projects/myteam/repos/myrepo'],
- doGenerateSubmoduleConfigurations: false,
- extensions: [[$class: 'CleanBeforeCheckout']],
- submoduleCfg: [],
- userRemoteConfigs: [[credentialsId: 'my-id',
- url: 'ssh://git@bitbucket.mydomain.local/myteam/myrepo.git']]
- ]
- stage('Preparation') { // for display purposes
- checkout(gitSCM)
- }
- withEnv(["PREFIX=/home/myuser/miniconda2/envs/CPP"]) {
- stage('Conda Build') {
- sh 'conda build purge'
- sh 'source activate CPP'
- sh 'conda build . --output-folder=${WORKSPACE}/package'
- dir('package/linux-64') {
- stash name: "package", includes: 'myrepo-*.bz2'
- }
- source_dir = pwd()
- }
- }
- if (isMaster) {
- properties([parameters([[$class: 'JiraVersionParameterDefinition', description: '', jiraProjectKey: 'MRM',
- jiraReleasePattern: 'MySoftware_v([0-9]+\.[0-9]+\.[0-9]+)', jiraShowArchived: 'false', jiraShowReleased: 'false', name: 'JIRA_VERSION']]),
- pipelineTriggers([])])
- stage("Approval") {
- mail to: 'myuser@myemail.com',
- subject: "Job '${JOB_NAME}' (${BUILD_NUMBER}) is waiting for input",
- body: "Please go to ${BUILD_URL} and verify the build"
- timeout(time:5, unit:'DAYS') {
- input message:"Approve deployment for ${JIRA_VERSION}?", submitter: 'myuser'
- }
- }
- }
- }
- step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'myteam@myemail.com', sendToIndividuals: false])
- }
- Started by user Me
- > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
- Fetching changes from the remote Git repository
- > /usr/bin/git config remote.origin.url ssh://git@bitbucket.mydomain.local:22/myteam/mysoftware.git # timeout=10
- Fetching upstream changes from ssh://git@bitbucket.mydomain.local:22/myteam/mysoftware.git
- > /usr/bin/git --version # timeout=10
- using GIT_SSH to set credentials
- > /usr/bin/git fetch --tags --progress ssh://git@bitbucket.mydomain.local:22/myteam/mysoftware.git +refs/heads/master
- Checking out Revision 3eb504016bda1917e98fca212956794c268dfd55 (master)
- > /usr/bin/git config core.sparsecheckout # timeout=10
- > /usr/bin/git checkout -f 3eb504016bda1917e98fca212956794c268dfd55
- > /usr/bin/git rev-list 3eb504016bda1917e98fca212956794c268dfd55 # timeout=10
- [Bitbucket] Notifying commit build result
- [Pipeline] echo
- Current branch: master
- [Pipeline] properties
- [Pipeline] node
- Running on DR 01 in /app/work_area/jenkins/workspace/mysoftware_master-AUYR5WAYEZV3SPAZGC3TOFOWOUPPHOV5VWO3PMTHXXULXWISTSFA
- [Pipeline] {
- [Pipeline] catchError
- [Pipeline] {
- [Pipeline] stage
- [Pipeline] { (Preparation)
- [Pipeline] checkout
- > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
- Fetching changes from the remote Git repository
- > /usr/bin/git config remote.origin.url ssh://git@bitbucket.mydomain.local/myteam/mysoftware.git # timeout=10
- Cleaning workspace
- > /usr/bin/git rev-parse --verify HEAD # timeout=10
- Resetting working tree
- > /usr/bin/git reset --hard # timeout=10
- > /usr/bin/git clean -fdx # timeout=10
- Fetching upstream changes from ssh://git@bitbucket.mydomain.local/myteam/mysoftware.git
- > /usr/bin/git --version # timeout=10
- using GIT_SSH to set credentials
- > /usr/bin/git fetch --tags --progress ssh://git@bitbucket.mydomain.local/myteam/mysoftware.git +refs/heads/*:refs/remotes/origin/*
- Seen branch in repository origin/dev
- Seen branch in repository origin/master
- Seen 2 remote branches
- Checking out Revision 315c3e7dd90583bd57070e908dbf70de2e09c3e0 (origin/dev)
- > /usr/bin/git config core.sparsecheckout # timeout=10
- > /usr/bin/git checkout -f 315c3e7dd90583bd57070e908dbf70de2e09c3e0
- > /usr/bin/git rev-list 315c3e7dd90583bd57070e908dbf70de2e09c3e0 # timeout=10
- [Bitbucket] Notifying commit build result
- [Pipeline] }
- [Pipeline] // stage
- Seen branch in repository origin/dev
- Seen branch in repository origin/master
- Seen 2 remote branches
- Checking out Revision 315c3e7dd90583bd57070e908dbf70de2e09c3e0 (origin/dev)
- /usr/bin/git config core.sparsecheckout # timeout=10
- /usr/bin/git checkout -f 315c3e7dd90583bd57070e908dbf70de2e09c3e0
- /usr/bin/git rev-list 315c3e7dd90583bd57070e908dbf70de2e09c3e0 # timeout=10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement