diff --git a/.cicd/generate-pipeline.sh b/.cicd/generate-pipeline.sh index d0c15ba9f97..3e80f2f7ad2 100755 --- a/.cicd/generate-pipeline.sh +++ b/.cicd/generate-pipeline.sh @@ -51,6 +51,15 @@ for FILE in $(ls $CICD_DIR/platforms); do "ICON": env.ICON }]') done +# set build_source whether triggered or not +if [[ ! -z ${BUILDKITE_TRIGGERED_FROM_BUILD_ID} ]]; then + export BUILD_SOURCE="--build \$BUILDKITE_TRIGGERED_FROM_BUILD_ID" +fi +export BUILD_SOURCE=${BUILD_SOURCE:---build \$BUILDKITE_BUILD_ID} +# set trigger_job if master/release/develop branch and webhook +if [[ $BUILDKITE_BRANCH =~ ^release/[0-9]+\.[0-9]+\.x$ || $BUILDKITE_BRANCH =~ ^master$ || $BUILDKITE_BRANCH =~ ^develop$ ]]; then + [[ $BUILDKITE_SOURCE == 'webhook' ]] && export TRIGGER_JOB=true +fi oIFS="$IFS" IFS=$'' nIFS=$IFS # fix array splitting (\n won't work) @@ -102,7 +111,7 @@ echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do agents: queue: "$BUILDKITE_AGENT_QUEUE" timeout: ${TIMEOUT:-180} - skip: \${SKIP_$(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_UPCASE)_$(echo "$PLATFORM_JSON" | jq -r .VERSION_MAJOR)$(echo "$PLATFORM_JSON" | jq -r .VERSION_MINOR)}\${SKIP_BUILD} + skip: \${SKIP_$(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_UPCASE)_$(echo "$PLATFORM_JSON" | jq -r .VERSION_MAJOR)$(echo "$PLATFORM_JSON" | jq -r .VERSION_MINOR)}${SKIP_BUILD} EOF else @@ -127,10 +136,11 @@ EOF wait-network: true timeout: ${TIMEOUT:-180} agents: "queue=mac-anka-large-node-fleet" - skip: \${SKIP_$(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_UPCASE)_$(echo "$PLATFORM_JSON" | jq -r .VERSION_MAJOR)$(echo "$PLATFORM_JSON" | jq -r .VERSION_MINOR)}\${SKIP_BUILD} + skip: \${SKIP_$(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_UPCASE)_$(echo "$PLATFORM_JSON" | jq -r .VERSION_MAJOR)$(echo "$PLATFORM_JSON" | jq -r .VERSION_MINOR)}${SKIP_BUILD} + EOF fi - if [ "$BUILDKITE_SOURCE" = 'schedule' ]; then + if [ "$BUILDKITE_SOURCE" = "schedule" ]; then cat <