Skip to content

Feat: Add the ci-management-merge workflow - #109

Merged
ModeSevenIndustrialSolutions merged 4 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-107
Nov 1, 2026
Merged

ModeSevenIndustrialSolutions merged 4 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-107

Conversation

@lf-releng-code-monkey-bot

@lf-releng-code-monkey-bot lf-releng-code-monkey-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #107

Authored by an AI agent; human review required
Command Exit
bash tests/test-ci-management-merge-plan.sh 0
bash tests/test-breaking-marker.sh 0
bash tests/test-change-isolation-plan.sh 0
bash tests/test-ci-management-verify-plan.sh 0
bash tests/test-lint-plan.sh 0
bash tests/test-locate-rules.sh 0
bash tests/test-relax-matches.sh 0
bash tests/test-tox-verify-plan.sh 0
prek run --files .github/workflows/ci-management-merge.yaml tests/test-ci-management-merge-plan.sh docs/ci-management-merge.md 0
uvx zizmor --persona auditor .github/workflows/ci-management-merge.yaml examples/ci-management/gerrit-ci-management-merge.yaml 0
aislop scan --base 43522b714289096782a5fadb46e84e3013818235 --json . (0 diagnostics) 0
git log --raw --format=%h 43522b714289096782a5fadb46e84e3013818235..HEAD (no 100755/120000/160000, no mode change) 0

The github-code-monkey-bot workflow opened this pull request.
Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds; a maintainer must act on any finding that remains after that, and reviews every round before merge.

Round 7 of revision, on its base.


Adds .github/workflows/ci-management-merge.yaml (#107). After a change merges, it pushes a ci-management repository's Jenkins Job Builder tree to Jenkins. It replaces gerrit-ci-management-merge.yaml in lfit/releng-reusable-workflows.

What it does

  • plan has no checkout. It validates every input and fails closed. It deploys only when gerrit_branch names deploy_branch, as a short name or a full ref. Merges to other branches, including refs/meta/config, succeed without deploying.
  • Update, in order:
    1. It waits in a scratch bare repository under RUNNER_TEMP. Each poll fetches commits only (--filter=tree:0, no tags) into a retained remote-tracking ref, authenticating with the job token through the scratch repository's own http.extraheader, until merged_revision is an ancestor of the tip. It retries with backoff for at most five minutes. Every git command runs under timeout with the time left, and a 20 s reserve keeps a final poll after the last wait. A refused fetch or a missing branch fails at once with its own error. An EXIT trap removes the scratch repository.
    2. One actions/checkout of the exact tip that passed, with submodules and persist-credentials: false. No git command follows it.
    3. jjb-action v0.0.1 in update mode. The jenkins_password secret reaches only this step.
  • permissions: {} at the top, contents: read on Update, and no concurrency. The example caller sets concurrency.

The pull request also adds the example caller with its zizmor entries, docs/ci-management-merge.md, a README section, a prek hook, and tests/test-ci-management-merge-plan.sh.

This round (7)

Copilot found that git rev-parse resolved the fetched tip with no timeout. As the maintainer asked, the fix covers every command, not just that one:

  • A bounded helper runs every git command in the wait (init, config, fetch, rev-parse, merge-base) under timeout -k 5 with the time left.
  • A fetch cut off at the limit still gives the error naming the mirror. Any other command cut off gives an error naming that command.
  • New fixtures stall each of the four local commands, and a structural check fails on any git call that bypasses the helper. The docs are updated to match.

Checks run

  • bash tests/test-ci-management-merge-plan.sh (173 fixtures) and the other tests/test-*.sh scripts
  • prek run --files <changed files>
  • zizmor --persona auditor on the workflow and the example: no findings
  • aislop against the base: no diagnostics

Not run here

A real Jenkins update, a Gerrit-dispatched run, and the token-authenticated fetch on a real runner. A pull request has neither Jenkins nor the secrets, so there is no self-caller.

For reviewers

  • The bounded / deadline / prepare helpers in the wait step, and the error each failure path gives.
  • The stalled-command fixtures use a four-second limit and real-time stalls. They take about 20 s in total.

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

lf-releng-code-monkey-bot Bot added a commit to lfreleng-bot-forks/github-code-monkey-bot that referenced this pull request Nov 1, 2026
proposal_policy.check_pull_request_text rejects every proposal whose
manifest lacks pr_title or pr_body; only on a single-commit branch
must the title also equal the commit subject. Both prompts' manifest
templates described pr_title as "the commit subject, when there is
one commit", and the prose said only when to omit it. A revision of
lfreleng-actions/generic-workflows#109, four commits, left the title
out and the round was rejected.

State in prompt/author.md and prompt/revise.md that pr_title and
pr_body are required whenever outcome is proposed, whatever the commit
count; say what the title is on a multi-commit branch, and on a
revision keep the current title unless the change warrants a new one.
Add a pre-finish check to read manifest.json back and confirm the
required fields, round_summary included on a revision. Note the
requirement in docs/DESIGN.md §18.2 and drop the expected-fail marker
from the test.

The publisher's check stays strict; the prompts were what was wrong.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>

This comment was marked as outdated.

This comment was marked as outdated.

lf-releng-code-monkey-bot Bot and others added 4 commits November 1, 2026 22:36
Add a reusable workflow that pushes a ci-management repository's
Jenkins Job Builder tree to Jenkins after a change merges, replacing
gerrit-ci-management-merge.yaml in lfit/releng-reusable-workflows.

The legacy workflow deployed whichever branch the merge landed on,
deployed the mirror's tip after a fixed sleep without checking it
held the change, and wrote the password into a workspace file. Here a
plan job validates every input before any checkout and deploys only
when gerrit_branch names deploy_branch. The Update job first waits,
in a scratch bare repository that fetches commits alone, until the
mirror's deploy branch contains merged_revision, with backoff for at
most five minutes; then one actions/checkout takes the exact tip
that passed, with its submodules, and jjb-action v0.0.1 runs in
update mode. The password reaches that step alone.

tests/test-ci-management-merge-plan.sh extracts the plan and the wait
from the workflow and runs them offline, and a prek hook runs it when
either changes.

Review round 1: Copilot found that the SECONDS guard ran only before
each sleep, so a stalled fetch could outlive the five-minute bound,
hold the caller's group until the job timeout and still deploy late.
Each wait now shrinks to the time left and 'timeout' bounds every
git command by it; a fixture shortens the bound to two seconds and
stalls the fetch through a 'git' wrapper.

Review round 2: Copilot found that the plan accepted refs git refuses,
such as '/master', 'master.', 'release/.hidden' and
'release/x.lock/topic', so a matching pair reached checkout and a
non-matching one passed as a no-op. The plan now applies the rules of
git check-ref-format as well: no empty component, so no leading,
trailing or doubled '/'; no component starting with '.' or ending in
'.lock'; no trailing '.'; and not '@' alone. Rejection fixtures cover
each case for both branch inputs.

Review round 3: Copilot found that the in-place rebuild of the tree
during the wait left a removed submodule's directory behind, and lost
actions/checkout's HTTPS rewrite of SSH submodule URLs on retry. Both
came from checking out first and rebuilding the tree with fetch,
checkout and submodule commands. As the maintainer asked, the wait
now runs before any checkout, in a scratch bare repository under
RUNNER_TEMP authenticated with the job token through its own
http.extraheader, and is deleted afterwards; a single checkout of the
verified commit follows, with no git command after it. The plan now
also checks that repository is empty or 'owner/name', since the wait
sends the token to the URL built from it. The fixtures drop the
in-place rebuild cases and add a branch that moves on past the merged
revision, the token header, the scratch repository's removal and the
single checkout.

Review round 5: Copilot found that the last wait was capped at the
time left, so it ran to the deadline and the next check returned
without fetching: with quick fetches the last real poll came at 255
seconds, and a revision that reached the mirror at 270 failed
unchecked. Each wait now stops 20 seconds short of the bound, so a
final fetch and ancestry check always follow it. The stand-in sleep
now advances the wait's clock through SECONDS instead of only
counting, a fixture publishes the revision at 270 seconds and expects
it found, and the never-arrives fixture checks that the last wait
ends before the bound.

Review round 6: Copilot found that each poll fetched into FETCH_HEAD
alone, so the next poll had no ref to negotiate from and could
download the whole history again inside the bounded window. Each
fetch now force-updates refs/remotes/origin/deploy, so later polls
offer the commits they hold, and a force-pushed deploy branch
replaces the old tip instead of failing the fetch. As the maintainer
asked, the whole wait was reviewed too: a missing deploy branch, a
missing repository or a refused token (authentication failure, HTTP
401 or 403, repository not found) now fails at once with its own
error, instead of waiting five minutes and blaming the mirror. Git
runs with GIT_TERMINAL_PROMPT=0, so it never waits on a prompt, and
LC_ALL=C, so its messages match. New fixtures cover the retained
ref, a rewritten branch, retried network errors, each refusal, and
HUP, INT and TERM removing the scratch repository.

Review round 7: Copilot found that resolving the fetched tip with
git rev-parse ran without a timeout, so a stalled command could hold
the caller's group past the five-minute bound. As the maintainer
asked, the class is fixed rather than the one command: a 'bounded'
helper runs every git command in the wait, init, config, rev-parse
and merge-base included, under timeout -k 5 with the time left, since
a partial clone can block even locally. A fetch cut off at the bound
still names the mirror; any other command cut off ends the step with
an error naming that command. Fixtures stall git init, config,
rev-parse and merge-base in turn, and a structural check fails on any
git command in the wait that does not run through the helper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Add the Gerrit caller of ci-management-merge.yaml, generated from the
verify example: a visibility gate, a comment that the run started,
the call, and a comment built from the jobs' results. It never votes.

Deploy-branch merges share a concurrency group keyed to the
repository, with cancel-in-progress false, so two updates never run
--delete-old at once, and a newer one replaces an older pending one,
whose change the newer tree carries. Its header states the file
name rule and that the caller passes deploy_branch.

Line-scoped zizmor entries exempt the placeholder pin and the Gerrit
SSH key, as for the other examples.

Review round 1: Copilot found that a merge to another branch could
replace a pending deploy-branch run in the repository-wide group and
leave that merge undeployed. Only deploy-branch merges, matched in
short or full form, now share the repository's group; any other merge
runs in a group keyed to its run and cancels nothing. The header says
so, and the zizmor line entries follow the shifted lines.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Describe the inputs and the plan's rules, the deploy-branch decision,
the merged-revision ancestry check, delete_old and jjb-action's
refusal of an empty tree, the concurrency the caller owns, egress,
and the offline fixtures. Say why there is no self-caller, and give
the migration: the input table, ONAP and O-RAN-SC moving from @main
and OpenDaylight from v0.11.0 to a release SHA, and OpenDaylight
passing workers: 1.

Review round 1: the ancestry check now says the five minutes bound the
whole step, fetches included, and lists the deadline fixture; the
concurrency section says only deploy-branch merges share the group,
so another branch's merge never cancels a pending deployment.

Review round 2: the input rules list the ref-name checks the plan
gained from git check-ref-format.

Review round 3: the job graph and the ancestry check follow the new
order: wait in a scratch bare repository first, then one checkout of
the verified tip. The page says how the wait authenticates and that
it deletes the scratch repository, lists the repository rule, and
describes the new fixtures.

Review round 5: the page gives the 20-second reserve that keeps a
final fetch after the last wait, and lists the late-arrival fixture
and the stand-in sleep's clock.

Review round 6: the ancestry check describes the retained
remote-tracking ref and a rewritten deploy branch, the fetch failures
that end the wait at once, the kill grace of timeout and the EXIT
trap; the testing list names the new fixtures.

Review round 7: the ancestry check says every git command in the
wait, local ones included, runs under timeout with the time left, and
which error a command cut off at the bound gives; the testing list
names the stalled-command fixtures and the helper check.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Add a README section for the ci-management merge workflow with a
minimal caller, and link it from the caller-filename rule, the Gerrit
support notes and the design index. Point the verify page at its
merge counterpart.

Review round 1: the README says the example groups deploy-branch
merges, following the example's concurrency change.

Review round 3: the section says the job waits for the merged revision
before it checks out the exact commit that passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Production Jenkins updates enable delete_old by default, but authenticated mirror fetching, Gerrit dispatch, and real Jenkins updates still require maintainer validation end to end on a real runner.

No open issues 🎉

Review effort: Balanced

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit e733ed0 into lfreleng-actions:main Nov 1, 2026
46 checks passed
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions deleted the code-monkey/issue-107 branch November 1, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Add the ci-management-merge reusable workflow

2 participants