Jenkins管道作业(SCMTriggerItem)未找到scm,尽管定义了scm
我的目标是在bitbucket推送上触发管道作业构建。我现在正在测试webhook,构建没有被触发。jenkins日志显示了一些错误,但我不理解: 有人能解释一下为什么jenkins管道作业(也称为Jenkins管道作业(SCMTriggerItem)未找到scm,尽管定义了scm,jenkins,jenkins-pipeline,jenkins-job-dsl,Jenkins,Jenkins Pipeline,Jenkins Job Dsl,我的目标是在bitbucket推送上触发管道作业构建。我现在正在测试webhook,构建没有被触发。jenkins日志显示了一些错误,但我不理解: 有人能解释一下为什么jenkins管道作业(也称为SCMTriggerItem)找不到SCM 环境: 詹金斯v2.249 Jenkins插件:Bitbucket v1.1.26 Bitbucket云与存储库webhook连接到https://myurl.com/jenkins/bitbucket-hook/ 这就是错误(): 插件在作业上循环(J
SCMTriggerItem
)找不到SCM
环境:
- 詹金斯v2.249
- Jenkins插件:Bitbucket v1.1.26
- Bitbucket云与存储库webhook连接到
https://myurl.com/jenkins/bitbucket-hook/
Jenkins.getInstance().getAllItems(Job.class)
)。我假设“作业”是下面定义的作业(pipelineJob('hello-world-server')
)。在中,插件尝试将作业强制转换为SCMTriggerItem。在中,插件尝试从触发器项获取SCM,但未找到任何SCM。显然,我的工作定义已经设置了cpsScm->scm->git
。我以为这就足够了。还需要什么别的东西来完成这项工作吗?或者bitbucket插件不能与管道作业一起工作
我的工作定义:
jobs:
- script: >
pipelineJob('hello-world-server') {
// jobdsl v1.77 deprecates triggers. Here is the migration wiki:
// https://github.com/jenkinsci/job-dsl-plugin/wiki/Migration
properties{
pipelineTriggers{
triggers{
bitbucketPush()
}
}
}
definition {
cpsScm {
scm {
git {
remote {
url('https://hijoe@bitbucket.org/hijoe/hello-world-server.git')
credentials('jenkins_bitbucket_password')
}
branches('master','develop')
scriptPath('Jenkinsfile')
extensions { }
}
}
}
}
}
我的文件:
pipeline {
agent any
environment{
}
stages {
stage('Build'){
steps{
echo '### Building to be done'
}
}
stage('Testing'){
steps{
echo '### Testing to be done'
}
}
stage('Deploy') {
steps {
echo '### Release to be done'
}
}
}
}
更新:
升级到Bitbucket 1.1.27后,它工作正常。我收到一个新错误,即没有匹配的存储库,但我可以通过指定覆盖URL
来修复此错误:
triggers{
bitbucketPush{
overrideUrl('https://bitbucket.org/hijoe/hello-world-server')
}
}
triggers{
bitbucketPush{
overrideUrl('https://bitbucket.org/hijoe/hello-world-server')
}
}