ocurrent / ocurrent/ocluster

Improve support for fetching refspecs of merge/pull requests from git (self-hosted) forges

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

Nobody has claimed this yet.

enhancement
Dominant language
OCaml
Stars
42
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Git forges have a different naming scheme for merge/pull requests.

  • GitlLab:

    fetch = +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*
    
  • GitHub:

    fetch = +refs/pull/*:refs/remotes/pull/*
    
  • Gogs/Gitea use the same scheme as GitHub.

  • Bitbucket

    • not supported on BitBucket Cloud (bitbucket.com) BCLOUD-5814;
    • supported on BitBucket Stash (self-hosted) with yet another scheme (doc):
      fetch +refs/pull-requests/*/from:refs/remotes/origin/pr/*
      

This is handled in worker/context.ml, which simply inspects the remote URL. Considering that we're mainly dealing with github.com, gitlab.com, and self-hosted GitLab instances, we check and default to their refspecs in that order.

There's apparently no standard way with git to query the remote for more info (e.g., the type of forge). We could hackishly inspect the headers for certain strings, or use forges REST/GraphQL API for self-hosted domains to detect which kind of refspec it's using.

Contributor guide

No contributing guide indexed for this repository

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 with worker/context.ml, especially the logic that inspects the remote URL and selects a refspec. Compare the documented GitHub, GitLab, Gogs/Gitea, and self-hosted Bitbucket schemes, then define support for the relevant forges so merge/pull request refs are fetched with the correct naming scheme.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github, gitlab, ocaml
Domain
ci-cd, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.