Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Concurrency Groups + Test Stability Pipeline Fixes #7906

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cicd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ else # Linux
PRE_COMMANDS="$PRE_COMMANDS && source /opt/rh/devtoolset-8/enable && source /opt/rh/rh-python36/enable && export PATH=/usr/lib64/ccache:\\\$PATH"
elif [[ $IMAGE_TAG == 'ubuntu-18.04-unpinned' ]]; then
PRE_COMMANDS="$PRE_COMMANDS && export PATH=/usr/lib/ccache:\\\$PATH"
CMAKE_EXTRAS="$CMAKE_EXTRAS -DCMAKE_CXX_COMPILER='clang++' -DCMAKE_C_COMPILER='clang'"
CMAKE_EXTRAS="$CMAKE_EXTRAS -DCMAKE_CXX_COMPILER='clang++' -DCMAKE_C_COMPILER='clang' -DLLVM_DIR='/usr/lib/llvm-7/lib/cmake/llvm'"
fi
BUILD_COMMANDS="cmake $CMAKE_EXTRAS .. && make -j$JOBS"
# Docker Commands
Expand Down
170 changes: 107 additions & 63 deletions .cicd/generate-pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ set -eo pipefail
export MOJAVE_ANKA_TAG_BASE=${MOJAVE_ANKA_TAG_BASE:-'clean::cicd::git-ssh::nas::brew::buildkite-agent'}
export MOJAVE_ANKA_TEMPLATE_NAME=${MOJAVE_ANKA_TEMPLATE_NAME:-'10.14.4_6C_14G_40G'}
export PLATFORMS_JSON_ARRAY='[]'
[[ -z "$ROUNDS" ]] && export ROUNDS='1'
if [[ "$BUILDKITE_PIPELINE_SLUG" == 'eosio-test-stability' ]]; then
LINUX_CONCURRENCY='50'
MAC_CONCURRENCY='2'
LINUX_CONCURRENCY_GROUP="$BUILDKITE_PIPELINE_SLUG-build-$BUILDKITE_BUILD_NUMBER"
MAC_CONCURRENCY_GROUP="$BUILDKITE_PIPELINE_SLUG-build-$BUILDKITE_BUILD_NUMBER-mac"
else
LINUX_CONCURRENCY='8'
MAC_CONCURRENCY='2'
LINUX_CONCURRENCY_GROUP='eos-scheduled-build'
MAC_CONCURRENCY_GROUP='eos-scheduled-build-mac'
fi
# read .cicd/platforms
for FILE in $(ls $CICD_DIR/platforms); do
# skip mac or linux by not even creating the json block
Expand Down Expand Up @@ -79,12 +89,15 @@ echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do
EOF
fi
done
BUILDKITE_AGENT_QUEUE='automation-eks-eos-builder-fleet'
echo ' - wait'
echo ''
# build steps
echo ' # builds'
echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do
if [[ ! "$(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)" =~ 'macos' ]]; then
CONCURRENCY=$LINUX_CONCURRENCY
CONCURRENCY_GROUP=$LINUX_CONCURRENCY_GROUP
cat <<EOF
- label: "$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - Build"
command:
Expand All @@ -94,12 +107,13 @@ echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do
IMAGE_TAG: $(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)
BUILDKITE_AGENT_ACCESS_TOKEN:
agents:
queue: "automation-eos-builder-fleet"
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}

EOF
else
CONCURRENCY=$MAC_CONCURRENCY
CONCURRENCY_GROUP=$MAC_CONCURRENCY_GROUP
cat <<EOF
- label: "$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - Build"
command:
Expand All @@ -120,22 +134,26 @@ EOF
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}

EOF
fi
if [ "$BUILDKITE_SOURCE" = 'schedule' ]; then
cat <<EOF
concurrency: ${CONCURRENCY}
concurrency_group: ${CONCURRENCY_GROUP}
EOF
fi
echo
done
echo ' - wait'
echo ''
# tests
IFS=$oIFS
for ROUND in $(seq 1 $ROUNDS); do
IFS=$''
echo " # round $ROUND of $ROUNDS"
# parallel tests
echo ' # parallel tests'
echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do
if [[ ! "$(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)" =~ 'macos' ]]; then
cat <<EOF
# parallel tests
echo ' # parallel tests'
echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do
if [[ ! "$(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)" =~ 'macos' ]]; then
CONCURRENCY=$LINUX_CONCURRENCY
CONCURRENCY_GROUP=$LINUX_CONCURRENCY_GROUP
cat <<EOF
- label: "$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - Unit Tests"
command:
- "buildkite-agent artifact download build.tar.gz . --step '$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - Build' && tar -xzf build.tar.gz"
Expand All @@ -144,13 +162,16 @@ for ROUND in $(seq 1 $ROUNDS); do
IMAGE_TAG: $(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)
BUILDKITE_AGENT_ACCESS_TOKEN:
agents:
queue: "automation-eos-builder-fleet"
queue: "$BUILDKITE_AGENT_QUEUE"
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}
parallelism: \${ROUNDS:-1}

EOF
else
cat <<EOF
else
CONCURRENCY=$MAC_CONCURRENCY
CONCURRENCY_GROUP=$MAC_CONCURRENCY_GROUP
cat <<EOF
- label: "$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - Unit Tests"
command:
- "git clone \$BUILDKITE_REPO eos && cd eos && git checkout \$BUILDKITE_COMMIT && git submodule update --init --recursive"
Expand All @@ -168,18 +189,27 @@ EOF
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}

parallelism: \${ROUNDS:-1}
EOF
fi
done
# serial tests
echo ' # serial tests'
echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do
IFS=$oIFS
SERIAL_TESTS="$(cat tests/CMakeLists.txt | grep nonparallelizable_tests | grep -v "^#" | awk -F" " '{ print $2 }')"
for TEST_NAME in $SERIAL_TESTS; do
if [[ ! "$(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)" =~ 'macos' ]]; then
cat <<EOF
fi
if [[ "$BUILDKITE_SOURCE" = 'schedule' || "$BUILDKITE_PIPELINE_SLUG" == 'eosio-test-stability' ]]; then
cat <<EOF
concurrency: ${CONCURRENCY}
concurrency_group: ${CONCURRENCY_GROUP}
EOF
fi
echo
done
# serial tests
echo ' # serial tests'
echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do
IFS=$oIFS
SERIAL_TESTS="$(cat tests/CMakeLists.txt | grep nonparallelizable_tests | grep -v "^#" | awk -F" " '{ print $2 }')"
for TEST_NAME in $SERIAL_TESTS; do
if [[ ! "$(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)" =~ 'macos' ]]; then
CONCURRENCY=$LINUX_CONCURRENCY
CONCURRENCY_GROUP=$LINUX_CONCURRENCY_GROUP
cat <<EOF
- label: "$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - $TEST_NAME"
command:
- "buildkite-agent artifact download build.tar.gz . --step '$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - Build' && tar -xzf build.tar.gz"
Expand All @@ -188,13 +218,15 @@ EOF
IMAGE_TAG: $(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)
BUILDKITE_AGENT_ACCESS_TOKEN:
agents:
queue: "automation-eos-builder-fleet"
queue: "$BUILDKITE_AGENT_QUEUE"
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}

parallelism: \${ROUNDS:-1}
EOF
else
cat <<EOF
else
CONCURRENCY=$MAC_CONCURRENCY
CONCURRENCY_GROUP=$MAC_CONCURRENCY_GROUP
cat <<EOF
- label: "$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - $TEST_NAME"
command:
- "git clone \$BUILDKITE_REPO eos && cd eos && git checkout \$BUILDKITE_COMMIT && git submodule update --init --recursive"
Expand All @@ -212,20 +244,29 @@ EOF
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}

parallelism: \${ROUNDS:-1}
EOF
fi
done
IFS=$nIFS
fi
if [[ "$BUILDKITE_SOURCE" = 'schedule' || "$BUILDKITE_PIPELINE_SLUG" == 'eosio-test-stability' ]]; then
cat <<EOF
concurrency: ${CONCURRENCY}
concurrency_group: ${CONCURRENCY_GROUP}
EOF
fi
echo
done
# long-running tests
echo ' # long-running tests'
echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do
IFS=$oIFS
LR_TESTS="$(cat tests/CMakeLists.txt | grep long_running_tests | grep -v "^#" | awk -F" " '{ print $2 }')"
for TEST_NAME in $LR_TESTS; do
if [[ ! "$(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)" =~ 'macos' ]]; then
cat <<EOF
IFS=$nIFS
done
# long-running tests
echo ' # long-running tests'
echo $PLATFORMS_JSON_ARRAY | jq -cr '.[]' | while read -r PLATFORM_JSON; do
IFS=$oIFS
LR_TESTS="$(cat tests/CMakeLists.txt | grep long_running_tests | grep -v "^#" | awk -F" " '{ print $2 }')"
for TEST_NAME in $LR_TESTS; do
if [[ ! "$(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)" =~ 'macos' ]]; then
CONCURRENCY=$LINUX_CONCURRENCY
CONCURRENCY_GROUP=$LINUX_CONCURRENCY_GROUP
cat <<EOF
- label: "$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - $TEST_NAME"
command:
- "buildkite-agent artifact download build.tar.gz . --step '$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - Build' && tar -xzf build.tar.gz"
Expand All @@ -234,13 +275,15 @@ EOF
IMAGE_TAG: $(echo "$PLATFORM_JSON" | jq -r .FILE_NAME)
BUILDKITE_AGENT_ACCESS_TOKEN:
agents:
queue: "automation-eos-builder-fleet"
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_LONG_RUNNING_TESTS:-true}

