Hi, I find myself in a bit of a bind and would like suggestions on how to
move forward with our Jenkins cluster.
We've recently updated from a 3 year old version to start using all the
beautiful pipeline plugins stuff, but would like to slowly transition our
hundreds of job over time. The first part worked without too many issues
and our old jobs are running fine on the updated cluster (1 master + 7
slaves). However I seem to be stuck in regards to the shell executable.
Currently, it is defined as an environment variable in our Jenkins global
configuration. In this manner:
Shell executable: ${SHELL_EXEC}
Not far above, we have a default value which is defined globally, pointing
to a location where we have MSYS available on most windows slaves.
Each Linux slaves override this environment variable in this manner in
their node configuration:
SHELL_EXEC=/bin/sh
When I put a "sh" step in my new declarative file, I get a on a Linux
node/agent:
*sh: 1: ${SHELL_EXEC}: not found*
I read somewhere that environment variables defined in the slave node
configuration are not taken into account when using Jenkins pipeline. A pity.
So I did the following tests
I tried using a environment block:
stage {
environment {
SHELL_EXEC = '/bin/sh'
}
steps {
sh 'echo "Something"'
}
}
But it doesn't work and I get the same error. I also tried using 'withEnv' this
way:
stage {
steps {
withEnv(["SHELL_EXEC='/bin/sh'"]) {
sh 'echo "This is a print test"'
}
}
}
And I also get the same error.
Does anyone have any suggestion on how to override the 'Shell executable'
currently set in the global jenkins configuration? I would like to make the
transition to Jenkins Pipeline as easy as possible and not having to
reconfigure 100+ jobs manually just so I can blank this global setting.
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/a9d34071-aa69-4529-99a7-76994a82faf3%40googlegroups.com.