Skip to content

[Integration][Gitlab-v2] Support resolving file:// references in file content #1562

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

Merged
merged 4 commits into from
Apr 14, 2025

Conversation

shariff-6
Copy link
Contributor

Description

What
This pull request introduces support for resolving file:// references in file content , enabling dynamic fetching of referenced file content during parsing.

Why
Resolving file:// references allows for more flexible configuration files, where content can be modularized across multiple files. This improves maintainability and supports complex workflows in GitLab projects, addressing user needs for dynamic content inclusion.

How

  • Added resolve_file_references function in gitlab/helpers/utils.py to recursively process file:// references and fetch their content.
  • Updated GitLabClient._process_file in gitlab/clients/gitlab_client.py to integrate reference resolution after parsing file content.
  • Introduced FileClientProtocol in utils.py for type-safe client interactions.
  • Added a test case in tests/clients/test_base_client.py to verify the resolution of file:// references in parsed YAML content.

Type of change

Please leave one option from the following and delete the rest:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • New Integration (non-breaking change which adds a new integration)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Non-breaking change (fix of existing functionality that will not change current behavior)
  • Documentation (added/updated documentation)

All tests should be run against the port production environment(using a testing org).

Core testing checklist

  • Integration able to create all default resources from scratch
  • Resync finishes successfully
  • Resync able to create entities
  • Resync able to update entities
  • Resync able to detect and delete entities
  • Scheduled resync able to abort existing resync and start a new one
  • Tested with at least 2 integrations from scratch
  • Tested with Kafka and Polling event listeners
  • Tested deletion of entities that don't pass the selector

Integration testing checklist

  • Integration able to create all default resources from scratch
  • Resync able to create entities
  • Resync able to update entities
  • Resync able to detect and delete entities
  • Resync finishes successfully
  • If new resource kind is added or updated in the integration, add example raw data, mapping and expected result to the examples folder in the integration directory.
  • If resource kind is updated, run the integration with the example data and check if the expected result is achieved
  • If new resource kind is added or updated, validate that live-events for that resource are working as expected
  • Docs PR link here

Preflight checklist

  • Handled rate limiting
  • Handled pagination
  • Implemented the code in async
  • Support Multi account

Screenshots

Include screenshots from your environment showing how the resources of the integration will look.

API Documentation

Provide links to the API documentation used for this integration.

- Implemented resolve_file_references in utils to fetch and replace file:// references in parsed content
- Updated GitLabClient._process_file to handle file reference resolution
- Added FileClientProtocol for type safety
- Included test case for file reference processing
@shariff-6 shariff-6 requested review from mk-armah and Tankilevitch and removed request for mk-armah April 13, 2025 22:26
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1562.d1ftd8v2gowp8w.amplifyapp.com

Refactors file reference resolution functionality by moving it from utils.py to the GitLabClient class, eliminating the need for a protocol interface.
@shariff-6 shariff-6 requested a review from mk-armah April 14, 2025 10:39
@mk-armah mk-armah merged commit 02be873 into main Apr 14, 2025
17 checks passed
@mk-armah mk-armah deleted the feat_process_file_references_in_parsed_content branch April 14, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants