SCM Poll in jenkins multibranch pipeline












-1















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.










share|improve this question



























    -1















    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.










    share|improve this question

























      -1












      -1








      -1


      1






      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.










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 8:29









      RAKESH KULKARNIRAKESH KULKARNI

      1




      1
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Sorry what do you mean by the scheduled "build"?




          1. 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"




          1. 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






          share|improve this answer


























          • 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











          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
          });


          }
          });














          draft saved

          draft discarded


















          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









          0














          Sorry what do you mean by the scheduled "build"?




          1. 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"




          1. 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






          share|improve this answer


























          • 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
















          0














          Sorry what do you mean by the scheduled "build"?




          1. 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"




          1. 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






          share|improve this answer


























          • 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














          0












          0








          0







          Sorry what do you mean by the scheduled "build"?




          1. 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"




          1. 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






          share|improve this answer















          Sorry what do you mean by the scheduled "build"?




          1. 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"




          1. 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







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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



















          • 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


















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          TypeError: fit_transform() missing 1 required positional argument: 'X'