Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

ci(cua-driver): advance installer version through a pull request, not a direct main push (#5537)

Francesco Bonacci33b357f42fd0
diff --git a/.github/scripts/release_attribution.py b/.github/scripts/release_attribution.py
index dc7a1d5a51..3eb96d6da6 100644
--- a/.github/scripts/release_attribution.py
+++ b/.github/scripts/release_attribution.py
@@ -62,7 +62,7 @@ TRAILING_PR_RE = re.compile(r"\s+\(#(?P<number>\d+)\)\s*$")
LEGACY_RELEASE_BUMP_RE = re.compile(r"^Bump (?:cua-driver-rs|lume) to v\S+$", re.IGNORECASE)
PUBLISHED_INSTALLER_BUMP_RE = re.compile(
r"^chore\(cua-driver\): advance published installer version to "
- r"(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*) \[skip ci\]$",
+ r"(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?: \[skip ci\])?(?: \(#\d+\))?$",
re.IGNORECASE,
)
NOREPLY_RE = re.compile(
diff --git a/.github/scripts/tests/test_cua_driver_release_safety_wiring.py b/.github/scripts/tests/test_cua_driver_release_safety_wiring.py
index a8894fef30..368ec96bc8 100644
--- a/.github/scripts/tests/test_cua_driver_release_safety_wiring.py
+++ b/.github/scripts/tests/test_cua_driver_release_safety_wiring.py
@@ -165,7 +165,7 @@ def test_installer_bake_needs_post_publication_verification(cd: dict) -> None:
assert needs(bake) == {"release", "verify-published-signatures", "verify-published-installers"}
assert "if" not in bake
- advance = step(bake, "Advance public installer version on main")
+ advance = step(bake, "Advance public installer version through a pull request")
assert advance["env"]["VERSION"] == "${{ needs.release.outputs.version }}"
assert "--withdrawn-path \"$UPDATE_ROOT/.github/release-state/cua-driver-rs-withdrawn-versions\"" in advance["run"]
assert "validate_release_versions.py" in advance["run"]
diff --git a/.github/scripts/tests/test_cua_driver_release_wiring.py b/.github/scripts/tests/test_cua_driver_release_wiring.py
index 2fd771861d..d834ba0dec 100644
--- a/.github/scripts/tests/test_cua_driver_release_wiring.py
+++ b/.github/scripts/tests/test_cua_driver_release_wiring.py
@@ -526,7 +526,7 @@ fi
"- name: Generate post-publication GitHub App token", bake_job
)
advance = workflow.index(
- "- name: Advance public installer version on main", app_token
+ "- name: Advance public installer version through a pull request", app_token
)
self.assertLess(release_job, control_checkout)
@@ -548,8 +548,10 @@ fi
'"$UPDATE_ROOT/.github/release-state/cua-driver-rs-published-version"',
workflow,
)
- self.assertIn("-F force=false", workflow)
- self.assertIn("[skip ci]", workflow)
+ self.assertNotIn("git/refs/heads/main", workflow)
+ self.assertNotIn("[skip ci]\"", workflow)
+ self.assertIn("gh pr create", workflow)
+ self.assertIn("gh pr merge", workflow)
def test_release_installers_preserve_legacy_telemetry_state_before_cleanup(self) -> None:
installer = self.read("libs/cua-driver/scripts/_install-rust.sh")
diff --git a/.github/scripts/tests/test_release_attribution.py b/.github/scripts/tests/test_release_attribution.py
index 592ea52cea..ed705af49b 100644
--- a/.github/scripts/tests/test_release_attribution.py
+++ b/.github/scripts/tests/test_release_attribution.py
@@ -357,6 +357,9 @@ def test_published_installer_bump_subject_is_recognized_narrowly():
assert PUBLISHED_INSTALLER_BUMP_RE.match(
"chore(cua-driver): advance published installer version to 0.19.3 [skip ci]"
)
+ assert PUBLISHED_INSTALLER_BUMP_RE.match(
+ "chore(cua-driver): advance published installer version to 0.19.3 (#5536)"
+ )
assert not PUBLISHED_INSTALLER_BUMP_RE.match(
"chore(cua-driver): advance published installer version to nightly [skip ci]"
)
diff --git a/.github/workflows/cd-rust-cua-driver.yml b/.github/workflows/cd-rust-cua-driver.yml
index 2a8da2ebf6..21425e674d 100644
--- a/.github/workflows/cd-rust-cua-driver.yml
+++ b/.github/workflows/cd-rust-cua-driver.yml
@@ -1588,6 +1588,7 @@ jobs:
name: advance public installer version
needs: [release, verify-published-signatures, verify-published-installers]
runs-on: ubuntu-latest
+ timeout-minutes: 240
steps:
# The orchestration helpers and the withdrawn list come from the exact
# workflow revision; the installer files come from the latest main.
@@ -1607,7 +1608,7 @@ jobs:
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
- - name: Advance public installer version on main
+ - name: Advance public installer version through a pull request
working-directory: release-control
env:
GH_TOKEN: ${{ steps.post-publish-app-token.outputs.token }}
@@ -1652,19 +1653,35 @@ jobs:
libs/cua-driver/scripts/_install-rust.sh \
libs/cua-driver/scripts/install.ps1
git -C "$UPDATE_ROOT" commit \
- -m "chore(cua-driver): advance published installer version to ${VERSION} [skip ci]"
+ -m "chore(cua-driver): advance published installer version to ${VERSION}"
COMMIT_SHA=$(git -C "$UPDATE_ROOT" rev-parse HEAD)
- git push origin "${COMMIT_SHA}:refs/heads/${TEMP_BRANCH}" --force
- if gh api -X PATCH \
- "/repos/${{ github.repository }}/git/refs/heads/main" \
- -f sha="$COMMIT_SHA" \
- -F force=false; then
- git push origin --delete "$TEMP_BRANCH" || true
+ # main only changes through a pull request: no [skip ci], so the
+ # required checks run, and no direct ref update. The release is
+ # already published; a failure here only delays the bookkeeping.
+ ATTEMPT_BRANCH="${TEMP_BRANCH}-${ATTEMPT}"
+ git push origin "${COMMIT_SHA}:refs/heads/${ATTEMPT_BRANCH}" --force
+ PR_URL=$(gh pr create \
+ --repo "${{ github.repository }}" \
+ --base main \
+ --head "$ATTEMPT_BRANCH" \
+ --title "chore(cua-driver): advance published installer version to ${VERSION}" \
+ --body "Post-release bookkeeping for Cua Driver ${VERSION}, opened by the release workflow after the signed release and installers verified. Merges through the normal required checks.") || {
+ echo "Could not open the bookkeeping PR; retrying." >&2
+ git push origin --delete "$ATTEMPT_BRANCH" || true
+ continue
+ }
+ echo "Opened ${PR_URL}"
+
+ # Wait for the required checks, then merge. Repository auto-merge
+ # is off, so merge explicitly once they pass.
+ if timeout 40m gh pr checks "$PR_URL" --required --watch --fail-fast \
+ && gh pr merge "$PR_URL" --squash --delete-branch; then
echo "Public installers now advertise ${VERSION}."
exit 0
fi
- echo "main advanced concurrently; retrying from its new head."
+ echo "Bookkeeping PR ${PR_URL} did not merge; closing it and retrying from the new main head." >&2
+ gh pr close "$PR_URL" --delete-branch || true
done
echo "Could not advance the public installers after 5 attempts." >&2