Problem to solve
I try to use dropdown manual to control ENABLE_ABC or ENABLE_XYZ over target, but at the same time I want to enable both
curl --request POST \
--form "token=YOUR_TRIGGER_TOKEN" \
--form "ref=main" \
--form "variables[ENABLE_ABC]=1" \
--form "variables[ENABLE_XYZ]=1" \
"https://gitlab.example.com/api/v4/projects/PROJECT_ID/trigger/pipeline"
to enable BOTH but, I got
“before_script config should be a string or a nested array of strings up to 10 levels deep”
Steps to reproduce
stages:
- build
variables:
TARGET:
description: "Select target (ABC, XYZ)"
value: "none"
options:
- none
- ABC
- XYZ
ENABLE_ABC: "0"
ENABLE_XYZ: "0"
before_script:
- echo "Selected target: $TARGET"
- |
if [ "$TARGET" == "ABC" ]; then
export ENABLE_ABC="1"
elif [ "$TARGET" == "XYZ" ]; then
export ENABLE_XYZ="1"
fi
- echo "Enable ABC: $ENABLE_ABC"
- echo "Enable XYZ: $ENABLE_XYZ"
build:
stage: build
script:
- echo "Selected target: $TARGET"
- >
if [ "$ENABLE_ABC" == "1" ]; then
echo "ABC target is enabled"
fi
- >
if [ "$ENABLE_XYZ" == "1" ]; then
echo "XYZ target is enabled"
fi