其他分享
首页 > 其他分享> > gitlab 触发Jenkins简单示例

gitlab 触发Jenkins简单示例

作者:互联网

// Uses Declarative syntax to run commands inside a container.
pipeline {
    agent {
        label "test"
    }
    post {
      failure {
        updateGitlabCommitStatus name: 'Jenkins Pipeline', state: 'failed'
      }
      success {
        updateGitlabCommitStatus name: 'Jenkins Pipeline', state: 'success'
      }
    }
    options {
      gitLabConnection('scm-gitlab')
    }
    triggers {
        gitlab(
            triggerOnPush: false,
            triggerOnMergeRequest: true, triggerOpenMergeRequestOnPush: "never",
            triggerOnNoteRequest: true,
            noteRegex: "jenkins build",
            skipWorkInProgressMergeRequest: true,
            ciSkip: false,
            setBuildDescription: true,
            addNoteOnMergeRequest: true,
            addCiMessage: true,
            addVoteOnMergeRequest: true,
            acceptMergeRequestOnSuccess: false,
            branchFilterType: "NameBasedFilter",
            includeBranchesSpec: "master",
            excludeBranchesSpec: "",
            pendingBuildName: "Jenkins Pipeline",
            cancelPendingBuildsOnUpdate: false,
            // secretToken: "abcdefghijklmnopqrstuvwxyz0123456789ABCDEF")
        )
    }
    stages {
        stage('build') {
            steps {
                script {
                    echo "build"
                }
            }
        }
        stage('deploy') {
            steps {
                script {
                    echo "deploy"
                }
            }
        }
    }
}

  

标签:Pipeline,false,示例,gitlab,build,Jenkins,true
来源: https://www.cnblogs.com/jpinsz/p/16598865.html