neos / neos/BuildEssentials

Make create-branch script more robust in case the jenkins job fails unexpectedly

Open
#52 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
9
Forks
10
PR merge metrics
No merged PRs in 30d

Description

While trying to create branches for 7.1 jenkins somehow failed me (for both Flow and Neos) and timed out in the middle of doing it's stuff.
See
https://jenkins.neos.io/job/flow-create-branch/20/console
https://jenkins.neos.io/blue/organizations/jenkins/neos-create-branch/detail/neos-create-branch/20/pipeline/

This lead to a couple of things:

  • seemingly not all repos had the branches created
  • not sure if all post-branch tasks were finished
  • jobs are marked as failed, so whoever is looking will see big red dots
  • restarting the jobs fails with a push error, because of history mismatch
  • unless you have admin access to all potentially affected repositories and know how to "unprotect" branches, you can not progress

So what can we do to make this process easier to recover from in the future?

  • check if remote branch already exists, if not proceed as normal
  • if branch exists, check if the remote branch is more than 1 commit ahead (git rev-list HEAD..origin/{$branch}--count)
  • if remote is more than 1 commit ahead, fail with "YOU CAN'T RESET AN EXISTING VERSION WITH CHANGES, BRO!"
  • if it's less, just do --force push and go on, writing a notice level message of "RECREATING BRANCH, DID IT FAIL THE LAST TIME?!"

To check: does the jenkins job have force-push protection overriding rights (is it in the admin group)?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the create-branch script and the linked Flow and Neos Jenkins job logs, then trace how remote branch checks and pushes are handled. Done means a rerun can recover an interrupted job safely, refuses branches with more than one unexpected commit, and reports the relevant force-push protection behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, php
Domain
build-system, ci-cd, release
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.