Skip to content

Comments

Inject additional repositories for server and proxy#1890

Open
NamelessOne91 wants to merge 1 commit intoSUSE:masterfrom
NamelessOne91:bv_inject_custom_repositories
Open

Inject additional repositories for server and proxy#1890
NamelessOne91 wants to merge 1 commit intoSUSE:masterfrom
NamelessOne91:bv_inject_custom_repositories

Conversation

@NamelessOne91
Copy link
Contributor

@NamelessOne91 NamelessOne91 commented Feb 23, 2026

Related to https://github.com/SUSE/spacewalk/issues/29582

Refactor the logic to add custom repositories for server and proxy.
This is currently done by searching for some placeholder comments in Sumaform`s files and replacing them with the list of updated repositories obtained from the JSON input.

This PR refactors makes so that the custom repositories are read from the JSON file, if present, and injected as Terraform variables via the script we use to inject also other custom values.

@NamelessOne91 NamelessOne91 force-pushed the bv_inject_custom_repositories branch from 0c8fe4b to 88ebecf Compare February 23, 2026 15:47
Copy link
Member

@ktsamis ktsamis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same nitpick as the other PR, sorry


variable "SERVER_ADDITIONAL_REPOS" {
type = map(string)
description = "extra server repositories in the form {label = url}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description = "extra server repositories in the form {label = url}"
description = "extra server repositories in the form {label = "url" }"

coming from https://github.com/uyuni-project/sumaform/blob/master/README_ADVANCED.md#custom-repos-and-packages the url needs to be in quotes


variable "PROXY_ADDITIONAL_REPOS" {
type = map(string)
description = "extra proxy repositories in the form {label = url}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description = "extra proxy repositories in the form {label = url}"
description = "extra proxy repositories in the form {label = "url" }"

coming from https://github.com/uyuni-project/sumaform/blob/master/README_ADVANCED.md#custom-repos-and-packages the url needs to be in quotes

@ktsamis
Copy link
Member

ktsamis commented Feb 23, 2026

The validation test should pass once the other PRs are merged that define the variables right?

@NamelessOne91
Copy link
Contributor Author

The validation test should pass once the other PRs are merged that define the variables right?

Yep, I`d expect it to pass once the PR marked as prerequisite is merged.

Copy link
Contributor

@maximenoel8 maximenoel8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the custom repository injection mechanism for SUSE Manager server and proxy components. Previously, custom repositories were added by searching for placeholder comments in Sumaform files and replacing them with repository lists. This PR modernizes the approach by reading repository definitions from a JSON file and injecting them as Terraform variables through the existing tfvars generation script.

Changes:

  • Added Terraform variables SERVER_ADDITIONAL_REPOS and PROXY_ADDITIONAL_REPOS for custom repository injection
  • Modified Python tfvars generator to read and inject repository data from custom_repositories.json
  • Updated Groovy pipeline to conditionally pass the custom repositories JSON file to the generator

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
terracumber_config/tf_files/variables/build-validation-variables.tf Added two new Terraform variables (SERVER_ADDITIONAL_REPOS and PROXY_ADDITIONAL_REPOS) of type map(string) with empty defaults
terracumber_config/tf_files/templates/build-validation-single-provider.tf Passed the new repository variables to the build validation module
terracumber_config/tf_files/templates/build-validation-multi-providers.tf Passed the new repository variables to the build validation module
jenkins_pipelines/scripts/tf_vars_generator/prepare_tfvars.py Added --custom-repositories-json argument and logic to parse JSON file and inject server/proxy repositories as Terraform variables
jenkins_pipelines/environments/common/pipeline-build-validation.groovy Added conditional logic to pass custom repositories JSON file path when it exists

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

with open(args.custom_repositories_json, 'r') as f:
repos: dict = json.load(f)
except Exception as e:
print(f"\n[ERROR]: Failed to parse custom repositorie JSON file at {args.custom_repositories_json}. Error: {e}")
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "repositorie" should be "repositories".

Suggested change
print(f"\n[ERROR]: Failed to parse custom repositorie JSON file at {args.custom_repositories_json}. Error: {e}")
print(f"\n[ERROR]: Failed to parse custom repositories JSON file at {args.custom_repositories_json}. Error: {e}")

Copilot uses AI. Check for mistakes.
for item in args.inject:
if '=' in item:
k, v = item.split('=', 1)
k, v = item.split('=', 1)
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected at the end of this line. Please remove it to maintain code consistency.

Suggested change
k, v = item.split('=', 1)
k, v = item.split('=', 1)

Copilot uses AI. Check for mistakes.
if (product_version) { commonArgs += " --inject PRODUCT_VERSION=${product_version}" }
if (base_os) { commonArgs += " --inject BASE_OS=${base_os}" }
if ( fileExists('custom_repositories.json')) {
commonArgs += " --custom-repositories-json ${WORKSPACE}/custom_repositories.json"
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected at the end of this line. Please remove it to maintain code consistency.

Suggested change
commonArgs += " --custom-repositories-json ${WORKSPACE}/custom_repositories.json"
commonArgs += " --custom-repositories-json ${WORKSPACE}/custom_repositories.json"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants