Skip to content

feat: add GitLab support for loading specs from remote repositories#2222

Merged
nimrod-teich merged 1 commit into
mainfrom
feat/gitlab-spec-support
Feb 17, 2026
Merged

feat: add GitLab support for loading specs from remote repositories#2222
nimrod-teich merged 1 commit into
mainfrom
feat/gitlab-spec-support

Conversation

@nimrod-teich

Copy link
Copy Markdown
Contributor

Add --gitlab-token flag to rpcprovider, rpcconsumer, and rpcsmartrouter commands, mirroring the existing --github-token functionality. This allows loading specs from private GitLab repositories (including self-hosted instances).

Changes:

  • Add GitLabTokenFlag constant and GitLabToken field to ConsumerCmdFlags
  • Create new utils/specfetcher package with clean, idiomatic Go design
  • Extract GitHub/GitLab fetching logic from utils/keeper/spec.go
  • Support automatic provider detection from URL patterns
  • Add comprehensive documentation for URL formats in cobra_common.go

Supported URL formats:

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • read the contribution guide
  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the main branch
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

@codecov

codecov Bot commented Feb 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 21.12676% with 280 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
utils/specfetcher/fetcher.go 42.17% 83 Missing and 2 partials ⚠️
utils/specfetcher/github.go 0.00% 52 Missing ⚠️
utils/specfetcher/gitlab.go 0.00% 51 Missing ⚠️
protocol/statetracker/state_tracker.go 0.00% 35 Missing ⚠️
utils/specfetcher/expand.go 0.00% 17 Missing ⚠️
utils/specfetcher/api.go 46.42% 15 Missing ⚠️
utils/keeper/spec.go 0.00% 14 Missing ⚠️
protocol/rpcprovider/rpcprovider.go 0.00% 5 Missing ⚠️
protocol/rpcconsumer/rpcconsumer.go 0.00% 3 Missing ⚠️
protocol/rpcsmartrouter/rpcsmartrouter.go 0.00% 3 Missing ⚠️
Flag Coverage Δ
consensus 8.56% <24.27%> (+0.01%) ⬆️
protocol 34.07% <0.00%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
protocol/common/cobra_common.go 0.00% <ø> (ø)
protocol/rpcconsumer/rpcconsumer.go 0.00% <0.00%> (ø)
protocol/rpcsmartrouter/rpcsmartrouter.go 4.53% <0.00%> (-0.02%) ⬇️
protocol/rpcprovider/rpcprovider.go 1.10% <0.00%> (-0.01%) ⬇️
utils/keeper/spec.go 0.00% <0.00%> (-15.44%) ⬇️
utils/specfetcher/api.go 46.42% <46.42%> (ø)
utils/specfetcher/expand.go 0.00% <0.00%> (ø)
protocol/statetracker/state_tracker.go 0.00% <0.00%> (ø)
utils/specfetcher/gitlab.go 0.00% <0.00%> (ø)
utils/specfetcher/github.go 0.00% <0.00%> (ø)
... and 1 more

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add support for loading Lava specs from GitLab repositories alongside
the existing GitHub support. This enables users to use private GitLab
repositories for their specs configuration.

Changes:
- Add --gitlab-token flag to rpcprovider, rpcconsumer, and rpcsmartrouter
- Create new utils/specfetcher package with idiomatic design:
  - Unified Fetcher struct with configurable timeouts and concurrency
  - Provider-agnostic URL parsing (ParseRepoURL)
  - Separate GitHub and GitLab implementations
  - Public API functions (FetchSpec, FetchSpecFromGitHub, FetchSpecFromGitLab)
  - URL detection helpers (IsGitHubURL, IsGitLabURL, IsRemoteRepoURL)
- Update state_tracker.go to use new specfetcher package
- Add detailed flag documentation with URL format examples
- Update utils/keeper/spec.go with deprecated wrappers for backward compatibility
- Add comprehensive tests for the new specfetcher package

Co-authored-by: Cursor <cursoragent@cursor.com>
@nimrod-teich nimrod-teich force-pushed the feat/gitlab-spec-support branch from 8c608cc to 407e4af Compare February 15, 2026 15:44
@github-actions

Copy link
Copy Markdown

Test Results

    7 files  ± 0     86 suites  +1   31m 2s ⏱️ -19s
3 427 tests  - 19  3 426 ✅  - 19  1 💤 ±0  0 ❌ ±0 
3 653 runs   - 19  3 652 ✅  - 19  1 💤 ±0  0 ❌ ±0 

Results for commit 407e4af. ± Comparison against base commit 0ba610d.

This pull request removes 59 and adds 40 tests. Note that renamed tests count towards both.
github.com/lavanet/lava/v5/utils/keeper ‑ TestBackwardCompatibility
github.com/lavanet/lava/v5/utils/keeper ‑ TestConvertGitHubURLToAPI
github.com/lavanet/lava/v5/utils/keeper ‑ TestConvertGitHubURLToAPI/GitHub_URL_without_tree
github.com/lavanet/lava/v5/utils/keeper ‑ TestConvertGitHubURLToAPI/Invalid_URL_format
github.com/lavanet/lava/v5/utils/keeper ‑ TestConvertGitHubURLToAPI/Non-GitHub_URL
github.com/lavanet/lava/v5/utils/keeper ‑ TestConvertGitHubURLToAPI/Valid_GitHub_tree_URL
github.com/lavanet/lava/v5/utils/keeper ‑ TestConvertGitHubURLToAPI/Valid_GitHub_tree_URL_with_path
github.com/lavanet/lava/v5/utils/keeper ‑ TestConvertGitHubURLToAPI_NoDoubleSlash
github.com/lavanet/lava/v5/utils/keeper ‑ TestConvertGitHubURLToAPI_NoDoubleSlash/Root_directory
github.com/lavanet/lava/v5/utils/keeper ‑ TestConvertGitHubURLToAPI_NoDoubleSlash/Subdirectory
…
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestDefaultConfig
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestIsGitHubURL
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestIsGitHubURL/./local/path
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestIsGitHubURL//absolute/path
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestIsGitHubURL/https://github.com/org/project/tree/develop/path
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestIsGitHubURL/https://github.com/user/repo/tree/main
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestIsGitHubURL/https://gitlab.com/user/repo/-/tree/main
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestIsGitHubURL/https://gitlab.mycompany.com/team/repo/-/tree/main
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestIsGitHubURL/invalid-url
github.com/lavanet/lava/v5/utils/specfetcher ‑ TestIsGitLabURL
…

@nimrod-teich nimrod-teich merged commit 41b2987 into main Feb 17, 2026
31 checks passed
@nimrod-teich nimrod-teich deleted the feat/gitlab-spec-support branch February 17, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants