I'm using Bamboo for Continous Deployment.Now,if run a Bamboo plan (regular), my script runs perfectly. It can get the oc (openshift commands) on PATH (environment variables on Bamboo) for e.g. below command executes well by Bamboo plan :-
# include openshift in path
PATH=$PATH:/data/bamboo/openshift
/bin/sh ./portal/deploy.sh --build-number=${bamboo.buildNumber}
But, if I create a 'Deployment Project' and try to run the similar command, I always get the error as oc: not found
Complete error log:-
26-Jul-2019 20:21:27 -> Getting present working dir...
26-Jul-2019 20:21:27 /opt/bamboo-agent-root/bamboo-agent-home/xml-data/build-dir/518946826-518455357
26-Jul-2019 20:21:27 -> Deployment started...
26-Jul-2019 20:21:27 -> Bringing down the pod(s)...
26-Jul-2019 20:21:27 -> Recreating the pod(s)...
26-Jul-2019 20:21:27 -> Deployment completed on TST environment
26-Jul-2019 20:21:27 /opt/bamboo-agent-root/bamboo-agent-home/temp/518946826-518455357-517442402-ScriptBuildTask-7080740712063035315.sh: 6: /opt/bamboo-agent-root/bamboo-agent-home/temp/518946826-518455357-517442402-ScriptBuildTask-7080740712063035315.sh: oc: not found
26-Jul-2019 20:21:27 /opt/bamboo-agent-root/bamboo-agent-home/temp/518946826-518455357-517442402-ScriptBuildTask-7080740712063035315.sh: 10: /opt/bamboo-agent-root/bamboo-agent-home/temp/518946826-518455357-517442402-ScriptBuildTask-7080740712063035315.sh: oc: not found
26-Jul-2019 20:21:27 /opt/bamboo-agent-root/bamboo-agent-home/temp/518946826-518455357-517442402-ScriptBuildTask-7080740712063035315.sh: 13: /opt/bamboo-agent-root/bamboo-agent-home/temp/518946826-518455357-517442402-ScriptBuildTask-7080740712063035315.sh: oc: not found
26-Jul-2019 20:21:27 /opt/bamboo-agent-root/bamboo-agent-home/temp/518946826-518455357-517442402-ScriptBuildTask-7080740712063035315.sh: 13: /opt/bamboo-agent-root/bamboo-agent-home/temp/518946826-518455357-517442402-ScriptBuildTask-7080740712063035315.sh: oc: not found
This is what I'm trying to execute :-
PATH=$PATH:/data/bamboo/openshift
echo "-> Getting present working dir..."
echo $PWD
oc project dummyproject-tst
echo "-> Deployment started..."
echo "-> Bringing down the pod(s)..."
oc scale --replicas=0 deployment dummy-deployment
echo "-> Recreating the pod(s)..."
oc process -f ./openshift/templates/dummy-template.yaml -p IMAGE_TAG=190724.262 | oc apply -f -
echo "-> Deployment completed on TST environment"
I guess, the environment variable for openshift cli is not working even though I have declared in 1st line like PATH=$PATH:/data/bamboo/openshift