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" } } } } }