-
Notifications
You must be signed in to change notification settings - Fork 93
feat(tools/gitlab): add read-only GitLab bridge foundation (Part of #305) #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Kaap10
wants to merge
23
commits into
apache:main
Choose a base branch
from
Kaap10:feat/tools-gitlab
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3c2c612
feat(gitlab): implement component 1 read-only package skeleton
Kaap10 b35c5f4
test(gitlab): implement component 2 offline unit tests suite
Kaap10 3aa7784
fix(gitlab): correct string interpolation and pyproject config
Kaap10 73e88db
docs(gitlab): implement component 3 docs and contracts
Kaap10 962934d
docs(gitlab): implement component 4 registry and taxonomy sync
Kaap10 0194e33
fix(validator): resolve windows test suite encoding and pathing issues
Kaap10 67239a2
feat(gitlab): implement GitLab bridge tool adapter
Kaap10 95fa943
fix(validator): improve Windows path handling and symlink compatibility
Kaap10 e835a88
docs(release-management): tighten prepare SKILL.md frontmatter length
Kaap10 960725f
fix(ci): resolve codeql alerts, gitlab contract docs, and token counts
Kaap10 55820df
fix(gitlab): satisfy documentation contract, ruff lint, and mypy typing
Kaap10 476acf8
fix(gitlab): complete readme metadata, SIM102 ruff fix, and mypy typing
Kaap10 853b154
fix(gitlab): complete readme metadata, SIM102 ruff fix, and mypy typing
Kaap10 9339331
fix(validator): remove unneeded conftest to resolve ruff and mypy sta…
Kaap10 f3ea7f8
fix(gitlab): address code review findings for auth, redirects, pagina…
Kaap10 5a00631
fix(gitlab): address maintainer review feedback on coverage, auth, re…
Kaap10 1bf90f3
Merge remote-tracking branch 'upstream/main' into feat/tools-gitlab
Kaap10 70f7b76
fix(gitlab): address maintainer review on partial coverage, paginatio…
Kaap10 1efbfea
docs(vendor-neutrality): restore skill assessment counts in generated…
Kaap10 2a5d060
fix(gitlab): address maintainer review on auth scheme, limit paginati…
Kaap10 6d60842
Merge branch 'upstream/main' into feat/tools-gitlab
Kaap10 1c0ee2c
fix(dev): make test_identical_text_inside_generated_regions_is_invisi…
Kaap10 3bcfa26
style(dev): format test_check_duplication.py with ruff
Kaap10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,4 +151,5 @@ members = [ | |
| "tools/vetted-ops", | ||
| "tools/fossil", | ||
| "tools/sourcehut", | ||
| "tools/gitlab", | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| <!-- SPDX-License-Identifier: Apache-2.0 | ||
| https://www.apache.org/licenses/LICENSE-2.0 --> | ||
|
|
||
| <!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
| <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
| **Table of Contents** | ||
|
|
||
| - [GitLab bridge](#gitlab-bridge) | ||
| - [Prerequisites](#prerequisites) | ||
| - [Configuration](#configuration) | ||
| - [Operations](#operations) | ||
| - [Usage](#usage) | ||
|
|
||
| <!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
|
||
| # GitLab bridge | ||
|
|
||
| **Capability:** contract:tracker + contract:source-control + contract:change-request | ||
|
|
||
| **Coverage:** `partial` | ||
|
|
||
| **Kind:** implementation | ||
|
|
||
| **Vendor:** GitLab | ||
|
|
||
| Read-only client for the GitLab REST API v4. | ||
|
|
||
| This bridge implements a `partial` read-only foundation for repository | ||
| metadata context under `contract:source-control`, issue listing and fetching | ||
| under `contract:tracker`, and merge request discovery, diffs, commits, and | ||
| CI pipeline status under `contract:change-request`. | ||
| Partial adapters may implement named contract verbs, but they do not satisfy | ||
| the complete contract and must not be advertised as complete/selectable backends. | ||
| Write operations and issue/MR mutations remain out of scope for this foundation. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - **Runtime:** Python 3.11+ via `uv`. | ||
| - **CLIs:** `uv`. | ||
| - **Credentials / auth:** `GITLAB_TOKEN` (Personal Access Token, OAuth Bearer token) | ||
| or `CI_JOB_TOKEN` with API access. Tokens are optional for unauthenticated reads | ||
| on public projects. | ||
| - **Auth scheme override:** `GITLAB_AUTH_SCHEME` (`PrivateToken`, `Bearer`, `JobToken`) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| can be set to override header selection explicitly. | ||
| - **Network:** Access to the configured GitLab instance; `GITLAB_INSTANCE_URL` | ||
| defaults to `https://gitlab.com`. | ||
|
|
||
| ## Configuration | ||
|
|
||
| Set `GITLAB_TOKEN` in your environment: | ||
|
|
||
| ```bash | ||
| export GITLAB_TOKEN="glpat-..." | ||
| ``` | ||
|
|
||
| For self-hosted instances (e.g. Debian Salsa, GNOME): | ||
|
|
||
| ```bash | ||
| export GITLAB_INSTANCE_URL="https://salsa.debian.org" | ||
| ``` | ||
|
|
||
| To explicitly force an authentication scheme (e.g. OAuth Bearer token vs Private Token): | ||
|
|
||
| ```bash | ||
| export GITLAB_AUTH_SCHEME="Bearer" | ||
| ``` | ||
|
|
||
| ## Operations | ||
|
|
||
| See [tool.md](tool.md) for the full operations catalogue and contract mapping. | ||
|
|
||
| ## Usage | ||
|
|
||
| List open issues for a project: | ||
|
|
||
| ```bash | ||
| uv run --project tools/gitlab magpie-gitlab issue list <project> | ||
| ``` | ||
|
|
||
| Get a merge request diff: | ||
|
|
||
| ```bash | ||
| uv run --project tools/gitlab magpie-gitlab mr diff <project> <mr_iid> | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
| <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
| **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* | ||
|
|
||
| - [GitLab Issue Template](#gitlab-issue-template) | ||
| - [Markdown Guidelines](#markdown-guidelines) | ||
|
|
||
| <!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
|
||
| <!-- SPDX-License-Identifier: Apache-2.0 | ||
| https://www.apache.org/licenses/LICENSE-2.0 --> | ||
|
|
||
| # GitLab Issue Template | ||
|
|
||
| Schema for GitLab issues and merge request bodies. | ||
|
|
||
| ## Markdown Guidelines | ||
|
|
||
| GitLab Flavored Markdown (GLFM) is used across all issue and MR descriptions: | ||
| - **Checkboxes**: Formatted as `- [ ]` and `- [x]`. | ||
| - **References**: Issues are referenced with `#ID` and MRs with `!ID`. | ||
| - **Labels**: Scoped labels often use `::` (e.g., `workflow::in-review`). | ||
|
|
||
| Ensure that the adapter correctly parses these specific constructs | ||
| when reading issue bodies. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| [build-system] | ||
| requires = ["hatchling"] | ||
| build-backend = "hatchling.build" | ||
|
|
||
| [project] | ||
| name = "magpie-gitlab" | ||
| version = "0.1.0" | ||
| description = "GitLab forge, issue tracker, and merge request bridge for Apache Magpie." | ||
| readme = "README.md" | ||
| requires-python = ">=3.11" | ||
| license = { text = "Apache-2.0" } | ||
| dependencies = [] | ||
|
|
||
| [project.scripts] | ||
| magpie-gitlab = "magpie_gitlab.cli:main" | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["src/magpie_gitlab"] | ||
|
|
||
| [tool.ruff] | ||
| line-length = 110 | ||
| target-version = "py311" | ||
| src = ["src", "tests"] | ||
|
|
||
| [tool.ruff.lint] | ||
| select = ["E", "W", "F", "I", "B", "UP", "SIM", "C4", "RUF"] | ||
| ignore = ["E501"] | ||
|
|
||
| [tool.ruff.lint.per-file-ignores] | ||
| "tests/**" = ["B", "SIM"] | ||
|
|
||
| [tool.mypy] | ||
| python_version = "3.11" | ||
| files = ["src", "tests"] | ||
| warn_unused_ignores = true | ||
| warn_redundant_casts = true | ||
| warn_unreachable = true | ||
| check_untyped_defs = true | ||
| no_implicit_optional = true | ||
| disallow_untyped_defs = true | ||
| disallow_incomplete_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "tests.*" | ||
| disallow_untyped_defs = false | ||
| disallow_incomplete_defs = false | ||
|
|
||
| [tool.pytest.ini_options] | ||
| minversion = "8.0" | ||
| addopts = "-ra -q" | ||
| testpaths = ["tests"] | ||
|
|
||
| [dependency-groups] | ||
| dev = ["magpie-dev"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| """GitLab forge, issue tracker, and merge request bridge.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from .cli import main | ||
|
|
||
| __all__ = ["main"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking. No
**Coverage:** partialline here. The adapter implements seven read-only GETs and no writes, so it is a partial foundation, not a complete tracker / source-control / change-request backend. Mirrortools/bitbucket/README.md, which carries**Coverage:** partialbetween Capability and Kind.