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

How can I set an environment variable based on value of user passed parameter?

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: envinject-plugin
    • Labels:
      None
    • Environment:
      Redhat Linux 5.5
    • Similar Issues:

      Description

      I want to set value for an environment variable based on user provided input during the build and use this env variable to set workspace in a jenkins project.

      Ex: User has to select MODULE_NAME when performing a build. MODULE_NAME is a choice parameter. Based on the value selected by the user I want to set MODULE_FOLDER environment variable and use it for setting the WORKSPACE.

      Below is the functionality I am expecting.

      if MODULE_NAME is 'A' then set MODULE_FOLDER = FOLDER1
      else if MODULE_NAME is 'B' then set MODULE_FOLDER = FOLDER2
      else if MODULE_NAME is 'C' then set MODULE_FOLDER = FOLDER3

      Now set WORKSPACE=/usr/modules/$MODULE_FOLDER

      Please help me achieve this functionality. I want to have only one job for all modules. Based on the module user selects I want to build it and deploy it.

      your guidance is much appreciated

        Attachments

          Activity

          skumar suresh kukalakuntla created issue -
          gbois Gregory Boissinot made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          anup_achina Anup Singh made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          gbois Gregory Boissinot made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          koithara Sony Koithara made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Assignee Gregory Boissinot [ gbois ] Sony Koithara [ koithara ]
          danielbeck Daniel Beck made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 143582 ] JNJira + In-Review [ 190630 ]

            People

            • Assignee:
              koithara Sony Koithara
              Reporter:
              skumar suresh kukalakuntla
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: