Jenkins list user ids using script consoleUser script at logoutIs there a startup shell script for Jenkins?new user from text file scriptscript convert files using dos2unixHow to read user last email using a shell script?logout current user from scriptCannot activate python virtual env in jenkins shell scriptHow to run Perl script in jenkinsRandom script using bashcannot run jenkins build job as another user

What fields between the rationals and the reals allow a good notion of 2D distance?

Has any country ever had 2 former presidents in jail simultaneously?

Can I cause damage to electrical appliances by unplugging them when they are turned on?

Can you use Vicious Mockery to win an argument or gain favours?

C++ copy constructor called at return

Creating two special characters

Will number of steps recorded on FitBit/any fitness tracker add up distance in PokemonGo?

Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?

meaning of encore in this sentence

In a multiple cat home, how many litter boxes should you have?

How could a planet have erratic days?

Merge org tables

Make a Bowl of Alphabet Soup

How to get directions in deep space?

What (the heck) is a Super Worm Equinox Moon?

How to preserve electronics (computers, iPads and phones) for hundreds of years

Does "he squandered his car on drink" sound natural?

Is it necessary to use pronouns with the verb "essere"?

When were female captains banned from Starfleet?

What is the difference between lands and mana?

Is this part of the description of the Archfey warlock's Misty Escape feature redundant?

Why do ¬, ∀ and ∃ have the same precedence?

Does Doodling or Improvising on the Piano Have Any Benefits?

How to explain what's wrong with this application of the chain rule?



Jenkins list user ids using script console


User script at logoutIs there a startup shell script for Jenkins?new user from text file scriptscript convert files using dos2unixHow to read user last email using a shell script?logout current user from scriptCannot activate python virtual env in jenkins shell scriptHow to run Perl script in jenkinsRandom script using bashcannot run jenkins build job as another user













2















I want to list all users in jenkins, via the console script that jenkins has.



So far i managed to list all the users using this:



import hudson.model.User 
User.getAll().each user ->
println user


but they are listed by the first and last name, which i don't need...



I would like to list them by their user IDs, can you give me a hand? I looked thru their documentation but i fail to understand how to use it the right way. I m not so experimented with groovy scripting..



Any ideas? Thank you!










