Skip to content

Enhanced --fork-owner for staging group#2064

Draft
fwag wants to merge 4 commits intomasterfrom
feature/staging_group_forkrepo
Draft

Enhanced --fork-owner for staging group#2064
fwag wants to merge 4 commits intomasterfrom
feature/staging_group_forkrepo

Conversation

@fwag
Copy link
Copy Markdown
Collaborator

@fwag fwag commented Mar 7, 2026

This PR extends git-obs staging group with two main features and fixes a test authentication bug.

--fork-owner / --fork-repo enhancements
staging group can now create new staging PRs using a fork owned by an organization instead of only the current user. Previously, specifying --fork-owner would fail when pushing because the fork remote was never added to the cloned target repo (only user-owned forks are auto-detected by Repo.clone()).

When the target PR's head repository is a fork and we have push access, try git remote set-url fork and fall back to git remote add fork if the remote doesn't exist yet.

Adds a new ssh_strict_host_key_checking field to the login config, so SSH host key verification can be disabled per-login without using command-line flags (required for behave tests).

Behave test fixes

  • Switch logins (I use git-obs login) now sets GIT_AUTHOR_* / GIT_COMMITTER_* env vars so commits are attributed to the correct Gitea user.
  • GIT_SSH_COMMAND is cleared on login switch so git-obs uses its own key management (core.sshCommand) rather than inheriting a key from a previous test user, which was causing pushes to be attributed to Admin even when running as Alice.

New behave tests
git-staging-group.feature: full integration test scenarios for the staging group command, including setup of staging PRs, label assignment, and a new scenario for --fork-owner fork creation.

Related to #2057

@fwag fwag force-pushed the feature/staging_group_forkrepo branch from fb064c1 to 4365ec8 Compare March 7, 2026 14:45
fwag added 3 commits March 7, 2026 15:52
- Introduced openSUSE/Leap product and relative submodules.
- Updated gitea.sh to create test-GitPkgB package and push to remote.
- Added feature tests for git-obs staging group command.
- Enhanced Behave GitObs class to allow dynamic login name configuration.
- Updated StagingGroupCommand to handle fork repository arguments and validations.
- Improved error handling for missing labels in pull requests.
…mmand

- staging_group: Handle missing 'fork' remote by adding it instead of
  trying to update a non-existent remote. Use try/except to gracefully
  fall back to 'git remote add' when 'set-url' fails.

- behave tests: Set git identity env vars (GIT_AUTHOR_NAME/EMAIL,
  GIT_COMMITTER_NAME/EMAIL) when switching logins so commits are
  attributed to the correct user.

- behave tests: Clear GIT_SSH_COMMAND when switching logins to allow
  git-obs to use its own SSH key management (core.sshCommand) without
  being overridden by keys from previous test users.

- Add test scenario for fork creation in a specified organization,
  verifying that --fork-owner works with org-owned forks.

Fixes authentication issues where git operations were incorrectly
attributed to Admin when running as Alice due to persisting
GIT_SSH_COMMAND environment variable.

Fixes: #2057
@fwag fwag force-pushed the feature/staging_group_forkrepo branch from 4365ec8 to e8d9890 Compare March 7, 2026 14:54
@fwag fwag requested a review from dmach March 7, 2026 14:55
…onality

- Create test-GitPkgC package with initial commits and submodule integration.
- Update staging group command to handle exceptions when updating pull requests.
- Improve SSH key management for git commands in the context of user logins.
- Refactor pull request body updates to ensure case-insensitive owner and repo references.
@fwag fwag marked this pull request as draft March 8, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant