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

Environment variables assigned to existing script variables

    Details

    • Similar Issues:
    • Epic Link:

      Description

      This pipeline script appears to be attempting to assign the value for what should be a User variable in the script environment to an existing groovy script variable, resulting in this error: you tried to assign a value to the class 'hudson.model.User' @ line 11, column 5.

      Perhaps this is expected behavior? I would assume these variables should be in the context of env. Maybe this is a special case?

      pipeline {
        agent any
        stages {
          stage('Build') {
            steps {
              sh('mvn package')
            }
          }
        }
        environment {
          User = 'asdf'
        }
      }
      

        Attachments

          Activity

          Hide
          abayer Andrew Bayer added a comment -

          Ah, so the problem is that User is, well, hudson.model.User. I'll see if I can work around that...

          Show
          abayer Andrew Bayer added a comment - Ah, so the problem is that User is, well, hudson.model.User . I'll see if I can work around that...
          Hide
          abayer Andrew Bayer added a comment -

          And I can't! That'll fail before it ever gets to anything I control. Grr.

          Show
          abayer Andrew Bayer added a comment - And I can't! That'll fail before it ever gets to anything I control. Grr.
          Hide
          abayer Andrew Bayer added a comment -

          Yeah, digging further, I can't catch this without some really loopy hacks. The checking for a valid identifier happens in the SEMANTIC_ANALYSIS compilation phase, as does our AST parsing (as of JENKINS-42753 - previously, it was in the next phase, CANONICALIZATION), but the identifier check happens before our AST parsing. So this error is gonna show up before I can report on it in a better way. Sigh.

          Show
          abayer Andrew Bayer added a comment - Yeah, digging further, I can't catch this without some really loopy hacks. The checking for a valid identifier happens in the SEMANTIC_ANALYSIS compilation phase, as does our AST parsing (as of JENKINS-42753 - previously, it was in the next phase, CANONICALIZATION ), but the identifier check happens before our AST parsing. So this error is gonna show up before I can report on it in a better way. Sigh.
          Hide
          bitwiseman Liam Newman added a comment -

          Bulk closing resolved issues.

          Show
          bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

            People

            • Assignee:
              abayer Andrew Bayer
              Reporter:
              kzantow Keith Zantow
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: