Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ terraform/lambdalabs/kconfigs/Kconfig.compute.mappings
terraform/lambdalabs/kconfigs/Kconfig.images.generated
terraform/lambdalabs/kconfigs/Kconfig.location.generated
terraform/lambdalabs/.terraform_api_key

terraform/aws/kconfigs/Kconfig.ami.generated
terraform/aws/kconfigs/Kconfig.instance.generated
terraform/aws/kconfigs/Kconfig.location.generated
terraform/aws/scripts/__pycache__/

.cloud.initialized

scripts/__pycache__/
Expand Down
22 changes: 22 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,28 @@ make fix-whitespace-last-commit

This will fix all white space only for new files you add.

### Testing Generated Kconfig Files

When working with scripts that generate Kconfig files (like `terraform/*/scripts/gen_kconfig_*`),
the indentation checker cannot properly validate Jinja2 template files (.j2) because they
can generate any kind of output, not just Kconfig.

**Correct approach**: Generate the output to a file named with "Kconfig" prefix and test that:

```bash
# Example: Testing AWS AMI Kconfig generation
cd terraform/aws/scripts
python3 gen_kconfig_ami --quiet > /tmp/Kconfig.ami.test 2>&1
python3 ../../../scripts/detect_indentation_issues.py /tmp/Kconfig.ami.test
```

The indentation checker recognizes files starting with "Kconfig" and applies the correct
rules (tabs for indentation, tab+2spaces for help text is valid).

**Why this matters**: Jinja2 templates (.j2) are generic and can generate Python, YAML,
Kconfig, or any other format. The style checker cannot determine the output format from
the template filename alone. Always test the generated output, not the template.

## Complex System Interactions

kdevops integrates multiple subsystems (Ansible, Kconfig, Git, Make) that often
Expand Down
6 changes: 3 additions & 3 deletions scripts/dynamic-cloud-kconfig.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ LAMBDALABS_KCONFIGS := $(LAMBDALABS_KCONFIG_COMPUTE) $(LAMBDALABS_KCONFIG_LOCATI

# AWS dynamic configuration
AWS_KCONFIG_DIR := terraform/aws/kconfigs
AWS_KCONFIG_AMI := $(AWS_KCONFIG_DIR)/Kconfig.ami
AWS_KCONFIG_INSTANCE := $(AWS_KCONFIG_DIR)/Kconfig.instance
AWS_KCONFIG_LOCATION := $(AWS_KCONFIG_DIR)/Kconfig.location
AWS_KCONFIG_AMI := $(AWS_KCONFIG_DIR)/Kconfig.ami.generated
AWS_KCONFIG_INSTANCE := $(AWS_KCONFIG_DIR)/Kconfig.instance.generated
AWS_KCONFIG_LOCATION := $(AWS_KCONFIG_DIR)/Kconfig.location.generated

AWS_KCONFIGS := $(AWS_KCONFIG_AMI) $(AWS_KCONFIG_INSTANCE) $(AWS_KCONFIG_LOCATION)

Expand Down
6 changes: 3 additions & 3 deletions scripts/generate_cloud_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def generate_aws_kconfig() -> bool:

# Define the script-to-output mapping
scripts_to_run = [
("gen_kconfig_ami", "Kconfig.ami"),
("gen_kconfig_instance", "Kconfig.instance"),
("gen_kconfig_location", "Kconfig.location"),
("gen_kconfig_ami", "Kconfig.ami.generated"),
("gen_kconfig_instance", "Kconfig.instance.generated"),
("gen_kconfig_location", "Kconfig.location.generated"),
]

all_success = True
Expand Down
6 changes: 6 additions & 0 deletions terraform/aws/Kconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# AWS provider configuration
#
# This file sources static wrapper files which in turn source
# dynamically generated Kconfig menu data. Run 'make cloud-config-aws'
# to populate Kconfig.*.generated with current AWS resource information.

if TERRAFORM_AWS

menu "Resource Location"
Expand Down
Loading
Loading