Data Sources | Git / S3 | Allow to select a branch/bucket regarding settings or env var #8723

Closed
opened 2025-12-29 20:40:22 +01:00 by adam · 3 comments
Owner

Originally created by @NeodymiumFerBore on GitHub (Oct 6, 2023).

NetBox version

3.5.9

Feature type

Change to existing functionality

Proposed functionality

One of the following, for datasources of type S3 and Git:

  • Allow to select a different bucket/branch regarding a specific settings value. This setting must be configurable via configuration.py.

  • Allow to use a netbox setting variable or an environment variable directly as the branch name.

Use case

You maintain custom scripts. In the scripts repository, you have dev, staging and master branches. You have a Git datasource to sync those scripts to your NetBox instance.
The same applies for reports.

You have multiple NetBox environments (dev, staging, prod for example), and you sync "dev" and "staging" databases from the production database.

To manage the workflow of scripts delivery, you have to manually change the datasource to point to the correct datasource (a different branch or a different bucket). Maintaining 3 different datasources is not viable.

This feature would allow to set, once and for all, a sort of mapping between a setting value and a specific branch (or bucket).

For example:

  • Solution 1:
    when netbox.settings.ENVIRONMENT == "dev", then datasource branch = "dev"
    when netbox.settings.ENVIRONMENT == "prod", then datasource branch = "v1.2.3"

  • Solution 2, with Jinja rendering for "branch" or "URL":
    datasource branch = {{ os.environ.get("A_CUSTOM_ENV_VAR_THAT_NETBOX_DOESNT_KNOW_ABOUT", "master") }}

Database changes

With solution 1, probably a change to the model behind Data Sources.
With solution 2, I don't know

External dependencies

No response

Originally created by @NeodymiumFerBore on GitHub (Oct 6, 2023). ### NetBox version 3.5.9 ### Feature type Change to existing functionality ### Proposed functionality One of the following, for datasources of type S3 and Git: - Allow to select a different bucket/branch regarding a specific settings value. This setting must be configurable via `configuration.py`. - Allow to use a netbox setting variable or an environment variable directly as the branch name. ### Use case You maintain custom scripts. In the scripts repository, you have dev, staging and master branches. You have a Git datasource to sync those scripts to your NetBox instance. The same applies for reports. You have multiple NetBox environments (dev, staging, prod for example), and you sync "dev" and "staging" databases from the production database. To manage the workflow of scripts delivery, you have to manually change the datasource to point to the correct datasource (a different branch or a different bucket). Maintaining 3 different datasources is not viable. This feature would allow to set, once and for all, a sort of mapping between a setting value and a specific branch (or bucket). For example: - Solution 1: `when netbox.settings.ENVIRONMENT == "dev", then datasource branch = "dev"` `when netbox.settings.ENVIRONMENT == "prod", then datasource branch = "v1.2.3"` - Solution 2, with Jinja rendering for "branch" or "URL": `datasource branch = {{ os.environ.get("A_CUSTOM_ENV_VAR_THAT_NETBOX_DOESNT_KNOW_ABOUT", "master") }}` ### Database changes With solution 1, probably a change to the model behind Data Sources. With solution 2, I don't know ### External dependencies _No response_
adam added the type: featurepending closure labels 2025-12-29 20:40:22 +01:00
adam closed this issue 2025-12-29 20:40:22 +01:00
Author
Owner

@NeodymiumFerBore commented on GitHub (Oct 6, 2023):

Allowing Jinja templating in "URL" and "branch" fields sounds like a simpler and more flexible method.

@NeodymiumFerBore commented on GitHub (Oct 6, 2023): Allowing Jinja templating in "URL" and "branch" fields sounds like a simpler and more flexible method.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 5, 2024):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Jan 5, 2024): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Feb 5, 2024):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Feb 5, 2024): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8723