Reputation: 328
I have the following jenkins yaml which works and puts in the jobs automatically. it wont add the credentials unless I go into UI and select the same ID "github" or allow me add polling or triggering
I have tried a number of combinations that either crash the deploy or don not add the jobs at all.
triggers {
pollSCM 'H/10 * * * *'
}
triggers {
cron (H/10 * * * *)
}
I would like to add cron and poll scm as once job is run manually its picked up from the 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 {}
}
}
}
}
}
Upvotes: 0
Views: 902
Reputation: 328
I was able to achieve using below,
- 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")
}
}
}
}
}
Upvotes: 1