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

Add logged-in username to batch-task environment vars

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • batch-task-plugin
    • None
    • Platform: All, OS: All

      In addition to the existing Hudson provided environment vars, it would be very nice to have the username
      of the logged-in user exposed when running batch tasks. The use-case is to be able to send an email
      from the task that contains the username of the user that kicked it off.

      I'd suggest HUDSON_USER as the name of the var.

          [JENKINS-1628] Add logged-in username to batch-task environment vars

          mdonohue added a comment -

          Add dependency

          mdonohue added a comment - Add dependency

          kotfu added a comment -

          I would prefer to see two environment variables, which would expose information
          similar to what a login shell exposes. The USER variable would contain the name
          of the effective user id, and HOME would have the home directory of that user.

          I use hudson to automate deployments of ruby applications that use Capistrano.
          Some of these other command line tools look in $HOME for certain files. Because
          $HOME is not set, I have to set it manually in the hudson with something like:

          HOME=/usr/share/tomcat6 cap -v -v deploy

          This workaround is functional, but if the container is ever run as a different
          user id, it would break.

          kotfu added a comment - I would prefer to see two environment variables, which would expose information similar to what a login shell exposes. The USER variable would contain the name of the effective user id, and HOME would have the home directory of that user. I use hudson to automate deployments of ruby applications that use Capistrano. Some of these other command line tools look in $HOME for certain files. Because $HOME is not set, I have to set it manually in the hudson with something like: HOME=/usr/share/tomcat6 cap -v -v deploy This workaround is functional, but if the container is ever run as a different user id, it would break.

          mdonohue added a comment -

          update summary

          mdonohue added a comment - update summary

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/plugins/batch-task/src/main/java/hudson/plugins/batch_task/BatchRun.java
          trunk/hudson/plugins/batch-task/src/test/java/hudson/plugins/batch_task/BatchTaskTest.java
          http://fisheye4.cenqua.com/changelog/hudson/?cs=25330
          Log:
          [FIXED JENKINS-5039] [FIXED JENKINS-1628] [FIXED JENKINS-1316]
          Environment variable bugfix (global/node variables not set in env for tasks)
          and enhancements (add TASK_ID env var, add HUDSON_USER if task triggered by user)

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/plugins/batch-task/src/main/java/hudson/plugins/batch_task/BatchRun.java trunk/hudson/plugins/batch-task/src/test/java/hudson/plugins/batch_task/BatchTaskTest.java http://fisheye4.cenqua.com/changelog/hudson/?cs=25330 Log: [FIXED JENKINS-5039] [FIXED JENKINS-1628] [FIXED JENKINS-1316] Environment variable bugfix (global/node variables not set in env for tasks) and enhancements (add TASK_ID env var, add HUDSON_USER if task triggered by user)

            mindless Alan Harder
            noise noise
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: