Skip to content

[BUG] : Git data source URL fails to load subdirectory — entire repo root is loaded instead #3180

@avi-biton

Description

@avi-biton

Describe the Bug

The documented format for specifying a subdirectory pinned to git-ref in a git data source:
github.com/<org>/<repo>.git?ref=<reference>//<path> - See documentation
does not work correctly.
Instead of loading only <path>, Conforma loads the entire repository root.
This causes silent data loading failures when the root contains YAML files incompatible with OPA's data model.

Expected Behavior

  • When using this format: github.com/release-engineering/rhtap-ec-policy.git?ref=dd1a3dd1bf2299e1da9936b89e7279b6ab443bec//data we should get only the data folder
  • No merge errors

Actual Behavior

When we used github.com/release-engineering/rhtap-ec-policy.git?ref=dd1a3dd1bf2299e1da9936b89e7279b6ab443bec//data
We encountered 3 merge errors during loading:

Error: load documents: 3 errors occurred during loading:

  • .github/workflows/update_rpm_repositories.yaml: merge error ...
  • policy.yaml: merge error

The files in the error (.github/workflows/ and policy.yaml) are at the repository root, not inside data/. Only data/ was requested.

Workaround

Placing //path before ?ref= resolves the issue:
github.com/<org>/<repo>.git//data?ref=dd1a3dd1bf2299e1da9936b89e7279b6ab443bec
See example

Possible Solution

Either:

  • Update the documentation or
  • Fix the bug if its actually a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions