'Jenkins Shared Library plugin update breaks script path calculation
Prior to the 'Pipeline: Shared Groovy Libraries' update 561.va_ce0de3c2d69, the path to the shared library could be derived from the shared library name. Since this release the path for the shared library has been decoupled from the actual library name, as the directory name is now a long numeric value, not the shared library name.
I was using this fact to correctly set the PATH for scripts (bash, python, perl) pulled from SCM as part of the run.
This means that the below code, which was working, now breaks (shared library is called shared-lib).
def call(pp) {
pipeline {
agent any
environment {
SCRIPTS = "${WORKSPACE}@libs/shared-lib/scripts"
PATH = "$SCRIPTS:${env.PATH}"
}
stages {
stage('Test') {
steps {
sh "my_script.sh"
}
}
}
}
}
Is there a more robust way of deriving the SCRIPTS variable?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
