I have a very simple CI/CD pipeline in Gitlab that looks like this:
image: maven:3.3.9-jdk-8
variables:
APP: "MyApp"
stages:
- build
test_build:
stage: build
image: mcr.microsoft.com/azure-cli
script:
- echo $APP
- $name='prefix' + $APP + 'suffix'
- echo $name
When I run this pipeline, the first script line, echo $APP
, correctly prints "MyApp"
. However the second line fails with the following:
/bin/bash: Line 121: 'prefix': command not found.
My question is, how can I use pipeline variables inline azure cli commands?
This is an issue of Bash syntax: Replace the line starting with $name=
to name="prefix $APP suffix"