Hello All,
I am facing an unusual problem, i am trying to pass arguments to a build script through Jenkins command line, however i am not able to do so.
When i capture and print the arguments it prints empty.
Brief code is:
argument=$1
echo "ARGUMENT: $argument"
set -eu
set -o pipefail
set +u
...somecode...
...somecode...
...somecode...
set -x
set +u
if [[ "$argument" == "somevalue" ]]; then execute a script
else
execute another script
fi
set -u
...somecode...
...somecode...
...somecode...
echo "ARGUMENT: $argument"
if [[ "$argument" == "somevalue" ]]; then
execute a script
else
execute another script
fi
i print any value of arguments after this, it does not capture.
Any suggestion help would be helpful.
Thanks and Regards,
Rahul
What I have tried:
I removed the SET -u and -x etc flags and printed variables.
I also used a workaround to store the variable in a file read it in the script and then use it. But, this is not the intended way to go about it.
Observation:
- When I run this script via my terminal video the script works fine.
- Executing the script from Jenkins console window does not seem to capture the argument.