From 6d9321e03b67c15515d3664ae8e9cc6435c6422a Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Fri, 13 Sep 2019 15:37:18 -0400 Subject: [PATCH] Port PR #7901 to 1.8.x --- .cicd/generate-pipeline.sh | 70 ++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/.cicd/generate-pipeline.sh b/.cicd/generate-pipeline.sh index 1e11060236e..560619d0501 100755 --- a/.cicd/generate-pipeline.sh +++ b/.cicd/generate-pipeline.sh @@ -48,6 +48,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) @@ -96,7 +105,7 @@ echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do agents: queue: "automation-eos-builder-fleet" 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 @@ -119,7 +128,7 @@ 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 @@ -146,7 +155,7 @@ for ROUND in $(seq 1 $ROUNDS); do agents: queue: "automation-eos-builder-fleet" timeout: ${TIMEOUT:-10} - 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_UNIT_TESTS} + 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_UNIT_TESTS} EOF else @@ -167,7 +176,7 @@ EOF wait-network: true timeout: ${TIMEOUT:-20} agents: "queue=mac-anka-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_UNIT_TESTS} + 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_UNIT_TESTS} EOF fi @@ -190,7 +199,7 @@ EOF agents: queue: "automation-eos-builder-fleet" timeout: ${TIMEOUT:-20} - 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_SERIAL_TESTS} + 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_SERIAL_TESTS} EOF else @@ -211,7 +220,7 @@ EOF wait-network: true timeout: ${TIMEOUT:-20} agents: "queue=mac-anka-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_SERIAL_TESTS} + 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_SERIAL_TESTS} EOF fi @@ -228,7 +237,7 @@ EOF cat <