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

Run triggered job - empty variables

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Fixed but Unreleased (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      Jenkins 2.121.3 LTS
      parameterized-trigger 2.35.2
    • Similar Issues:

      Description

      I have a job, which has some parameters.

      When I now want to build with parameters, I get this

      When I now enter some values and start the job, the variables seem to be empty in a Powershell build step:

       

      if ([String]::IsNullOrEmpty($IntMajor)) {
       Write-Host "Error: Variable 'IntMajor' is null or empty."
       exit 1
      }
      if ([String]::IsNullOrEmpty($Major)) {
       Write-Host "Error: Variable 'Major' is null or empty."
       exit 1
      }
      if ([String]::IsNullOrEmpty($Minor)) {
       Write-Host "Error: Variable 'Minor' is null or empty."
       exit 1
      }
      

       

      This is the output in the logs after running the parameterized job:

      [upload] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Users\USER123\AppData\Local\Temp\jenkins9061680245707542673.ps1'"
      Error: Variable 'IntMajor' is null or empty.
      Build step 'Windows PowerShell' marked build as failure
      SSH: Current build result is [FAILURE], not going to run.
      Finished: FAILURE

       

        Attachments

        1. image-2018-08-27-16-50-49-375.png
          5 kB
          Kristian Starkloff
        2. image-2018-08-27-16-51-50-363.png
          18 kB
          Kristian Starkloff

          Activity

          Hide
          krstje Kristian Starkloff added a comment -

          My fault. My script was false. I had to use ${Env:<VarName>}

          Show
          krstje Kristian Starkloff added a comment - My fault. My script was false. I had to use ${Env:<VarName>}

            People

            Assignee:
            krstje Kristian Starkloff
            Reporter:
            krstje Kristian Starkloff
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: