I would check if your variable is set - try running
echo ${COMPONENTS}
you can also do:
env | sort
to see all variables set.
if that produces output, then your problem is not with Jenkins but with shell scripting. If it does not produce output, your problem is setting the env variables from parameters. I have not used Freestyle jobs in eons, not sure how to do it, but I am sure there is a way.
If it is a shell problem and your COMPONENTS holds whitespace separate list with no whitespaces inside it - this should work in most shells (no need to play games with subshells):
Yes, variable is definitely set cause I’m using it early in the code. It doesn’t work in loop only… and for COMPONENT in ${COMPONENTS} I’ve already tried…
make sure you are doing for COMPONENT in ${COMPONENTS} and not for COMPONENT in "${COMPONENTS}" - also you may need to ensure your IFS is set correctly (if you are messing with it)