share|improve this question




























    2















    I want to list all users in jenkins, via the console script that jenkins has.



    So far i managed to list all the users using this:



    import hudson.model.User 
    User.getAll().each user ->
    println user


    but they are listed by the first and last name, which i don't need...



    I would like to list them by their user IDs, can you give me a hand? I looked thru their documentation but i fail to understand how to use it the right way. I m not so experimented with groovy scripting..



    Any ideas? Thank you!










    share|improve this question


























      2












      2








      2


      1






      I want to list all users in jenkins, via the console script that jenkins has.



      So far i managed to list all the users using this:



      import hudson.model.User 
      User.getAll().each user ->
      println user


      but they are listed by the first and last name, which i don't need...



      I would like to list them by their user IDs, can you give me a hand? I looked thru their documentation but i fail to understand how to use it the right way. I m not so experimented with groovy scripting..



      Any ideas? Thank you!










      share|improve this question
















      I want to list all users in jenkins, via the console script that jenkins has.



      So far i managed to list all the users using this:



      import hudson.model.User 
      User.getAll().each user ->
      println user


      but they are listed by the first and last name, which i don't need...



      I would like to list them by their user IDs, can you give me a hand? I looked thru their documentation but i fail to understand how to use it the right way. I m not so experimented with groovy scripting..



      Any ideas? Thank you!







      scripts console jenkins groovy






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 3 hours ago









      yash

      1053




      1053










      asked Aug 14 '18 at 6:48









      Caranfil AlegzandruCaranfil Alegzandru

      1492312




      1492312




















          2 Answers
          2






          active

          oldest

          votes


















          3














          According to the hudson.modle.User documentation, you can use the getId() method to get the user's id.



          Probably like that:



          import hudson.model.User
          User.getAll().each user ->
          println user.getId()





          share|improve this answer






























            0














            First, sorry for posting this on ask ubuntu instead of serverfault.



            I found the perfect way:



            import hudson.model.User 
            import jenkins.model.Jenkins
            def realm = Jenkins.getInstance().getSecurityRealm()
            def users = realm.getAllUsers()
            for (User u : users)
            def userid = u.getId()
            println(userid + " ")






            share|improve this answer
























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "89"
              ;
              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%2faskubuntu.com%2fquestions%2f1065178%2fjenkins-list-user-ids-using-script-console%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              According to the hudson.modle.User documentation, you can use the getId() method to get the user's id.



              Probably like that:



              import hudson.model.User
              User.getAll().each user ->
              println user.getId()





              share|improve this answer



























                3














                According to the hudson.modle.User documentation, you can use the getId() method to get the user's id.



                Probably like that:



                import hudson.model.User
                User.getAll().each user ->
                println user.getId()





                share|improve this answer

























                  3












                  3








                  3







                  According to the hudson.modle.User documentation, you can use the getId() method to get the user's id.



                  Probably like that:



                  import hudson.model.User
                  User.getAll().each user ->
                  println user.getId()





                  share|improve this answer













                  According to the hudson.modle.User documentation, you can use the getId() method to get the user's id.



                  Probably like that:



                  import hudson.model.User
                  User.getAll().each user ->
                  println user.getId()






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 14 '18 at 8:43









                  pimpim

                  1,9391925




                  1,9391925























                      0














                      First, sorry for posting this on ask ubuntu instead of serverfault.



                      I found the perfect way:



                      import hudson.model.User 
                      import jenkins.model.Jenkins
                      def realm = Jenkins.getInstance().getSecurityRealm()
                      def users = realm.getAllUsers()
                      for (User u : users)
                      def userid = u.getId()
                      println(userid + " ")






                      share|improve this answer





























                        0














                        First, sorry for posting this on ask ubuntu instead of serverfault.



                        I found the perfect way:



                        import hudson.model.User 
                        import jenkins.model.Jenkins
                        def realm = Jenkins.getInstance().getSecurityRealm()
                        def users = realm.getAllUsers()
                        for (User u : users)
                        def userid = u.getId()
                        println(userid + " ")






                        share|improve this answer



























                          0












                          0








                          0







                          First, sorry for posting this on ask ubuntu instead of serverfault.



                          I found the perfect way:



                          import hudson.model.User 
                          import jenkins.model.Jenkins
                          def realm = Jenkins.getInstance().getSecurityRealm()
                          def users = realm.getAllUsers()
                          for (User u : users)
                          def userid = u.getId()
                          println(userid + " ")






                          share|improve this answer















                          First, sorry for posting this on ask ubuntu instead of serverfault.



                          I found the perfect way:



                          import hudson.model.User 
                          import jenkins.model.Jenkins
                          def realm = Jenkins.getInstance().getSecurityRealm()
                          def users = realm.getAllUsers()
                          for (User u : users)
                          def userid = u.getId()
                          println(userid + " ")







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 3 hours ago









                          yash

                          1053




                          1053










                          answered Aug 14 '18 at 9:02









                          Caranfil AlegzandruCaranfil Alegzandru

                          1492312




                          1492312



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • 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%2faskubuntu.com%2fquestions%2f1065178%2fjenkins-list-user-ids-using-script-console%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

                              Are there any comparative studies done between Ashtavakra Gita and Buddhim?How is it wrong to believe that a self exists, or that it doesn't?Can you criticise or improve Ven. Bodhi's description of MahayanaWas the doctrine of 'Anatta', accepted as doctrine by modern Buddhism, actually taught by the Buddha?Relationship between Buddhism, Hinduism and Yoga?Comparison of Nirvana, Tao and Brahman/AtmaIs there a distinction between “ego identity” and “craving/hating”?Are there many differences between Taoism and Buddhism?Loss of “faith” in buddhismSimilarity between creation in Abrahamic religions and beginning of life in Earth mentioned Agganna Sutta?Are there studies about the difference between meditating in the morning versus in the evening?Can one follow Hinduism and Buddhism at the same time?Are there any prohibitions on participating in other religion's practices?Psychology of 'flow'

                              Where else does the Shulchan Aruch quote an authority by name?Parashat Metzora+HagadolPesach/PassoverShulchan Aruch UTF-8Anonymous glosses in the Shulchan AruchWhy is the Shulchan Aruch definitive?Siman 32, Kitzur Shulchan Aruch: UntranslatedLitvaks/Yeshivish and Shulchan AruchBuying a Shulchan AruchEnglish version of SHULCHAN ARUCHIs there any place where Shulchan Aruch rules with the Rosh against the Rif and Rambam?Are there practices where Sepharadim do not hold by Shulchan Aruch?5th part of the shulchan aruch

                              fallocate: fallocate failed: Text file busy in Ubuntu 17.04? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)defragmenting and increasing performance of old lubuntu system with swap partitionIssue with increasing the root partition from the swapthis /usr/bin/dpkg returned error || ubuntu-16.04, 64bitDefault 17.04 swap file locationHow to Resize Ubuntu 17.04 Zesty Swap file size?Ubuntu freezes from online formsMy Laptop is not starting after upgrade ubuntu 16.04 (Kernel 4.8.0-38 to 04.10.0-36)hcp: ERROR: FALLOCATE FAILED!Not sure my swap is being usedWine 3.0 asking for more virtual free swap