Skip to content
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

feature: Infrahub creates targets automatically when importing repository #5190

Open
BaptisteGi opened this issue Dec 11, 2024 · 0 comments
Open
Labels
group/backend Issue related to the backend (API Server, Git Agent) state/backlog This issue is part of the backlog type/feature New feature or request

Comments

@BaptisteGi
Copy link
Contributor

Component

API Server / GraphQL, Git Integration

Describe the Feature Request

There are two folds to this feature:

  1. Allow users to describe the target they are about to use

In my mind this could happen in .infrahub.yml file but I don't have strong opinion on that. We would basically have a new targets section:

# yaml-language-server: $schema=https://schema.infrahub.app/python-sdk/repository-config/latest.json
---
# QUERIES
queries:
  - name: device_info
    file_path: artifacts/device-info.gql

# ARTIFACTS
artifact_definitions:
  - name: Startup Config for Arista devices
    artifact_name: startup-config
    parameters:
      device_name: name__value
    content_type: text/plain
    targets: arista_devices
    transformation: arista_generate_startup

# TRANSFORMS
python_transforms:
  - name: arista_generate_startup
    class_name: StartupConfigTransform
    file_path: artifacts/startup-config.py

# TARGETS
targets:
  - name: arista_devices
    description: Group containing all Arista devices that will have a startup config artifact generated.
    label: Arista Devices
  1. Create a group per target

When we connect the repository to Infrahub, the process needs to create a group per target defined in the section, this needs to happen before we create artifacts, generators ...

Describe the Use Case

Assuming I start from a blank Infrahub instance and I want to connect a git repository containing my implementation (artifacts, schema ...). At the moment I need to, before connecting my repo, make sure the targets (aka groups) exist, otherwise the repository sync/import will simply fail.

With this feature we would remove this first step and make repository self sufficient (i.e. we would be able to import a repository directly into a blank infrahub instance). This would make repository integration more robust, allowing us to easily test repository and speed up the overall setup process!

Additional Information

No response

@BaptisteGi BaptisteGi added the type/feature New feature or request label Dec 11, 2024
@lykinsbd lykinsbd added group/backend Issue related to the backend (API Server, Git Agent) state/backlog This issue is part of the backlog labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent) state/backlog This issue is part of the backlog type/feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants