如何编写声明性管道以在位存储桶上创建新的拉取请求{source-branch ----> target-branch}

时间:2019-07-26 13:35:47

标签: jenkins-pipeline declarative

1-我有声明性的管道代码来自动部署      2-我正在寻找声明性管道代码来创建新的请求         每次构建成功时都请求。      3-我有以下管道代码。请帮忙如何创建拉         来自p的请求 ipeline代码。

  pipeline {      
    agent{ 
    label 'mydocker' 
     }
    stages{                    
      stage('checkoutStage'){
        steps {       
    checkout([$class: 'GitSCM', branches: 
     [[name:"*/${gitSourcebranch()}"]], 
     doGenerateSubmoduleConfigurations: false, extensions: 
     [[$class: 'SparseCheckoutPaths', sparseCheckoutPaths: 
     [[path: 'sparse1']]],           
     [$class: 'UserIdentity', email: "${GitEmail}", name:
     "${GitUsername}"],
     [$class: 'PerBuildTag'], [$class: 'PreBuildMerge', options: 
     [mergeRemote: 'origin', mergeTarget: 'master']]], 
     submoduleCfg: [], 
     userRemoteConfigs: [[credentialsId: 
     'https_gitlab_clone_credential', name: 'origin', url: 
     "${gitUrl()}"]]])
     git branch: "${gitSourcebranch()}", credentialsId: 
     'https_gitlab_clone_credential', url: "${gitUrl()}"
     withCredentials([usernamePassword(credentialsId: 
     'https_gitlab_clone_credential', passwordVariable: 
     'gitlab_pass', usernameVariable: 'gitlab_user')]) {               
     sh "figlet 'wazzup'"
     sh "figlet 'i am on'"
     sh "git config credential.username ${UserName()}"
     sh "git config credential.helper ${gitlab_pass}" 
     //sh "git config --global user.email ${UserEmail()}"
     sh "git config --global user.name ${UserName()}"
     //sh "set +x /bin/sh -c \"echo 
     ${ansibleVaultCredentials()}>vault_passwd.txt\""
     sh "set +x; echo ${ansibleVaultCredentials()} >> 
      vault_passwd.txt"
      sh "echo pass"
      sh "cat vault_passwd.txt"
      sh "ansible-vault decrypt --vault-password-file 
      vault_passwd.txt test.sh && sh test.sh"   
      }// closing withCredential
    }// steps of checkout_stage
  } //closing checkoutstage

 stage('Creating_bitbucket_PR') { 
    when {
      expression {currentBuild.currentResult == 'SUCCESS' }
     }
    steps{
      echo "------ please help to write code how to create new 
             PR on successful build from source-branch ---> target
  }


I don't know correct how to do it in efficient way. Please help

0 个答案:

没有答案