When running GDB (google cloud build) with definition file (cloudbuild.yaml pushing from git f.ex) from artifacts, SpEL is not evaluated. However, when GCB definition is defined as text directly in spinnaker, SpEL is evaluated.
I think spinnaker should download the cloudbuild.yaml from artifacts then evaluate SpEL before sending to GCB.
Kubernetes V2
Running GCB from spinnaker
Pipelines
Define GCB substitutions with value is SpEL, for example:
If the GCB build configuration is defined as text directly in spinnaker -> SpEL is evaluated.
If the GCB build configuration is passed as file from artifacts -> SpEL is not evaluated.
steps:
- args:
- '-c'
- |
set -e
if [[ "${_SPINNAKER_CURRENT_STAGE_NAME}" == *"terraform plan"* ]]; then
echo Running terraform plan
fi
if [[ "${_SPINNAKER_CURRENT_STAGE_NAME}" == *"terraform apply"* ]]; then
echo Running terraform apply
fi
entrypoint: bash
name: 'gcr.io/${PROJECT_ID}/terraform'
substitutions:
_SPINNAKER_CURRENT_STAGE_NAME: '${ #currentStage()["name"].toString() }'
terraform plan stage to run GCB'${ #currentStage()["name"].toString() }' will be evaluated making the above definition when running become:steps:
- args:
- '-c'
- |
set -e
if [[ "terraform plan" == *"terraform plan"* ]]; then
echo Running terraform plan
fi
if [[ "terraform plan" == *"terraform apply"* ]]; then
echo Running terraform apply
fi
steps:
- args:
- '-c'
- |
set -e
if [[ "${ #currentStage()["name"].toString() }" == *"terraform plan"* ]]; then
echo Running terraform plan
fi
if [[ "${ #currentStage()["name"].toString() }" == *"terraform apply"* ]]; then
echo Running terraform apply
fi



_Please delete the instructions below this line prior to submitting_
Hey @mdk194, thanks for opening this detailed issue! I've submitted a fix which will go out with the next version of Spinnaker (1.17).
Most helpful comment
Hey @mdk194, thanks for opening this detailed issue! I've submitted a fix which will go out with the next version of Spinnaker (1.17).