| Another workaround is to run commands in a modified environment:
pipeline {
agent {
docker {
image 'debian'
}
}
environment {
PATH = '/some/dir'
}
stages {
stage('Test') {
steps {
sh "env PATH=$PATH:\$PATH"
}
}
}
}
The resulting PATH variable contains /some/dir prepended to the PATH value defined inside the container (observe double quotes in the steps directive). I fully agree with the others, that the option to manipulate the PATH variable inside a container is a must-have. Note, that this feature has nothing to do with setting the PATH inside a container to the value this variable has outside of it, i.e. on the Jenkins node, which would be obviously wrong in most cases. |