Skip to content
Merged
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
5 changes: 5 additions & 0 deletions dev-tools/bump_main_minor_freeze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ pr_cmd=(
--body "$pr_body"
--label "ci:skip-es-tests"
--label "no-backport"
# Repo policy requires a team label and a type label on every PR. :ml is
# the team label; >build marks this as a no-changelog build change. Keeping
# the automated freeze bump PR compliant on open, same as bump_version.sh.
--label ":ml"
--label ">build"
)
if [[ "${VERSION_BUMP_NO_MERGE:-}" != "true" ]]; then
if [[ "${VERSION_BUMP_MERGE_AUTO:-}" == "true" ]]; then
Expand Down
6 changes: 6 additions & 0 deletions dev-tools/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ EOF
--title "[ML] Bump version to ${target_version}"
--body "$pr_body"
--label "ci:skip-es-tests"
# Repo policy requires a team label and a type label on every PR. :ml is
# the team label; >build marks this as a no-changelog build change.
# Applying them here means the automated bump PRs open compliant rather
# than needing a human to add them by hand (e.g. #3135).
--label ":ml"
--label ">build"
Comment thread
edsavage marked this conversation as resolved.
)
if [[ "${VERSION_BUMP_NO_MERGE:-}" != "true" ]]; then
if [[ "${VERSION_BUMP_MERGE_AUTO:-}" == "true" ]]; then
Expand Down
26 changes: 26 additions & 0 deletions dev-tools/unittest/test_job_version_bump_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import json
import os
import re
import subprocess
import sys
from pathlib import Path
Expand Down Expand Up @@ -197,6 +198,31 @@ def test_create_pr_script_requires_body() -> None:
assert "--body" in proc.stderr


def _asserts_label(script: str, label: str) -> bool:
"""True if the script passes ``--label <label>`` in any common quoting style.

Tolerates double quotes, single quotes, or no quotes so a harmless requote
of the argument doesn't fail the guard while the behaviour is unchanged.
"""
pattern = rf"--label\s+(?:\"{re.escape(label)}\"|'{re.escape(label)}'|{re.escape(label)})(?:\s|\))"
return re.search(pattern, script) is not None


def test_bump_version_pr_applies_required_labels() -> None:
"""Automated bump PRs must open with the labels repo policy requires.

:ml is the team label, >build is the type label marking a no-changelog
build change, and ci:skip-es-tests keeps the ES test suite off a pure
version bump. Both automated PR creators (patch bump and main minor-freeze
bump) must open compliant instead of needing a human to add them by hand
(e.g. #3135).
"""
for name in ("bump_version.sh", "bump_main_minor_freeze.sh"):
script = (_REPO_ROOT / "dev-tools" / name).read_text()
for label in ("ci:skip-es-tests", ":ml", ">build"):
assert _asserts_label(script, label), f"{name}: missing --label {label}"


def test_phase2_minor_has_parallel_freeze_group() -> None:
pipeline = _run_phase2_minor()
group = pipeline["steps"][0]
Expand Down
Loading