SCM Poll in jenkins multibranch pipeline
Wanted to accommodate scheduled build starting 12AM every 3 hrs till 3PM on every weekday(mon-fri). It should be triggered build only if anything is committed into github repository.
Please provide the exact code as few code is working for multi-branch but not for above schedule.
jenkins-pipeline multibranch-pipeline
add a comment |
Wanted to accommodate scheduled build starting 12AM every 3 hrs till 3PM on every weekday(mon-fri). It should be triggered build only if anything is committed into github repository.
Please provide the exact code as few code is working for multi-branch but not for above schedule.
jenkins-pipeline multibranch-pipeline
add a comment |
Wanted to accommodate scheduled build starting 12AM every 3 hrs till 3PM on every weekday(mon-fri). It should be triggered build only if anything is committed into github repository.
Please provide the exact code as few code is working for multi-branch but not for above schedule.
jenkins-pipeline multibranch-pipeline
Wanted to accommodate scheduled build starting 12AM every 3 hrs till 3PM on every weekday(mon-fri). It should be triggered build only if anything is committed into github repository.
Please provide the exact code as few code is working for multi-branch but not for above schedule.
jenkins-pipeline multibranch-pipeline
jenkins-pipeline multibranch-pipeline
asked Nov 20 '18 at 8:29
RAKESH KULKARNIRAKESH KULKARNI
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Sorry what do you mean by the scheduled "build"?
- Do you want the Multi-Branch to check for more branches on your given interval?
If so you can only do it by "Scan Multibranch Pipeline with defaults Triggers"
- Do you want to issue a build on the branch when there is change on it?
Noted that the option in
the mult-branch folder > "Scan Multibranch Pipeline with defaults Now" and get all current branches > status > the jobs > View Configuration
is read only.
So, to alter the option, from https://issues.jenkins-ci.org/browse/JENKINS-33900?focusedCommentId=326181&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-326181
, I think you should use the Jenkinsfile to do theSCM for every job.
So, for all jobs you need to configure for SCM poll,
include a Jenkinsfile on Git for each of them (Don't forget to install the pipeline-model-definition plugin and all its dependent plugins):
pipeline {
agent any
stages{
stage('Build') {
steps {
echo 'Building.. or whatever'
}
}
}
triggers {
pollSCM('H 0-15/3 * * H(1-5)')
}
}
That should do the job, at least it works for me
Hope it helps
We have used the same structure. Its working in normal pipeline job. But not working with multibranch pipiline jobs
– RAKESH KULKARNI
Nov 20 '18 at 11:29
please help me to solve this query
– RAKESH KULKARNI
Nov 21 '18 at 12:02
Sorry that I thought multi-branch has that option too. I am working on it
– Near
Nov 22 '18 at 2:57
Answer Edited, please check
– Near
Nov 22 '18 at 3:12
Please mark this answer the best if it successfully solves your problem or tell me if it does not work
– Near
Nov 23 '18 at 4:21
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388927%2fscm-poll-in-jenkins-multibranch-pipeline%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sorry what do you mean by the scheduled "build"?
- Do you want the Multi-Branch to check for more branches on your given interval?
If so you can only do it by "Scan Multibranch Pipeline with defaults Triggers"
- Do you want to issue a build on the branch when there is change on it?
Noted that the option in
the mult-branch folder > "Scan Multibranch Pipeline with defaults Now" and get all current branches > status > the jobs > View Configuration
is read only.
So, to alter the option, from https://issues.jenkins-ci.org/browse/JENKINS-33900?focusedCommentId=326181&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-326181
, I think you should use the Jenkinsfile to do theSCM for every job.
So, for all jobs you need to configure for SCM poll,
include a Jenkinsfile on Git for each of them (Don't forget to install the pipeline-model-definition plugin and all its dependent plugins):
pipeline {
agent any
stages{
stage('Build') {
steps {
echo 'Building.. or whatever'
}
}
}
triggers {
pollSCM('H 0-15/3 * * H(1-5)')
}
}
That should do the job, at least it works for me
Hope it helps
We have used the same structure. Its working in normal pipeline job. But not working with multibranch pipiline jobs
– RAKESH KULKARNI
Nov 20 '18 at 11:29
please help me to solve this query
– RAKESH KULKARNI
Nov 21 '18 at 12:02
Sorry that I thought multi-branch has that option too. I am working on it
– Near
Nov 22 '18 at 2:57
Answer Edited, please check
– Near
Nov 22 '18 at 3:12
Please mark this answer the best if it successfully solves your problem or tell me if it does not work
– Near
Nov 23 '18 at 4:21
|
show 1 more comment
Sorry what do you mean by the scheduled "build"?
- Do you want the Multi-Branch to check for more branches on your given interval?
If so you can only do it by "Scan Multibranch Pipeline with defaults Triggers"
- Do you want to issue a build on the branch when there is change on it?
Noted that the option in
the mult-branch folder > "Scan Multibranch Pipeline with defaults Now" and get all current branches > status > the jobs > View Configuration
is read only.
So, to alter the option, from https://issues.jenkins-ci.org/browse/JENKINS-33900?focusedCommentId=326181&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-326181
, I think you should use the Jenkinsfile to do theSCM for every job.
So, for all jobs you need to configure for SCM poll,
include a Jenkinsfile on Git for each of them (Don't forget to install the pipeline-model-definition plugin and all its dependent plugins):
pipeline {
agent any
stages{
stage('Build') {
steps {
echo 'Building.. or whatever'
}
}
}
triggers {
pollSCM('H 0-15/3 * * H(1-5)')
}
}
That should do the job, at least it works for me
Hope it helps
We have used the same structure. Its working in normal pipeline job. But not working with multibranch pipiline jobs
– RAKESH KULKARNI
Nov 20 '18 at 11:29
please help me to solve this query
– RAKESH KULKARNI
Nov 21 '18 at 12:02
Sorry that I thought multi-branch has that option too. I am working on it
– Near
Nov 22 '18 at 2:57
Answer Edited, please check
– Near
Nov 22 '18 at 3:12
Please mark this answer the best if it successfully solves your problem or tell me if it does not work
– Near
Nov 23 '18 at 4:21
|
show 1 more comment
Sorry what do you mean by the scheduled "build"?
- Do you want the Multi-Branch to check for more branches on your given interval?
If so you can only do it by "Scan Multibranch Pipeline with defaults Triggers"
- Do you want to issue a build on the branch when there is change on it?
Noted that the option in
the mult-branch folder > "Scan Multibranch Pipeline with defaults Now" and get all current branches > status > the jobs > View Configuration
is read only.
So, to alter the option, from https://issues.jenkins-ci.org/browse/JENKINS-33900?focusedCommentId=326181&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-326181
, I think you should use the Jenkinsfile to do theSCM for every job.
So, for all jobs you need to configure for SCM poll,
include a Jenkinsfile on Git for each of them (Don't forget to install the pipeline-model-definition plugin and all its dependent plugins):
pipeline {
agent any
stages{
stage('Build') {
steps {
echo 'Building.. or whatever'
}
}
}
triggers {
pollSCM('H 0-15/3 * * H(1-5)')
}
}
That should do the job, at least it works for me
Hope it helps
Sorry what do you mean by the scheduled "build"?
- Do you want the Multi-Branch to check for more branches on your given interval?
If so you can only do it by "Scan Multibranch Pipeline with defaults Triggers"
- Do you want to issue a build on the branch when there is change on it?
Noted that the option in
the mult-branch folder > "Scan Multibranch Pipeline with defaults Now" and get all current branches > status > the jobs > View Configuration
is read only.
So, to alter the option, from https://issues.jenkins-ci.org/browse/JENKINS-33900?focusedCommentId=326181&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-326181
, I think you should use the Jenkinsfile to do theSCM for every job.
So, for all jobs you need to configure for SCM poll,
include a Jenkinsfile on Git for each of them (Don't forget to install the pipeline-model-definition plugin and all its dependent plugins):
pipeline {
agent any
stages{
stage('Build') {
steps {
echo 'Building.. or whatever'
}
}
}
triggers {
pollSCM('H 0-15/3 * * H(1-5)')
}
}
That should do the job, at least it works for me
Hope it helps
edited Nov 23 '18 at 4:22
answered Nov 20 '18 at 10:07
NearNear
438
438
We have used the same structure. Its working in normal pipeline job. But not working with multibranch pipiline jobs
– RAKESH KULKARNI
Nov 20 '18 at 11:29
please help me to solve this query
– RAKESH KULKARNI
Nov 21 '18 at 12:02
Sorry that I thought multi-branch has that option too. I am working on it
– Near
Nov 22 '18 at 2:57
Answer Edited, please check
– Near
Nov 22 '18 at 3:12
Please mark this answer the best if it successfully solves your problem or tell me if it does not work
– Near
Nov 23 '18 at 4:21
|
show 1 more comment
We have used the same structure. Its working in normal pipeline job. But not working with multibranch pipiline jobs
– RAKESH KULKARNI
Nov 20 '18 at 11:29
please help me to solve this query
– RAKESH KULKARNI
Nov 21 '18 at 12:02
Sorry that I thought multi-branch has that option too. I am working on it
– Near
Nov 22 '18 at 2:57
Answer Edited, please check
– Near
Nov 22 '18 at 3:12
Please mark this answer the best if it successfully solves your problem or tell me if it does not work
– Near
Nov 23 '18 at 4:21
We have used the same structure. Its working in normal pipeline job. But not working with multibranch pipiline jobs
– RAKESH KULKARNI
Nov 20 '18 at 11:29
We have used the same structure. Its working in normal pipeline job. But not working with multibranch pipiline jobs
– RAKESH KULKARNI
Nov 20 '18 at 11:29
please help me to solve this query
– RAKESH KULKARNI
Nov 21 '18 at 12:02
please help me to solve this query
– RAKESH KULKARNI
Nov 21 '18 at 12:02
Sorry that I thought multi-branch has that option too. I am working on it
– Near
Nov 22 '18 at 2:57
Sorry that I thought multi-branch has that option too. I am working on it
– Near
Nov 22 '18 at 2:57
Answer Edited, please check
– Near
Nov 22 '18 at 3:12
Answer Edited, please check
– Near
Nov 22 '18 at 3:12
Please mark this answer the best if it successfully solves your problem or tell me if it does not work
– Near
Nov 23 '18 at 4:21
Please mark this answer the best if it successfully solves your problem or tell me if it does not work
– Near
Nov 23 '18 at 4:21
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388927%2fscm-poll-in-jenkins-multibranch-pipeline%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown