我有下面的jenkins,它工作并自动放作业。它不会添加凭据,除非我进入UI并选择相同的ID "github“,或者允许我添加轮询或触发
我尝试过许多组合,它们要么导致部署崩溃,要么根本不添加作业。
triggers {
pollSCM 'H/10 * * * *'
}
triggers {
cron (H/10 * * * *)
}我想添加cron和轮询scm,因为作业一旦手动运行,它就会从repo jenkinsfile中获取。
jenkins:
systemMessage: "Jenkins: configured automatically with JCasC plugin\n\n"
tool:
git:
installations:
- home: "git"
name: "Default"
jobs:
- script: >
pipelineJob('my_pipleline_build') {
definition {
cpsScm {
scriptPath 'Jenkinsfile'
scm {
git {
remote { url 'https://github.com/my_pipleline_build.git' }
branch '*/master'
credentials: ('github')
extensions {}
}
}
}
}
}
- script: >
pipelineJob('my_other_pipleline_build') {
definition {
cpsScm {
scriptPath 'Jenkinsfile'
scm {
git {
remote { url 'https://github.com/cloud/my_other_pipleline_build.git' }
branch '*/my_pipleline_build'
credentials: ('github')
extensions {}
}
}
}
}
}发布于 2020-03-18 17:43:05
我实现了以下用途,
- script: >
pipelineJob('my_other_pipleline_build') {
definition {
cpsScm {
scriptPath 'Jenkinsfile'
scm {
git {
remote { url 'https://github.com/cloud/my_other_pipleline_build.git'
credentials('github')
}
branch '*/my_pipleline_build'
extensions {}
}
triggers {
cron("H 12 * * 6")
}
}
}
}
}https://stackoverflow.com/questions/60456007
复制相似问题