File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,18 @@ function beginBuildStep() {
150150
151151 # patch the buildpod with the buildstep
152152 if [ " ${SCC_CHECK} " == false ]; then
153+ # refresh the token as required
154+ if [[ -f " /var/run/secrets/kubernetes.io/serviceaccount/token" ]]; then
155+ DEPLOYER_TOKEN=$( cat /var/run/secrets/kubernetes.io/serviceaccount/token)
156+ else
157+ if [[ -f " /var/run/secrets/lagoon/deployer/token" ]]; then
158+ DEPLOYER_TOKEN=$( cat /var/run/secrets/lagoon/deployer/token)
159+ fi
160+ fi
161+ kubectl config set-credentials lagoon/kubernetes.default.svc --token=" ${DEPLOYER_TOKEN} " & > /dev/null
162+ # try patch, ignore errors
153163 kubectl patch -n ${NAMESPACE} pod ${LAGOON_BUILD_NAME} \
154- -p " {\" metadata\" :{\" labels\" :{\" lagoon.sh/buildStep\" :\" ${2} \" ,\" build.lagoon.sh/images-complete\" :\" ${IMAGE_BUILD_PUSH_COMPLETE} \" }}}" & > /dev/null
164+ -p " {\" metadata\" :{\" labels\" :{\" lagoon.sh/buildStep\" :\" ${2} \" ,\" build.lagoon.sh/images-complete\" :\" ${IMAGE_BUILD_PUSH_COMPLETE} \" }}}" & > /dev/null || true
155165 # tiny sleep to allow patch to complete before logs roll again
156166 sleep 0.5s
157167 fi
You can’t perform that action at this time.
0 commit comments