|
38 | 38 | "mkdir -pv snapshots", |
39 | 39 | "tar cSvf snapshots/{instance}_{kv}.tar snapshot_artifacts", |
40 | 40 | ] |
41 | | - pipeline.build_group( |
| 41 | + |
| 42 | + def create_step_key(instance, kv): |
| 43 | + """Buildkite key for a snapshot-create step. |
| 44 | +
|
| 45 | + Keys may only contain [A-Za-z0-9_\\-:], so dots in instance names |
| 46 | + (m5n.metal) and kernel versions (linux_5.10) are sanitized to |
| 47 | + underscores. Tarball paths stay unchanged. |
| 48 | + """ |
| 49 | + return f"snap-create-{instance}-{kv}".replace(".", "_") |
| 50 | + |
| 51 | + # Key each snapshot-create step so restore steps can depend on the |
| 52 | + # specific source snapshot they need, rather than waiting for every |
| 53 | + # snapshot-create step to finish. `build_group` doesn't sanitize |
| 54 | + # substituted key values, so we set the final key after it fans out. |
| 55 | + x86_create = pipeline.build_group( |
42 | 56 | "snapshot-create", |
43 | 57 | commands, |
44 | 58 | timeout=30, |
|
49 | 63 |
|
50 | 64 | # https://github.com/firecracker-microvm/firecracker/blob/main/docs/snapshotting/snapshot-support.md#where-can-i-resume-my-snapshots |
51 | 65 | aarch64_platforms = [("al2023", "linux_6.1")] |
52 | | - pipeline.build_group( |
| 66 | + aarch64_create = pipeline.build_group( |
53 | 67 | "snapshot-create-aarch64", |
54 | 68 | commands, |
55 | 69 | timeout=30, |
56 | 70 | artifact_paths="snapshots/**/*", |
57 | 71 | instances=instances_aarch64, |
58 | 72 | platforms=aarch64_platforms, |
59 | 73 | ) |
60 | | - pipeline.add_step("wait") |
| 74 | + for grp in (x86_create, aarch64_create): |
| 75 | + for s in grp["steps"]: |
| 76 | + s["key"] = create_step_key(s["agents"]["instance"], s["agents"]["kv"]) |
61 | 77 |
|
62 | 78 | # allow-list of what instances can be restored on what other instances (in |
63 | 79 | # addition to itself). aarch64 is restricted to same-instance restores. |
|
111 | 127 | "label": f"snapshot-restore-src-{src_instance}-{src_kv}-dst-{dst_instance}-{dst_kv}", |
112 | 128 | "timeout": 30, |
113 | 129 | "agents": {"instance": dst_instance, "kv": dst_kv, "os": dst_os}, |
| 130 | + "depends_on": [create_step_key(src_instance, src_kv)], |
114 | 131 | **per_instance, |
115 | 132 | } |
116 | 133 | steps.append(step) |
|
0 commit comments