|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | + |
| 5 | +""" |
| 6 | +Buildkite pipeline for release QA |
| 7 | +""" |
| 8 | + |
| 9 | +from common import BKPipeline |
| 10 | + |
| 11 | +pipeline = BKPipeline(with_build_step=False) |
| 12 | + |
| 13 | +# NOTE: we need to escape $ using $$ otherwise buildkite tries to replace it instead of the shell |
| 14 | + |
| 15 | +pipeline.add_step( |
| 16 | + { |
| 17 | + "label": "Download release", |
| 18 | + "if": 'build.env("VERSION") != "dev"', |
| 19 | + "command": [ |
| 20 | + "aws s3 sync --no-sign-request s3://spec.ccfc.min/firecracker-ci/firecracker/$$VERSION release-$$VERSION", |
| 21 | + 'buildkite-agent artifact upload "release-$$VERSION/**/*"', |
| 22 | + ], |
| 23 | + }, |
| 24 | + depends_on_build=False, |
| 25 | +) |
| 26 | + |
| 27 | +pipeline.build_group_per_arch( |
| 28 | + ":building_construction: Make release", |
| 29 | + # if is a keyword for python, so we need this workaround to expand it as a kwarg |
| 30 | + **{"if": 'build.env("VERSION") == "dev"'}, |
| 31 | + command=[ |
| 32 | + "./tools/devtool -y make_release", |
| 33 | + "RELEASE_DIR=$$(echo release-*dev-$$(uname -m))", |
| 34 | + "RELEASE_SUFFIX=$${{RELEASE_DIR#release}}", |
| 35 | + "OUT_DIR=release-$$VERSION/$$(uname -m)", |
| 36 | + "mkdir -p $$OUT_DIR", |
| 37 | + ( |
| 38 | + "for f in $$RELEASE_DIR/*-$$(uname -m); do" |
| 39 | + " mv $$f $$OUT_DIR/$$(basename $$f $$RELEASE_SUFFIX);" |
| 40 | + " mv $$f.debug $$OUT_DIR/$$(basename $$f $$RELEASE_SUFFIX).debug;" |
| 41 | + "done" |
| 42 | + ), |
| 43 | + 'buildkite-agent artifact upload "release-$$VERSION/**/*"', |
| 44 | + ], |
| 45 | + depends_on_build=False, |
| 46 | +) |
| 47 | + |
| 48 | +# The devtool expects the examples to be in the same folder as the binaries to run some tests |
| 49 | +# (for example, uffd handler tests). Build them and upload them in the same folder. |
| 50 | +pipeline.build_group_per_arch( |
| 51 | + ":hammer_and_wrench: Build examples", |
| 52 | + command=[ |
| 53 | + "CARGO_TARGET=$$(uname -m)-unknown-linux-musl", |
| 54 | + "./tools/devtool -y sh cargo build --target $$CARGO_TARGET --release --examples", |
| 55 | + "mkdir -p release-$$VERSION/$$(uname -m)/", |
| 56 | + "cp -R build/cargo_target/$$CARGO_TARGET/release/examples release-$$VERSION/$$(uname -m)/", |
| 57 | + 'buildkite-agent artifact upload "release-$$VERSION/**/*"', |
| 58 | + ], |
| 59 | + depends_on_build=False, |
| 60 | +) |
| 61 | + |
| 62 | +pipeline.add_step("wait", depends_on_build=False) |
| 63 | + |
| 64 | +pipeline.add_step( |
| 65 | + { |
| 66 | + "label": ":pipeline: PR", |
| 67 | + "command": ( |
| 68 | + ".buildkite/pipeline_pr.py --binary-dir release-$$VERSION " |
| 69 | + "| jq '(..|select(.priority? != null).priority) += 100' " |
| 70 | + "| buildkite-agent pipeline upload" |
| 71 | + ), |
| 72 | + }, |
| 73 | + depends_on_build=False, |
| 74 | +) |
| 75 | + |
| 76 | +print(pipeline.to_json()) |
0 commit comments