Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BuildKite matrix sketching
---
common: &common
timeout_in_minutes: 60 # TODO(ENG-548): reduce timeout once agent-cold-start is optimised.
retry:
automatic:
# This is designed to trap and retry failures because agent lost connection. Agent exits with -1 in this case.
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
linux_agent: &linux_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=linux"
- "queue=${CI_LINUX_BUILDER_QUEUE:-v2-1556208225-8ff8641d7da8773d-------z}"
<<: *common
macos_agent: &macos_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=macos"
- "queue=${CI_MACOS_BUILDER_QUEUE:-Configure this}"
<<: *common
windows_agent: &windows_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=windows"
- "queue=${CI_WINDOWS_BUILDER_QUEUE:-v2-1556207956-f55a2acb41de1312-------z}"
<<: *common
# NOTE: step labels turn into commit-status names like {org}/{repo}/{pipeline}/{step-label}, lower-case and hyphenated.
# These are then relied on to have stable names by other things, so once named, please beware renaming has consequences.
steps:
- label: "generate-version"
command: "ci/dummy-generate-version.sh"
<<: *linux_agent
- wait:
# Linux
- label: "linux-sanitize"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel_sanitize.sh asan"
<<: *linux_agent
- label: "linux-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh"
<<: *linux_agent
# Android
- label: "android-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh --cpp_only --linux_cpp_build_type=android"
<<: *linux_agent
- label: "android-x86-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh --cpp_only --linux_cpp_build_type=android-x86"
<<: *linux_agent
- label: "android-x86_64-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh --cpp_only --linux_cpp_build_type=android-x86_64"
<<: *linux_agent
# macOS.
- label: "macos"
command: "ci/build-test-publish.sh"
<<: *macos_agent
- label: "ios"
command: "ci/build-test-publish.sh --cpp_only --macos_cpp_build_type=ios-x86_64"
<<: *macos_agent
# Windows.
- label: "windows-md"
command: "ci/private/worker_sdk/test_bazel.sh --windows_cpp_build_type=\"MD\""
<<: *windows_agent
- label: "windows-md-x86"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"MD-x86\""
<<: *windows_agent
- label: "windows-mdd"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"MDd\""
<<: *windows_agent
- label: "windows-mt"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"MT\""
<<: *windows_agent
- label: "windows-mt"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"MTd\""
<<: *windows_agent
# Consoles.
- label: "ps4"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"ps4\""
<<: *windows_agent
- label: "xbox-one"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"xbone\""
<<: *windows_agent
# following - these are here for illustrative purposes only.
- wait:
# here, out-of-process testing happens, but still on a single node
- step: local-integration-testing
- wait:
# here, out-of-process testing happens, involving cloud resources
- step: remote-system-testing
- block: promote-to-release-candidate
- step: promote-to-release-candidate
- block: promote-to-release
- group: promote-to-release
---
# Keith - here I've factored our raw pipeline to just introduce groups per your forum post https://forum.buildkite.community/t/steps-with-a-matrix/46/3
# This improves UX by removing the need for the comments denoting the platform of steps, and making it clearer which steps are for which platform.
# I've added in post-build steps for the pipeline - we have several permission_set possibilities (builder/pusher/releaser) to separate build from deploy from release because blast-radius.
common: &common
timeout_in_minutes: 60
retry:
automatic:
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
linux_agent: &linux_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=linux"
- "queue=${CI_LINUX_BUILDER_QUEUE:-v2-1556208225-8ff8641d7da8773d-------z}"
<<: *common
macos_agent: &macos_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=macos"
- "queue=${CI_MACOS_BUILDER_QUEUE:-Configure this}"
<<: *common
windows_agent: &windows_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=windows"
- "queue=${CI_WINDOWS_BUILDER_QUEUE:-v2-1556207956-f55a2acb41de1312-------z}"
<<: *common
steps:
- group: version
steps:
- label: "generate-version"
command: "ci/dummy-generate-version.sh"
<<: *linux_agent
- wait:
- group: linux
steps:
- label: "linux-sanitize"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel_sanitize.sh asan"
<<: *linux_agent
- label: "linux-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh"
<<: *linux_agent
- group: android
steps:
- label: "android-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh --cpp_only --linux_cpp_build_type=android"
<<: *linux_agent
- label: "android-x86-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh --cpp_only --linux_cpp_build_type=android-x86"
<<: *linux_agent
- label: "android-x86_64-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh --cpp_only --linux_cpp_build_type=android-x86_64"
<<: *linux_agent
- group: macos
steps:
- label: "macos"
command: "ci/build-test-publish.sh"
<<: *macos_agent
- label: "ios"
command: "ci/build-test-publish.sh --cpp_only --macos_cpp_build_type=ios-x86_64"
<<: *macos_agent
- group: windows
steps:
- label: "windows-md"
command: "ci/private/worker_sdk/test_bazel.sh --windows_cpp_build_type=\"MD\""
<<: *windows_agent
- label: "windows-md-x86"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"MD-x86\""
<<: *windows_agent
- label: "windows-mdd"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"MDd\""
<<: *windows_agent
- label: "windows-mt"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"MT\""
<<: *windows_agent
- label: "windows-mt"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"MTd\""
<<: *windows_agent
# consoles are a different group because consoles are a limited resource compared to Windows/Linux nodes.
- group: consoles
steps:
- label: "ps4"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"ps4\""
<<: *windows_agent
- label: "xbox-one"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"xbone\""
<<: *windows_agent
# following - these are here for illustrative purposes only.
- wait:
# here, out-of-process testing happens, but still on a single node
- group: local-integration-testing
- wait:
# here, out-of-process testing happens, involving cloud resources
- group: remote-system-testing
- block: promote-to-release-candidate
- group: promote-to-release-candidate
- block: promote-to-release
- group: promote-to-release
---
# Keith: here I've multiplied out the build-step-level parameterisation via matrix.
# I've left comments and questions inline.
common: &common
timeout_in_minutes: 60
retry:
automatic:
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
linux_agent: &linux_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=linux"
- "queue=${CI_BUILDER_QUEUE:-v2-1556208225-8ff8641d7da8773d-------z}"
<<: *common
macos_agent: &macos_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=macos"
- "queue=${CI_BUILDER_QUEUE:-Configure this}"
<<: *common
windows_agent: &windows_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=windows"
- "queue=${CI_BUILDER_QUEUE:-v2-1556207956-f55a2acb41de1312-------z}"
<<: *common
steps:
- group: version
steps:
- label: "generate-version"
command: "ci/dummy-generate-version.sh"
<<: *linux_agent
- wait:
- group: linux
steps:
- label: "linux-sanitize"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel_sanitize.sh asan"
<<: *linux_agent
- label: "linux-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh"
<<: *linux_agent
- group: android
steps:
# Keith: how will jobs be named? Here, since I have '-' and other punctuation in my matrix values, this is probably gonna get munged unless there's more control than I've extrapolated.
# I think if the array index is chosen for a segment of the label, that will lead to unstable github commit status names, making those significantly harder to manage since if someone reorders or inserts a value into the matrix values, the GHCS names will change semantic meaning. e.g. If I added android-arm64 in alphabetical order here, that would cause the x86 and x86_64 to ripple, and if I've set up required status checks, those'd now need updating. I'd prefer to avoid that UX?
- label: "android-build-test ${BUILDKITE_MATRIX_ANDROID_LINUX_CPP_BUILD_TYPE}"
matrix:
linux_cpp_build_type:
- android
- android-x86
- android_x86_64
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh --cpp_only --linux_cpp_build_type=${BUILDKITE_MATRIX_LINUX_CPP_BUILD_TYPE}"
<<: *linux_agent
- group: macos
steps:
# Keith: How will the matrix environment variable names be namespaced when groups are in-play? I've assumed pipeline-level namespace, but I think that will lead to collisions, which seems like a UX to avoid.
# with namespacing including groups, I'd expect BUILDKITE_MATRIX_MACOS_FLAGS to be the environment variable name, here.
# I don't know whether you will allow nested groups (I hope that you will).
- label: "macos ${BUILDKITE_MATRIX_MACOS_FLAGS}"
command: "ci/build-test-publish.sh ${BUILDKITE_MATRIX_MACOS_FLAGS}"
matrix:
flags: # Keith: This one is a _sparse_ matrix - only 2 combinations of the possible more (--macos_cpp_build_type can take an enum, --cpp_only is a bool). I assume this is why Travis' implementation also allows include/exclude on top of its auto-multiply-out-to-every-combo.
# https://docs.travis-ci.com/user/build-matrix/#excluding-jobs & https://docs.travis-ci.com/user/build-matrix/#explicitly-including-jobs
- "" # Keith: hopefully an empty string is legit? That's the only option I think I have here.
- "--cpp_only --macos_cpp_build_type=ios-x86_64"
<<: *macos_agent
- group: windows
steps:
- label: "windows-${BUILDKITE_MATRIX_WINDOWS_FLAGS}"
command: "ci/private/worker_sdk/test_bazel.sh ${BUILDKITE_MATRIX_WINDOWS_FLAGS}"
<<: *windows_agent
matrix:
flags:
- --windows_cpp_build_type=\"MD\"
- --cpp_only --windows_cpp_build_type=\"MD-x86\"
- --cpp_only --windows_cpp_build_type=\"MDd\"
- --cpp_only --windows_cpp_build_type=\"MT\"
- --cpp_only --windows_cpp_build_type=\"MTd\"
# consoles are a different group because consoles are a limited resource compared to Windows/Linux nodes.
- group: consoles
steps:
- label: "ps4"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"ps4\""
<<: *windows_agent
- label: "xbox-one"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"xbone\""
<<: *windows_agent
# following - these are here for illustrative purposes only.
- wait:
# here, out-of-process testing happens, but still on a single node
- group: local-integration-testing
- wait:
# here, out-of-process testing happens, involving cloud resources
- group: remote-system-testing
- block: promote-to-release-candidate
- group: promote-to-release-candidate
- block: promote-to-release
- group: promote-to-release
---
# Keith - here I've added in agent-targeting matrixing.
common: &common
timeout_in_minutes: 60
retry:
automatic:
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
linux_agent: &linux_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=linux"
- "queue=${CI_BUILDER_QUEUE:-v2-1556208225-8ff8641d7da8773d-------z}"
<<: *common
macos_agent: &macos_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=macos"
- "queue=${CI_BUILDER_QUEUE:-Configure this}"
<<: *common
windows_agent: &windows_agent
agents:
- "capable_of_building=worker-sdk"
- "environment=production"
- "permission_set=builder"
- "platform=windows"
- "queue=${CI_BUILDER_QUEUE:-v2-1556207956-f55a2acb41de1312-------z}"
<<: *common
steps:
- group: version
<<: *linux_agent
steps:
- label: "generate-version"
command: "ci/dummy-generate-version.sh"
- wait:
- group: linux
<<: *linux_agent # Keith: I have assumed I can apply my named anchor into a group and have all steps within that group receive its attributes. Note my named anchor itself includes the *common named anchor.
steps:
- label: "linux-sanitize"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel_sanitize.sh asan"
- label: "linux-build-test"
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh"
- group: android
<<: *linux_agent
steps:
- label: "android-build-test ${BUILDKITE_MATRIX_ANDROID_LINUX_CPP_BUILD_TYPE}"
matrix:
linux_cpp_build_type:
- android
- android-x86
- android_x86_64
command: "ci/docker/ubuntu_18.04/run_in_docker.sh ci/private/worker_sdk/test_bazel.sh --cpp_only --linux_cpp_build_type=${BUILDKITE_MATRIX_LINUX_CPP_BUILD_TYPE}"
- group: macos
<<: *macos_agent
steps:
- label: "macos ${BUILDKITE_MATRIX_MACOS_FLAGS}"
command: "ci/build-test-publish.sh ${BUILDKITE_MATRIX_MACOS_FLAGS}"
matrix:
flags:
- ""
- "--cpp_only --macos_cpp_build_type=ios-x86_64"
- group: windows
<<: *windows_agent
steps:
- label: "windows-${BUILDKITE_MATRIX_WINDOWS_FLAGS}"
command: "ci/private/worker_sdk/test_bazel.sh ${BUILDKITE_MATRIX_WINDOWS_FLAGS}"
matrix:
flags:
- --windows_cpp_build_type=\"MD\"
- --cpp_only --windows_cpp_build_type=\"MD-x86\"
- --cpp_only --windows_cpp_build_type=\"MDd\"
- --cpp_only --windows_cpp_build_type=\"MT\"
- --cpp_only --windows_cpp_build_type=\"MTd\"
# consoles are a different group because consoles are a limited resource compared to Windows/Linux nodes.
- group: consoles
<<: *windows_agent
steps:
- label: "ps4"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"ps4\""
- label: "xbox-one"
command: "ci/private/worker_sdk/test_bazel.sh --cpp_only --windows_cpp_build_type=\"xbone\""
# following - these are here for illustrative purposes only.
- wait:
# here, out-of-process testing happens, but still on a single node
- group: local-integration-testing
- wait:
# here, out-of-process testing happens, involving cloud resources
- group: remote-system-testing
- block: promote-to-release-candidate
- group: promote-to-release-candidate
- block: promote-to-release
- group: promote-to-release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment