How to disable “build now” option?Jenkins disable build nowHow can I trigger another job from a jenkins pipeline (jenkinsfile) with GitHub Org Plugin?How to trigger jenkins pipeline job by scm change?Jenkins how to create pipeline manual stepHow to build with parameters in Jenkins from Gitlab push?How to trigger Multibranch Pipeline build with github webhookJenkinsfile check if build triggered by push or merge requestAutomatically Build GitHub Branch on CommitJenkins Multibranch Pipeline fails because it runs in Groovy SandboxGitlab webhook does not trigger a build on jenkinsSingle pipeline mapped to multiple git repositories

Is it inappropriate for a student to attend their mentor's dissertation defense?

Why do bosons tend to occupy the same state?

What type of content (depth/breadth) is expected for a short presentation for Asst Professor interview in the UK?

What do you call someone who asks many questions?

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

What are some good books on Machine Learning and AI like Krugman, Wells and Graddy's "Essentials of Economics"

What exploit Are these user agents trying to use?

Probability that a draw from a normal distribution is some number greater than another draw from the same distribution

Why no variance term in Bayesian logistic regression?

How do I gain back my faith in my PhD degree?

How do I handle a potential work/personal life conflict as the manager of one of my friends?

GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?

Is this a hacking script in function.php?

Why can't we play rap on piano?

How to prevent "they're falling in love" trope

Is it acceptable for a professor to tell male students to not think that they are smarter than female students?

Can a virus destroy the BIOS of a modern computer?

Can compressed videos be decoded back to their uncompresed original format?

Plagiarism or not?

ssTTsSTtRrriinInnnnNNNIiinngg

How can saying a song's name be a copyright violation?

Forgetting the musical notes while performing in concert

iPad being using in wall mount battery swollen

How dangerous is XSS?



How to disable “build now” option?


Jenkins disable build nowHow can I trigger another job from a jenkins pipeline (jenkinsfile) with GitHub Org Plugin?How to trigger jenkins pipeline job by scm change?Jenkins how to create pipeline manual stepHow to build with parameters in Jenkins from Gitlab push?How to trigger Multibranch Pipeline build with github webhookJenkinsfile check if build triggered by push or merge requestAutomatically Build GitHub Branch on CommitJenkins Multibranch Pipeline fails because it runs in Groovy SandboxGitlab webhook does not trigger a build on jenkinsSingle pipeline mapped to multiple git repositories













-1















For a given scripted pipeline(jenkins), the pipeline should only get triggered through webhook from GitLab



Build Now option should be disabled for that pipeline.




Can we configure Jenkins, to disable Build Now option for a specific pipeline script job in jenkins?










share|improve this question

















  • 1





    Possible duplicate of Jenkins disable build now

    – Mostafa Hussein
    Mar 7 at 22:46















-1















For a given scripted pipeline(jenkins), the pipeline should only get triggered through webhook from GitLab



Build Now option should be disabled for that pipeline.




Can we configure Jenkins, to disable Build Now option for a specific pipeline script job in jenkins?










share|improve this question

















  • 1





    Possible duplicate of Jenkins disable build now

    – Mostafa Hussein
    Mar 7 at 22:46













-1












-1








-1








For a given scripted pipeline(jenkins), the pipeline should only get triggered through webhook from GitLab



Build Now option should be disabled for that pipeline.




Can we configure Jenkins, to disable Build Now option for a specific pipeline script job in jenkins?










share|improve this question














For a given scripted pipeline(jenkins), the pipeline should only get triggered through webhook from GitLab



Build Now option should be disabled for that pipeline.




Can we configure Jenkins, to disable Build Now option for a specific pipeline script job in jenkins?







jenkins groovy jenkins-pipeline jenkins-groovy






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 22:22









mohetmohet

165




165







  • 1





    Possible duplicate of Jenkins disable build now

    – Mostafa Hussein
    Mar 7 at 22:46












  • 1





    Possible duplicate of Jenkins disable build now

    – Mostafa Hussein
    Mar 7 at 22:46







1




1





Possible duplicate of Jenkins disable build now

– Mostafa Hussein
Mar 7 at 22:46





