-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: core, workflow-basic-steps-plugin
-
Environment:Jenkins 2.462.2
java.runtime.name OpenJDK Runtime Environment
java.runtime.version 21.0.4+7-Ubuntu-1ubuntu222.04
I want to reset a modified PATH environment variable before modifying it again.
This pipeline hangs indefinitely in/before the sh step:
pipeline {
  agent any
  environment {
// Not necessary for reproduction
// PATH = "bar:$PATH"
}
stages {
    stage('withEnv') {
      steps {
        withEnv(['PATH=', 'PATH+FOO=foo']) {
          sh 'echo $PATH'
        }
      }
    }
  }
}
Eventually the pipeline is killed with
process apparently never started in ..../jenkins/workspace/withEnv-test_tmp/durable-89999c02
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
The same problem occurs with nesting withEnv blocks or e.g. with a stage environment overwriting a parent environment or even when using keepEnv([]){withEnv(...)}
Doesn't occur when overwriting a random, non-system variable.