parallelism: \${ROUNDS:-1}
EOF
else
cat <<EOF
else
CONCURRENCY=$MAC_CONCURRENCY
CONCURRENCY_GROUP=$MAC_CONCURRENCY_GROUP
cat <<EOF
- label: "$(echo "$PLATFORM_JSON" | jq -r .ICON) $(echo "$PLATFORM_JSON" | jq -r .PLATFORM_NAME_FULL) - $TEST_NAME"
command:
- "git clone \$BUILDKITE_REPO eos && cd eos && git checkout \$BUILDKITE_COMMIT && git submodule update --init --recursive"
Expand All @@ -258,18 +301,20 @@ EOF
timeout: ${TIMEOUT:-180}
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_LONG_RUNNING_TESTS:-true}

parallelism: \${ROUNDS:-1}
EOF
fi
done
IFS=$nIFS
fi
if [[ "$BUILDKITE_SOURCE" = 'schedule' || "$BUILDKITE_PIPELINE_SLUG" == 'eosio-test-stability' ]]; then
cat <<EOF
concurrency: ${CONCURRENCY}
concurrency_group: ${CONCURRENCY_GROUP}
EOF
fi
echo
done
IFS=$oIFS
if [[ "$ROUND" != "$ROUNDS" ]]; then
echo ' - wait'
echo ''
fi
IFS=$nIFS
done
IFS=$oIFS
# pipeline tail
cat <<EOF
- wait:
Expand All @@ -282,7 +327,7 @@ cat <<EOF
echo '+++ :javascript: Running test-metrics.js'
node --max-old-space-size=32768 test-metrics.js
agents:
queue: "automation-eos-builder-fleet"
queue: "$BUILDKITE_AGENT_QUEUE"
timeout: ${TIMEOUT:-10}
soft_fail: true

Expand All @@ -299,7 +344,7 @@ cat <<EOF
OS: "el7" # OS and PKGTYPE required for lambdas
PKGTYPE: "rpm"
agents:
queue: "automation-eos-builder-fleet"
queue: "$BUILDKITE_AGENT_QUEUE"
timeout: ${TIMEOUT:-10}
skip: ${SKIP_CENTOS_7_6}${SKIP_PACKAGE_BUILDER}${SKIP_LINUX}

Expand All @@ -313,7 +358,7 @@ cat <<EOF
OS: "ubuntu-16.04" # OS and PKGTYPE required for lambdas
PKGTYPE: "deb"
agents:
queue: "automation-eos-builder-fleet"
queue: "$BUILDKITE_AGENT_QUEUE"
timeout: ${TIMEOUT:-10}
skip: ${SKIP_UBUNTU_16_04}${SKIP_PACKAGE_BUILDER}${SKIP_LINUX}

Expand All @@ -327,7 +372,7 @@ cat <<EOF
OS: "ubuntu-18.04" # OS and PKGTYPE required for lambdas
PKGTYPE: "deb"
agents:
queue: "automation-eos-builder-fleet"
queue: "$BUILDKITE_AGENT_QUEUE"
timeout: ${TIMEOUT:-10}
skip: ${SKIP_UBUNTU_18_04}${SKIP_PACKAGE_BUILDER}${SKIP_LINUX}

Expand Down Expand Up @@ -356,7 +401,7 @@ cat <<EOF
IMAGE_TAG: "ubuntu-18.04-unpinned"
BUILDKITE_AGENT_ACCESS_TOKEN:
agents:
queue: "automation-eos-builder-fleet"
queue: "$BUILDKITE_AGENT_QUEUE"
timeout: ${TIMEOUT:-30}
skip: ${SKIP_CONTRACT_BUILDER}${SKIP_LINUX}

Expand All @@ -377,5 +422,4 @@ cat <<EOF
timeout: "${TIMEOUT:-5}"
skip: ${SKIP_PACKAGE_BUILDER}${SKIP_MAC}${SKIP_MACOS_10_14}

EOF
IFS=$oIFS
EOF
7 changes: 5 additions & 2 deletions .cicd/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
steps:
- wait

- label: ":pipeline: Generate Pipeline Steps"
command: "./.cicd/generate-pipeline.sh | buildkite-agent pipeline upload"
- label: ":pipeline: Generate Pipeline Steps"
command:
- "./.cicd/generate-pipeline.sh > generated-pipeline.yml"
- "buildkite-agent pipeline upload < generated-pipeline.yml"
- "buildkite-agent artifact upload generated-pipeline.yml"
agents:
queue: "automation-basic-builder-fleet"
timeout: ${TIMEOUT:-10}