-
Notifications
You must be signed in to change notification settings - Fork 0
Helper command `app‐deploy environments`
Jasmin Abou Aldan edited this page Jan 14, 2025
·
1 revision
To help you with parsing out triggered environments from the trigger tag, you can use app-deploy environments $TAG
command, where $TAG
is tag used for triggering the build. Tag must be in the format used by the trigger command (i.e., ci/env1/env2/timestamp
).
deploy environments "ci/env1/env2/timestamp"
output:
env1
env2
For example, this command could be used for mapping trigger env notation into the CI/CD workflow name:
EXTRACTED_ENVIRONMENTS=$(app-deploy environments "$CI_GIT_TAG" | tr '\n' ' ')
# Process environments
BUILD_ENVIRONMENTS=""
IFS=$' ' read -ra environments <<< "$EXTRACTED_ENVIRONMENTS"
# Map environment from tag to the Workflow name
for environment in "${environments[@]}"; do
if [[ $environment == 'internal-develop' ]]; then
BUILD_ENVIRONMENTS+="Development"$'\n'
elif [[ $environment == 'internal-staging' ]]; then
BUILD_ENVIRONMENTS+="Staging"$'\n'
fi
done
# Remove empty line at the end of the list
BUILD_ENVIRONMENTS="$(echo "$BUILD_ENVIRONMENTS")"
# Set $BUILD_ENVIRONMENTS as a global variable on CI/CD that CI can use later as a list of workflows that should be run