Possible duplicate of Jenkins disable build now

– Mostafa Hussein
Mar 7 at 22:46












3 Answers
3






active

oldest

votes


















2














EDIT: Here the solution with an scripted Pipeline:



node 
def userIdCause = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')
stage("Authorize Usage")
if (userIdCause.size())
error('Aborting Build due to manual start - thats not permitted!')





How about the following solution without any extra plugin on an declarative pipeline:



pipeline {
...
stages

stage ("Authorize Usage")
when expression getCause() == "USER"
steps
currentBuild.description = 'Aborting Build due to manual start - thats not permitted!'
error('Aborting Build due to manual start - thats not permitted!')


...






share|improve this answer

























  • Can you please let me know more about currentBuild and hudson.model.Cause$UserIdCause? Is currentBuild a member of Script class? What does hudson.model signify?

    – mohet
    Mar 11 at 14:06



















1














Have taken a look at this plug-in supplied on the Jenkin's site? Matrix Authorization Strategy Plugin :



Matrix Strategy



Specifically this sectionL Allow configuring per-agent permissions. This allows e.g. restricting per-agent build permissions when using the Authorize Project plugin (JENKINS-46654)






share|improve this answer






























    0














    The currentBuild variable, which is of type RunWrapper, may be used to refer to the currently running build...



    Source: https://opensource.triology.de/jenkins/pipeline-syntax/globals .



    hudson.model is the package name of most corresponding core jenkins classes. 'Hudson' because jenkins was once cloned from the codebase of his ancestor named 'hudson'.



    You can look up them here: https://javadoc.jenkins.io/hudson/model/package-summary.html .



    There you will also find https://javadoc.jenkins.io/hudson/model/Cause.UserIdCause.html . To specify directly the package$classname in some methods like getbuildcauses is the straightforward thought of jenkins dev Team. This reduces the failure potential and makes the code better readable and understandable.






    share|improve this answer























    • Is UserIdCause class inner class of Cause class? I do not understand this syntax: public static class Cause.UserIdCause extends Cause

      – mohet
      Mar 12 at 14:35












    • This is Java programming language and is going far beyond your original question ;) consider searching on youtube if you need a quick and easy guide for beginners :)

      – snukone
      Mar 12 at 17:09











    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%2f55053752%2fhow-to-disable-build-now-option%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    EDIT: Here the solution with an scripted Pipeline:



    node 
    def userIdCause = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')
    stage("Authorize Usage")
    if (userIdCause.size())
    error('Aborting Build due to manual start - thats not permitted!')





    How about the following solution without any extra plugin on an declarative pipeline:



    pipeline {
    ...
    stages

    stage ("Authorize Usage")
    when expression getCause() == "USER"
    steps
    currentBuild.description = 'Aborting Build due to manual start - thats not permitted!'
    error('Aborting Build due to manual start - thats not permitted!')


    ...






    share|improve this answer

























    • Can you please let me know more about currentBuild and hudson.model.Cause$UserIdCause? Is currentBuild a member of Script class? What does hudson.model signify?

      – mohet
      Mar 11 at 14:06
















    2














    EDIT: Here the solution with an scripted Pipeline:



    node 
    def userIdCause = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')
    stage("Authorize Usage")
    if (userIdCause.size())
    error('Aborting Build due to manual start - thats not permitted!')





    How about the following solution without any extra plugin on an declarative pipeline:



    pipeline {
    ...
    stages

    stage ("Authorize Usage")
    when expression getCause() == "USER"
    steps
    currentBuild.description = 'Aborting Build due to manual start - thats not permitted!'
    error('Aborting Build due to manual start - thats not permitted!')


    ...






    share|improve this answer

























    • Can you please let me know more about currentBuild and hudson.model.Cause$UserIdCause? Is currentBuild a member of Script class? What does hudson.model signify?

      – mohet
      Mar 11 at 14:06














    2












    2








    2







    EDIT: Here the solution with an scripted Pipeline:



    node 
    def userIdCause = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')
    stage("Authorize Usage")
    if (userIdCause.size())
    error('Aborting Build due to manual start - thats not permitted!')





    How about the following solution without any extra plugin on an declarative pipeline:



    pipeline {
    ...
    stages

    stage ("Authorize Usage")
    when expression getCause() == "USER"
    steps
    currentBuild.description = 'Aborting Build due to manual start - thats not permitted!'
    error('Aborting Build due to manual start - thats not permitted!')


    ...






    share|improve this answer















    EDIT: Here the solution with an scripted Pipeline:



    node 
    def userIdCause = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')
    stage("Authorize Usage")
    if (userIdCause.size())
    error('Aborting Build due to manual start - thats not permitted!')





    How about the following solution without any extra plugin on an declarative pipeline:



    pipeline {
    ...
    stages

    stage ("Authorize Usage")
    when expression getCause() == "USER"
    steps
    currentBuild.description = 'Aborting Build due to manual start - thats not permitted!'
    error('Aborting Build due to manual start - thats not permitted!')


    ...







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 8 at 10:41

























    answered Mar 8 at 7:45









    snukonesnukone

    1016




    1016












    • Can you please let me know more about currentBuild and hudson.model.Cause$UserIdCause? Is currentBuild a member of Script class? What does hudson.model signify?

      – mohet
      Mar 11 at 14:06


















    • Can you please let me know more about currentBuild and hudson.model.Cause$UserIdCause? Is currentBuild a member of Script class? What does hudson.model signify?

      – mohet
      Mar 11 at 14:06

















    Can you please let me know more about currentBuild and hudson.model.Cause$UserIdCause? Is currentBuild a member of Script class? What does hudson.model signify?

    – mohet
    Mar 11 at 14:06






    Can you please let me know more about currentBuild and hudson.model.Cause$UserIdCause? Is currentBuild a member of Script class? What does hudson.model signify?

    – mohet
    Mar 11 at 14:06














    1














    Have taken a look at this plug-in supplied on the Jenkin's site? Matrix Authorization Strategy Plugin :



    Matrix Strategy



    Specifically this sectionL Allow configuring per-agent permissions. This allows e.g. restricting per-agent build permissions when using the Authorize Project plugin (JENKINS-46654)






    share|improve this answer



























      1














      Have taken a look at this plug-in supplied on the Jenkin's site? Matrix Authorization Strategy Plugin :



      Matrix Strategy



      Specifically this sectionL Allow configuring per-agent permissions. This allows e.g. restricting per-agent build permissions when using the Authorize Project plugin (JENKINS-46654)






      share|improve this answer

























        1












        1








        1







        Have taken a look at this plug-in supplied on the Jenkin's site? Matrix Authorization Strategy Plugin :



        Matrix Strategy



        Specifically this sectionL Allow configuring per-agent permissions. This allows e.g. restricting per-agent build permissions when using the Authorize Project plugin (JENKINS-46654)






        share|improve this answer













        Have taken a look at this plug-in supplied on the Jenkin's site? Matrix Authorization Strategy Plugin :



        Matrix Strategy



        Specifically this sectionL Allow configuring per-agent permissions. This allows e.g. restricting per-agent build permissions when using the Authorize Project plugin (JENKINS-46654)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 22:31









        BobBob

        12210




        12210





















            0














            The currentBuild variable, which is of type RunWrapper, may be used to refer to the currently running build...



            Source: https://opensource.triology.de/jenkins/pipeline-syntax/globals .



            hudson.model is the package name of most corresponding core jenkins classes. 'Hudson' because jenkins was once cloned from the codebase of his ancestor named 'hudson'.



            You can look up them here: https://javadoc.jenkins.io/hudson/model/package-summary.html .



            There you will also find https://javadoc.jenkins.io/hudson/model/Cause.UserIdCause.html . To specify directly the package$classname in some methods like getbuildcauses is the straightforward thought of jenkins dev Team. This reduces the failure potential and makes the code better readable and understandable.






            share|improve this answer























            • Is UserIdCause class inner class of Cause class? I do not understand this syntax: public static class Cause.UserIdCause extends Cause

              – mohet
              Mar 12 at 14:35












            • This is Java programming language and is going far beyond your original question ;) consider searching on youtube if you need a quick and easy guide for beginners :)

              – snukone
              Mar 12 at 17:09















            0














            The currentBuild variable, which is of type RunWrapper, may be used to refer to the currently running build...



            Source: https://opensource.triology.de/jenkins/pipeline-syntax/globals .



            hudson.model is the package name of most corresponding core jenkins classes. 'Hudson' because jenkins was once cloned from the codebase of his ancestor named 'hudson'.



            You can look up them here: https://javadoc.jenkins.io/hudson/model/package-summary.html .



            There you will also find https://javadoc.jenkins.io/hudson/model/Cause.UserIdCause.html . To specify directly the package$classname in some methods like getbuildcauses is the straightforward thought of jenkins dev Team. This reduces the failure potential and makes the code better readable and understandable.






            share|improve this answer























            • Is UserIdCause class inner class of Cause class? I do not understand this syntax: public static class Cause.UserIdCause extends Cause

              – mohet
              Mar 12 at 14:35












            • This is Java programming language and is going far beyond your original question ;) consider searching on youtube if you need a quick and easy guide for beginners :)

              – snukone
              Mar 12 at 17:09













            0












            0








            0







            The currentBuild variable, which is of type RunWrapper, may be used to refer to the currently running build...



            Source: https://opensource.triology.de/jenkins/pipeline-syntax/globals .



            hudson.model is the package name of most corresponding core jenkins classes. 'Hudson' because jenkins was once cloned from the codebase of his ancestor named 'hudson'.



            You can look up them here: https://javadoc.jenkins.io/hudson/model/package-summary.html .



            There you will also find https://javadoc.jenkins.io/hudson/model/Cause.UserIdCause.html . To specify directly the package$classname in some methods like getbuildcauses is the straightforward thought of jenkins dev Team. This reduces the failure potential and makes the code better readable and understandable.






            share|improve this answer













            The currentBuild variable, which is of type RunWrapper, may be used to refer to the currently running build...



            Source: https://opensource.triology.de/jenkins/pipeline-syntax/globals .



            hudson.model is the package name of most corresponding core jenkins classes. 'Hudson' because jenkins was once cloned from the codebase of his ancestor named 'hudson'.



            You can look up them here: https://javadoc.jenkins.io/hudson/model/package-summary.html .



            There you will also find https://javadoc.jenkins.io/hudson/model/Cause.UserIdCause.html . To specify directly the package$classname in some methods like getbuildcauses is the straightforward thought of jenkins dev Team. This reduces the failure potential and makes the code better readable and understandable.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 12 at 6:34









            snukonesnukone

            1016




            1016












            • Is UserIdCause class inner class of Cause class? I do not understand this syntax: public static class Cause.UserIdCause extends Cause

              – mohet
              Mar 12 at 14:35












            • This is Java programming language and is going far beyond your original question ;) consider searching on youtube if you need a quick and easy guide for beginners :)

              – snukone
              Mar 12 at 17:09

















            • Is UserIdCause class inner class of Cause class? I do not understand this syntax: public static class Cause.UserIdCause extends Cause

              – mohet
              Mar 12 at 14:35












            • This is Java programming language and is going far beyond your original question ;) consider searching on youtube if you need a quick and easy guide for beginners :)

              – snukone
              Mar 12 at 17:09
















            Is UserIdCause class inner class of Cause class? I do not understand this syntax: public static class Cause.UserIdCause extends Cause

            – mohet
            Mar 12 at 14:35






            Is UserIdCause class inner class of Cause class? I do not understand this syntax: public static class Cause.UserIdCause extends Cause

            – mohet
            Mar 12 at 14:35














            This is Java programming language and is going far beyond your original question ;) consider searching on youtube if you need a quick and easy guide for beginners :)

            – snukone
            Mar 12 at 17:09





            This is Java programming language and is going far beyond your original question ;) consider searching on youtube if you need a quick and easy guide for beginners :)

            – snukone
            Mar 12 at 17:09

















            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%2f55053752%2fhow-to-disable-build-now-option%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

            AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

            Алба-Юлія

            Захаров Федір Захарович