Inject additional repositories for server and proxy#1890
Inject additional repositories for server and proxy#1890NamelessOne91 wants to merge 1 commit intoSUSE:masterfrom
Conversation
0ebcf9f to
0c8fe4b
Compare
0c8fe4b to
88ebecf
Compare
ktsamis
left a comment
There was a problem hiding this comment.
same nitpick as the other PR, sorry
|
|
||
| variable "SERVER_ADDITIONAL_REPOS" { | ||
| type = map(string) | ||
| description = "extra server repositories in the form {label = url}" |
There was a problem hiding this comment.
| 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}" |
There was a problem hiding this comment.
| 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
|
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. |
There was a problem hiding this comment.
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_REPOSandPROXY_ADDITIONAL_REPOSfor 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}") |
There was a problem hiding this comment.
Spelling error: "repositorie" should be "repositories".
| 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}") |
| for item in args.inject: | ||
| if '=' in item: | ||
| k, v = item.split('=', 1) | ||
| k, v = item.split('=', 1) |
There was a problem hiding this comment.
Trailing whitespace detected at the end of this line. Please remove it to maintain code consistency.
| k, v = item.split('=', 1) | |
| k, v = item.split('=', 1) |
| 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" |
There was a problem hiding this comment.
Trailing whitespace detected at the end of this line. Please remove it to maintain code consistency.
| commonArgs += " --custom-repositories-json ${WORKSPACE}/custom_repositories.json" | |
| commonArgs += " --custom-repositories-json ${WORKSPACE}/custom_repositories.json" |
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.