My job has a build step Build - Execute shell, I only put these two command in:
echo $WORKSPACE
echo $PWD
And the output really confused me:
+ echo /home/jenkins/workspace/tradefed/test_deployment
/home/jenkins/workspace/tradefed/test_deployment
+ echo /media/d/workspace/tradefed/test_deployment
/media/d/workspace/tradefed/test_deployment
Why the value of $WORKSPACE
and $PWD
are different ?
Update 2019/03/18:
As @PavelAnikhouski mentioned, $WORKSPACE
is set relatively to your $JENKINS_HOME
, $PWD
is OS environment variable, refers to current working directory in file system, so they should not be the same.
But I am still confused about $WORKSPACE
, why Jenkins has $WORKSPACE
, but execute shell in another working directory ?