Jenkinsfile and different strategies for branches

前端 未结 7 1658
星月不相逢
星月不相逢 2021-01-31 03:23

I\'m trying to use Jenkins file for all our builds in Jenkins, and I have following problem. We basically have 3 kind of builds:

  • pull-request build - it will be me
相关标签:
7条回答
  • 2021-01-31 03:48

    In my scenarium, I have needed run a stage Deploy Artifactory only if the branch was master(webhook Gitlab), otherwise I couldn't perform the deploy.

    Below the code of my jenkinsfile:

    stages {

        stage('Download'){
    
            when{
                environment name: 'gitlabSourceBranch', value: 'master'
    
            }
    
            steps{
                echo "### Deploy Artifactory ###"
    
                }       
        }
    

    }

    0 讨论(0)
提交回复
热议问题