Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-44741

Build User Vars should not require node

XMLWordPrintable

      When using the build user vars plugin in a pipeline the current required usage is:

      node {
          wrap([$class: 'BuildUser']) {
              // Do something with env.BUILD_USER* vars
          }
      }
      

      The 'node' is required here, because of how 'wrap' works. Because of this it is currently not possible to get the build user information outside the context of a node.

      Creating a custom Workflow step would solve this. Example:

      def buildUser = buildUserVars()
      // Do something with any of its properties:
      // - name
      // - firstName
      // - lastName
      // - userId
      // - email
      

      Or to keep it closer to how it currently works:

      buildUserVars {
        // Do something with env.BUILD_USER* vars
      }
      

      See https://issues.jenkins-ci.org/browse/JENKINS-30142 for a similar issue, which has been solved, for a different plugin.

            zedasvacas Fábio Silva
            markl_lagendijk Mark Lagendijk
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: