【发布时间】:2019-05-07 14:50:41
【问题描述】:
我正在基于 jenkins 上的管道创建这个新作业。我希望我的 jenkinsfile 位于 bitbucket 存储库中:假设我的配置文件位于 bitbucket.org/config.git
工作任务是清理安装一个项目bitbucket.org/myProject.git
如何配置管道,以便在bitbucket.org/myProject.git 中进行任何推送并遵循bitbucket.org/config.git 中定义的步骤时触发?
我不想创建多分支管道,也不希望我的 jenkins 文件与要编译的项目位于同一存储库中。
我目前的配置是:
pipeline {
agent any
parameters {
string(defaultValue: '', description: 'URL', name: 'GIT_URL')
string(defaultValue: '', description: 'Credential', name: 'CREDENTIAL_ID')
}
stages {
stage ('Initialize') {
steps {
git branch: 'develop', credentialsId: "${params.CREDENTIAL_ID}", url: "${params.GIT_URL}"
}
}
stage ('Build') {
steps {
sh 'mvn clean install '
echo 'build'
}
}
}
【问题讨论】:
标签: jenkins jenkins-pipeline bitbucket