Also print --migrate annotations for regular pipelines
If a regular (=non-downstream) pipeline is run with the USE_BAZELISK_MIGRATE env var, this commit ensures that Buildkite displays annotations for all flags that must be migrated, similar to the current behavior in a downstream pipeline.
@@ -1907,6 +1907,15 @@ def print_project_pipeline(
if "validate_config" in configs:
pipeline_steps += create_config_validation_steps()
+ if use_bazelisk_migrate() and not is_downstream_project:
+ # Print results of bazelisk --migrate in project pipelines that explicitly set
+ # the USE_BAZELISK_MIGRATE env var, but that are not being run as part of a
+ # downstream pipeline.
+ number = os.getenv("BUILDKITE_BUILD_NUMBER")
+ pipeline_steps += get_steps_for_aggregating_migration_results(
+ number, script_org, script_branch
+ )
+
print_pipeline_steps(pipeline_steps, handle_emergencies=not is_downstream_project)
@@ -2388,19 +2397,8 @@ def print_bazel_downstream_pipeline(
if not current_build_number:
raise BuildkiteException("Not running inside Buildkite")
if use_bazelisk_migrate():
- pipeline_steps.append({"wait": "~", "continue_on_failure": "true"})
- pipeline_steps.append(
- create_step(
- label="Aggregate incompatible flags test result",
- commands=[
- fetch_bazelcipy_command(),
- fetch_aggregate_incompatible_flags_test_result_command(),
- PLATFORMS[DEFAULT_PLATFORM]["python"]
- + " aggregate_incompatible_flags_test_result.py --build_number=%s"
- % current_build_number,
- ],
- platform=DEFAULT_PLATFORM,
- )
+ pipeline_steps += get_steps_for_aggregating_migration_results(
+ current_build_number
)
else:
pipeline_steps.append({"wait": "~", "continue_on_failure": "true"})
@@ -2440,6 +2438,27 @@ def print_bazel_downstream_pipeline(
print_pipeline_steps(pipeline_steps)
+def get_steps_for_aggregating_migration_results(current_build_number):
+ parts = [
+ PLATFORMS[DEFAULT_PLATFORM]["python"],
+ "aggregate_incompatible_flags_test_result.py",
+ "--build_number=%s" % current_build_number,
+ "--pipeline=%s" % os.getenv("BUILDKITE_PIPELINE_SLUG"),
+ ]
+ return [
+ {"wait": "~", "continue_on_failure": "true"},
+ create_step(
+ label="Aggregate incompatible flags test result",
+ commands=[
+ fetch_bazelcipy_command(),
+ fetch_aggregate_incompatible_flags_test_result_command(),
+ " ".join(parts),
+ ],
+ platform=DEFAULT_PLATFORM,
+ ),
+ ]
+
+
def bazelci_builds_download_url(platform, git_commit):
bucket_name = "bazel-testing-builds" if THIS_IS_TESTING else "bazel-builds"
return "https://storage.googleapis.com/{}/artifacts/{}/{}/bazel".format(
