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

Expose new env var containing job name without build axis information appended

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • matrix-project-plugin
    • None

      On https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project, section entitled "Jenkins Set Environment Variables" there is a list of useful env vars which I can pick up in my build scripts.

      When you use a "multi-configuration project" the JOB_NAME, depending on your build axis names, gets resolved to something like:

      JOB_NAME=projectName/COMPILER=CL,CONFIG=Debug,PLATFORM=Win32

      Can you expose a new env var which just contains the project name without all the build axis information?

      In my setup I have "Copy files into the job's workspace before building" enabled and my "Files to copy" field contains:

      jobs/projectName/builds/${BUILD_ID}/changelog.xml

      Obviously I'd like to replace "projectName" with the new env var - this would help me maintain a growing number of projects.

          [JENKINS-9905] Expose new env var containing job name without build axis information appended

          Thomas Fields created issue -

          Thomas Fields added a comment -

          Does anyone agree that this would be a useful feature to add to Jenkins Core?

          Thomas Fields added a comment - Does anyone agree that this would be a useful feature to add to Jenkins Core?

          Thomas Fields added a comment -

          Is this something that could be added in a future release? Does the issue need assigning to someone?

          Thanks,
          Tom.

          Thomas Fields added a comment - Is this something that could be added in a future release? Does the issue need assigning to someone? Thanks, Tom.

          Camillo Bruni added a comment -

          I totally agree. If you have a lot of projects it is nice to depend on the JOB_NAME for settings.

          How about introducing JOB_BASENAME which does not contain this params?

          Camillo Bruni added a comment - I totally agree. If you have a lot of projects it is nice to depend on the JOB_NAME for settings. How about introducing JOB_BASENAME which does not contain this params?

          Thomas Fields added a comment -

          Don't hold your breath for this change. The issue isn't even assigned and it's well over a year old. Sad face.

          Thomas Fields added a comment - Don't hold your breath for this change. The issue isn't even assigned and it's well over a year old. Sad face.
          Daniel Beck made changes -
          Component/s New: matrix-project [ 18765 ]
          Component/s Original: core [ 15593 ]

          This feature is really useful. Please add!

          Andrey Upadyshev added a comment - This feature is really useful. Please add!
          Oleg Nenashev made changes -
          Assignee New: Oleg Nenashev [ oleg_nenashev ]
          Oleg Nenashev made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Daniel Beck added a comment -

          Is there a use case for this that's not a 'worst practice', like local file copy from internal Jenkins file storage?

          Daniel Beck added a comment - Is there a use case for this that's not a 'worst practice', like local file copy from internal Jenkins file storage?

            Unassigned Unassigned
            tfields Thomas Fields
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: