Compare commits

...

4 Commits
tesh ... codman

Author SHA1 Message Date
Simon Glass
e07c2b5fa0 CI: Push master to GitHub u-boot-concept for ReadTheDocs
Add GitHub push to the trigger_snap_builds job so that when merges
land on master, the code is also pushed to the u-boot-concept GitHub
repository, triggering ReadTheDocs documentation rebuilds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-developed-by: Claude <noreply@anthropic.com>
2025-12-21 06:25:41 -07:00
Simon Glass
f97e194c3f pickman: Fetch before force-push to update tracking refs
When using --force-with-lease with an HTTPS URL (instead of a remote
name), git cannot find the tracking refs automatically. This causes
"stale info" errors when the local tracking ref is out of date.

Fix by fetching the branch first to update the tracking ref before
pushing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-developed-by: Claude <noreply@anthropic.com>
2025-12-21 06:25:34 -07:00
Simon Glass
1430d6f339 pickman: Add --run-ci option for push-branch command
Add a --run-ci flag to push-branch that triggers the CI pipeline instead
of skipping it. This is needed when pushing rebased branches where the
MR pipeline should run to verify the changes.

Update the review agent prompt to use --run-ci when pushing after
rebase operations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-developed-by: Claude <noreply@anthropic.com>
2025-12-21 06:08:25 -07:00
Simon Glass
ac672ee117 pickman: Process MRs oldest first
Sort merge requests by created_at ascending so older MRs are processed
before newer ones. This ensures that MRs needing rebase are handled in
chronological order.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-developed-by: Claude <noreply@anthropic.com>
2025-12-21 04:48:06 -07:00
5 changed files with 34 additions and 9 deletions

View File

@@ -955,6 +955,7 @@ trigger_snap_builds:
- echo "$LAUNCHPAD_SSH_KEY" | sed 's/\\n/\n/g' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan git.launchpad.net >> ~/.ssh/known_hosts
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- git config --global user.name "GitLab CI"
@@ -972,3 +973,9 @@ trigger_snap_builds:
git commit --allow-empty -m "Trigger build: U-Boot updated to $CI_COMMIT_SHORT_SHA"
git push origin master
echo "Snap build triggers completed"
echo "Pushing to GitHub u-boot-concept for ReadTheDocs..."
cd $CI_PROJECT_DIR
git remote add github git@github.com:sjg20/u-boot-concept.git || true
git push github HEAD:master --force
echo "GitHub push completed"

View File

@@ -110,6 +110,8 @@ def parse_args(argv):
help='Git remote (default: ci)')
push_cmd.add_argument('-f', '--force', action='store_true',
help='Force push (overwrite remote branch)')
push_cmd.add_argument('--run-ci', action='store_true',
help='Run CI pipeline (default: skip for new MRs)')
test_cmd = subparsers.add_parser('test', help='Run tests')
test_cmd.add_argument('-P', '--processes', type=int,

View File

@@ -234,8 +234,8 @@ Steps to follow:
4. Run 'buildman -L --board sandbox -w -o /tmp/pickman' to verify the build
5. Create a local branch with suffix '-v2' (or increment: -v3, -v4, etc.)
6. Force push to the ORIGINAL remote branch to update the MR:
./tools/pickman/pickman push-branch {branch_name} -r {remote} -f
(this triggers a new pipeline to verify the changes)
./tools/pickman/pickman push-branch {branch_name} -r {remote} -f --run-ci
(--run-ci triggers a pipeline to verify the rebased changes)
7. Report what was done and what reply should be posted to the MR
Important:
@@ -243,6 +243,7 @@ Important:
- If a comment is unclear or cannot be addressed, note this in your report
- Local branch: {branch_name}-v2 (or -v3, -v4 etc.)
- Remote push: always to '{branch_name}' to update the existing MR
- Always use --run-ci when pushing rebases/updates to trigger verification
"""

View File

@@ -783,13 +783,16 @@ def do_push_branch(args, dbs): # pylint: disable=unused-argument
pickman commits come from the same account.
Args:
args (Namespace): Parsed arguments with 'remote', 'branch', 'force'
args (Namespace): Parsed arguments with 'remote', 'branch', 'force',
'run_ci'
dbs (Database): Database instance
Returns:
int: 0 on success, 1 on failure
"""
success = gitlab_api.push_branch(args.remote, args.branch, args.force)
skip_ci = not getattr(args, 'run_ci', False)
success = gitlab_api.push_branch(args.remote, args.branch, args.force,
skip_ci=skip_ci)
return 0 if success else 1

View File

@@ -171,7 +171,7 @@ def get_push_url(remote):
return f'https://oauth2:{token}@{host}/{proj_path}.git'
def push_branch(remote, branch, force=False):
def push_branch(remote, branch, force=False, skip_ci=True):
"""Push a branch to a remote
Uses the GitLab API token for authentication if available, so the push
@@ -182,6 +182,9 @@ def push_branch(remote, branch, force=False):
remote (str): Remote name
branch (str): Branch name
force (bool): Force push (overwrite remote branch)
skip_ci (bool): Skip CI pipeline (default True for new MRs where
MR pipeline runs automatically; set False for updates that
need pipeline verification)
Returns:
bool: True on success
@@ -191,10 +194,17 @@ def push_branch(remote, branch, force=False):
push_url = get_push_url(remote)
push_target = push_url if push_url else remote
# Skip push pipeline; MR pipeline will run when MR is created
args = ['git', 'push', '-u', '-o', 'ci.skip']
# When using --force-with-lease with an HTTPS URL (not remote name),
# git can't find tracking refs automatically. Fetch first to update
# the tracking ref, then explicitly specify which ref to check.
if force and push_url:
command.output('git', 'fetch', remote, branch)
args = ['git', 'push', '-u']
if skip_ci:
args.extend(['-o', 'ci.skip'])
if force:
args.append('--force-with-lease')
args.append(f'--force-with-lease=refs/remotes/{remote}/{branch}')
args.extend([push_target, f'HEAD:{branch}'])
command.output(*args)
return True
@@ -284,7 +294,9 @@ def get_pickman_mrs(remote, state='opened'):
glab = gitlab.Gitlab(f'https://{host}', private_token=token)
project = glab.projects.get(proj_path)
mrs = project.mergerequests.list(state=state, get_all=True)
# Sort by created_at ascending so oldest MRs are processed first
mrs = project.mergerequests.list(state=state, order_by='created_at',
sort='asc', get_all=True)
pickman_mrs = []
for merge_req in mrs:
if '[pickman]' in merge_req.title: