-
Notifications
You must be signed in to change notification settings - Fork 26
Hackweek- Refactor BV main.tf with SLC and module #1815
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
base: master
Are you sure you want to change the base?
Conversation
5787bae to
3c94932
Compare
|
The GitHub Actions fail with: (...)
╷
│ Warning: Reference to undefined provider
│
│ on modules/build_validation/main.tf line 50, in module "base_arm":
│ 50: libvirt = libvirt.suma-arm
│
│ There is no explicit declaration for local provider name "libvirt" in
│ module.build_validation_module.module.base_arm, so OpenTofu is assuming you
│ mean to pass a configuration for "hashicorp/libvirt".
│
│ If you also control the child module, add a required_providers entry named
│ "libvirt" with the source address "hashicorp/libvirt".
│
│ (and 58 more similar warnings elsewhere)
╵
Error: OpenTofu exited with code 1.
Error: Process completed with exit code 1.I wonder if we should exclude |
7302421 to
7aa8202
Compare
|
Green github actions ! |
There was a problem hiding this 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 Build Validation (BV) and SLE maintenance update pipelines by consolidating environment-specific main.tf files into generic templates configured via tfvars files. The refactoring aims to reduce code duplication and improve maintainability.
Key changes:
- Introduces generic Terraform templates for single-provider and multi-provider deployments
- Creates centralized variable definitions in
build-validation-variables.tf - Consolidates environment-specific configurations into tfvars files organized by pipeline type
- Adds location-specific configuration file (
location.tfvars) for common settings - Removes old environment-specific
main.tffiles (e.g.,Uyuni-Master-build-validation-NUE.tf) - Adds Python dependency
python-hcl2for tfvars manipulation script
Reviewed changes
Copilot reviewed 64 out of 72 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
terracumber_config/tf_files/variables/build-validation-variables.tf |
New centralized variable definitions for build validation |
terracumber_config/tf_files/tfvars/sle-update-tfvars/*.tfvars |
SLE maintenance update configurations with critical syntax errors |
terracumber_config/tf_files/tfvars/build-validation-tfvars/*.tfvars |
Build validation configurations with critical syntax errors and incorrect location values |
terracumber_config/tf_files/tfvars/location.tfvars |
Common location-specific settings for NUE and SLC |
terracumber_config/tf_files/templates/template-build-validation-*.tf |
Generic templates for single and multi-provider deployments with variable reference error |
terracumber_config/tf_files/tfvars/PR-tfvars/*.tfvars |
PR testing configurations |
jenkins_pipelines/scripts/tf_vars_generator/requirements.txt |
Python dependency for tfvars manipulation |
Various removed .tf files |
Old environment-specific main.tf files being replaced |
Critical Issues Found: Multiple syntax errors including missing equals signs in variable assignments, incorrect variable names, and wrong location values that must be fixed before merge.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
terracumber_config/tf_files/tfvars/sle-update-tfvars/suma43_sle_update_nue.tfvars
Outdated
Show resolved
Hide resolved
...mber_config/tf_files/tfvars/build-validation-tfvars/uyuni_master_build_validation_nue.tfvars
Outdated
Show resolved
Hide resolved
...umber_config/tf_files/tfvars/build-validation-tfvars/suma50_sles_build_validation_nue.tfvars
Outdated
Show resolved
Hide resolved
...mber_config/tf_files/tfvars/build-validation-tfvars/suma50_micro_build_validation_slc.tfvars
Outdated
Show resolved
Hide resolved
terracumber_config/tf_files/tfvars/sle-update-tfvars/mlm51_micro_sle_update_nue.tfvars
Outdated
Show resolved
Hide resolved
terracumber_config/tf_files/tfvars/sle-update-tfvars/suma50_sles_sle_update_nue.tfvars
Outdated
Show resolved
Hide resolved
terracumber_config/tf_files/tfvars/sle-update-tfvars/mlm51_sles_sle_update_nue.tfvars
Outdated
Show resolved
Hide resolved
...r_config/tf_files/tfvars/build-validation-tfvars/suma_continuous_build_validation_nue.tfvars
Outdated
Show resolved
Hide resolved
...mber_config/tf_files/tfvars/build-validation-tfvars/suma50_micro_build_validation_slc.tfvars
Show resolved
Hide resolved
...mber_config/tf_files/tfvars/build-validation-tfvars/suma50_micro_build_validation_nue.tfvars
Outdated
Show resolved
Hide resolved
bb95651 to
16685fe
Compare
|
The logic is becoming complex in both pipelines and terraform files, I suggest that we describe it well on the Readme file. At least, starting by the changes on this PR. |
terracumber_config/tf_files/templates/build-validation-multi-providers.tf
Show resolved
Hide resolved
efd68a7 to
23a97e6
Compare
3c81e87 to
a25fbe1
Compare
Goal
The goal of this PR is to refactor the BV (Build Validation) pipelines.
It removes all environment-specific
main.tffiles to create one genericmain.tfthat is configured usingtfvars.Changes
Pipeline Parameters
jenkins_pipelines/environments/build-validationfolder.jenkins_pipelines/environments/sle-maintenance-updatefolder.tf_fileto point to the new Terraform wrapper:susemanager-ci/terracumber_config/tf_files/templates/template-build-validation-single-provider.tfsusemanager-ci/terracumber_config/tf_files/templates/template-build-validation-multi-providers.tfdeployment_tfvars: Points to the related tfvars pipeline description.bin_path/bin_plugins_path/sumaform_backend: Removed these values from parameter declarationsGroovy Logic
File:
jenkins_pipelines/environments/common/pipeline-build-validation.groovytfvarspreparation Python script.common_paramsvariable to correctly parse the new Terraform variables file for Terracumber.deploystage:terraform.tfvarsrather than viaTF ENV.TF ENVparameters to avoid exposing values in the sumaform folder.prepare_tfvars.pyscript to updateterraform.tfvars:tfvarsdescriptions (e.g.,mlm51_micro_build_validation_nue.tfvars) and thelocations.tfvarsfile.terraform.tfvars.terraform.tfvars.use-tf-resource-cleanerandtf-resources-to-keepparameters (no longer needed withterraform.tfvars).getNodesHandlerto correctly parse parameters passed to the function (fixes previous issue).New Python Script:
prepare_tfvars.pyLocation:
jenkins_pipelines/scripts/tf_vars_generator/prepare_tfvars.pyThis script handles all
tfvarsmanipulation. It was moved here from Terracumber to avoid issues and improve clarity as a standalone script. It performs the following:-merge-files--clean,--keep-resources, and--delete-all--inject,--product-version, and--base-os--env-file,--user, and--deploy-retailNew Variables File
Location:
terracumber_config/tf_files/variables/build-validation-variables.tfmain.tf.main.tftemplate.tfvarslevel.New tfvars Files
Locations:
terracumber_config/tf_files/tfvars/build-validation-tfvars/terracumber_config/tf_files/tfvars/sle-update-tfvars/terracumber_config/tf_files/tfvars/location.tfvarslocation.tfvarsA common file for all environments declaring location-specific variables (NUE and SLC), such as domain, mirror, and extensions.
Environment Specific
tfvarsStores all environment-specific values related to a deployment. Main values include:
ENVIRONMENT_CONFIGURATION:BASE_CONFIGURATIONS: List of base configurations (one for NUE; multiple by provider for SLC).MAIL_SUBJECT: Environment mail subject.MAIL_SUBJECT_ENV_FAIL: Mail subject on failure.LOCATION: Eithernueorslc(used forlocation.tfvars).New Templates
1. Single Provider Template
terracumber_config/tf_files/templates/template-build-validation-single-provider.tfUsed for deployments requiring only one Libvirt and base configuration for x86_64 architecture minions. It links to one default Libvirt and base configuration.
2. Multi-Provider Template
terracumber_config/tf_files/templates/template-build-validation-multi-providers.tfUsed for deploying BV SLC with multiple Libvirt providers and base configurations.
Both templates call the new
build_validationmodule in Sumaform.Old main.tf descriptions
They were all removed.
Depends on:
Related issue https://github.com/SUSE/spacewalk/issues/29146