Skip to content

fix(updater): make release-updater workflow actually work end-to-end#86

Merged
skjnldsv merged 5 commits into
mainfrom
fix/updater-multiline-version-sed
Jun 8, 2026
Merged

fix(updater): make release-updater workflow actually work end-to-end#86
skjnldsv merged 5 commits into
mainfrom
fix/updater-multiline-version-sed

Conversation

@skjnldsv

@skjnldsv skjnldsv commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

What & why

The manual release-updater run for v34.0.0 failed (and would have failed for any release). Fixing the first error uncovered a chain of further breakages — none caught by CI because the snapshot tests ran against a synthetic fixture, not the real updater_server repo. This PR fixes the whole chain and adds the missing staged-rollout coverage.

Original failure: https://github.com/nextcloud-releases/server/actions/runs/27134051124/job/80084114944

Fixes (in order they surfaced)

  1. sed: unterminated 's' command — the first_stable/prerelease paths extracted the current latest version with a grep that matched multiple scenarios in the real latest.feature (PHP-pinned ones), producing a multiline var that broke the sed. Fixed with head -1; fixture expanded to reproduce the multi-match.
  2. empty ident name (exit 128) — CI runners have no git identity. Derive it from the token owner via gh api user (falls back to github-actions[bot]).
  3. could not read Username — the gh-cloned remote had no push credentials. gh auth setup-git before push.
  4. 403 deniednextcloud-bot (RELEASE_TOKEN owner) lacked write on updater_server; granted out-of-band.
  5. gh pr create no head / non-ff push — added --head "$BRANCH" and --force push (re-runs produce fresh commits).
  6. gh pr create "already exists" on re-run — treat as success (force-push already refreshes the head); avoid gh pr edit, which needs read:org the token doesn't have.

Feature: staged-rollout scenario for partial deploys

When a release deploys to < 100%, the feature files need a dedicated Not updating … (staged rollout) scenario asserting an out-of-bucket installation gets no update. The script only generated the positive scenarios, so 30%/70% rollouts shipped without it.

Added sync_staged_rollout, keyed on the deploy percentage:

  • adds the negative scenario before its positive twin when deploy < 100%, with installation mtime = deploy + 11 (30 → 41, 70 → 81 — verified against past updater_server commits);
  • refreshes it on subsequent patches;
  • removes it at 100%.

Wired into the first_stable and patch paths (stable channel only). Also adds the GitHub release link to the generated PR body.

Testing

bash tests/updater-script/run.sh
=== Results: 10 passed, 0 failed ===

New fixtures rollout-bump (30% → 70%, mtime 41 → 81) and rollout-remove (→ 100%, scenario dropped) cover the full rollout lifecycle.

End-to-end verified live: workflow run 27137134183 is green and produced updater_server#1380, which includes the 30% staged-rollout scenario.

The first_stable and prerelease update paths extract the current latest
version from latest.feature with:

  grep -A4 'latest stable release' | grep 'Version "' | grep -oP ...

The real updater_server latest.feature holds several "latest stable"/
"latest beta" scenarios (e.g. PHP-version-pinned ones), so the grep
returned multiple version strings. The resulting multiline variable was
interpolated into a sed `s|...|...|` expression, embedding a newline and
producing:

  sed: -e expression #1, char 72: unterminated `s' command

This only surfaced in production because the test fixture's latest.feature
had a single stable + single beta scenario, so grep matched once and the
bug stayed hidden.

Fix: pipe both extractions through `head -1` (the first scenario is the
primary entry). Expand the base test fixture with the extra PHP-version
and error scenarios from the real repo so the multi-match case is covered,
and regenerate the affected expected outputs.

Signed-off-by: Barthelemy Briand <barthelemy.briand@nextcloud.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv skjnldsv added the bug Something isn't working label Jun 8, 2026
CI runners have no default git identity, so the PR-creation step failed
with 'empty ident name not allowed' (exit 128) after the feature files
were generated. Derive the identity from the token owner (GH_TOKEN ==
RELEASE_TOKEN) via 'gh api user' so commits are authored by that bot,
falling back to github-actions[bot] when the token is not a user token.

Signed-off-by: Barthelemy Briand <barthelemy.briand@nextcloud.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv skjnldsv force-pushed the fix/updater-multiline-version-sed branch from 1143284 to 3a5df57 Compare June 8, 2026 11:54
skjnldsv added 3 commits June 8, 2026 13:56
The gh-cloned updater_server remote carries no push credentials, so
'git push' failed with 'could not read Username for github.com'. Run
'gh auth setup-git' before pushing so git reuses GH_TOKEN (RELEASE_TOKEN).

Signed-off-by: Barthelemy Briand <barthelemy.briand@nextcloud.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
With --repo set, gh cannot infer the head branch from the local checkout
and aborts with 'you must first push the current branch ... or use the
--head flag'. Pass --head "$BRANCH" explicitly.

Signed-off-by: Barthelemy Briand <barthelemy.briand@nextcloud.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Re-running for the same release produces a fresh commit, so a leftover
branch from a prior run is non-fast-forward and the push is rejected.
Force-push to keep retries idempotent.

Signed-off-by: Barthelemy Briand <barthelemy.briand@nextcloud.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv skjnldsv merged commit 744902f into main Jun 8, 2026
2 checks passed
@skjnldsv skjnldsv deleted the fix/updater-multiline-version-sed branch June 8, 2026 12:11
@skjnldsv skjnldsv changed the title fix(updater): guard against multiline version match in latest.feature fix(updater): make release-updater workflow actually work end-to-end Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

1 participant