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

Add Task Id to the environment variables

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: batch-task-plugin
    • Labels:
      None
    • Environment:
      Platform: All, OS: All
    • Similar Issues:

      Description

      I have looked around and even peeked into the source code(not good enough to
      change it myself yet) but I can't seem to find any indication that the Task Id
      is placed in the env. This would be a very handy thing to have to identify
      specific task runs in the build itself

      I hope this isn't a duplicate, I checked the issue tracker and mailing lists but
      if it is sorry.

      -martin

        Attachments

          Issue Links

            Activity

            Hide
            kohsuke Kohsuke Kawaguchi added a comment -

            Yes, this is useful, but it requires me to first take care of issue #992.

            Show
            kohsuke Kohsuke Kawaguchi added a comment - Yes, this is useful, but it requires me to first take care of issue #992.
            Hide
            mindless Alan Harder added a comment -

            I'm looking at env vars when running tasks (related to JENKINS-5039 and JENKINS-1628), so I could cover this one too.. are you really asking for the env when running batch task ABC to contain a var like BATCH_TASK=ABC ? not sure why you'd need a var since ABC is its own script.. the var is always the same (unless you rename the task..), so wanted to make sure this is what you meant.

            Show
            mindless Alan Harder added a comment - I'm looking at env vars when running tasks (related to JENKINS-5039 and JENKINS-1628 ), so I could cover this one too.. are you really asking for the env when running batch task ABC to contain a var like BATCH_TASK=ABC ? not sure why you'd need a var since ABC is its own script.. the var is always the same (unless you rename the task..), so wanted to make sure this is what you meant.
            Hide
            mortis mortis added a comment -

            No actually I was talking about the identifier for the task run, not the task name. So something like #1275-2 where 1275 is the build and -2 is the 2nd time the task has been run on that build.

            Show
            mortis mortis added a comment - No actually I was talking about the identifier for the task run, not the task name. So something like #1275-2 where 1275 is the build and -2 is the 2nd time the task has been run on that build.
            Hide
            mindless Alan Harder added a comment -

            gotcha.. this makes more sense, thanks.

            Show
            mindless Alan Harder added a comment - gotcha.. this makes more sense, thanks.
            Hide
            scm_issue_link 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)

            Show
            scm_issue_link 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)

              People

              • Assignee:
                mindless Alan Harder
                Reporter:
                mortis mortis
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: