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
21 changes: 3 additions & 18 deletions root/templates/cluster-apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,34 +74,19 @@ spec:
targetRevision: {{ .repoVersion | default $clusterForgeTargetRevision | quote }}
{{- if .repoURL }}
{{- if hasPrefix "oci://" $renderedRepoURL }}
{{- if or (eq .path ".") (not .path) }}
chart: {{ trimPrefix "oci://" $renderedRepoURL | base }}
{{- else }}
chart: {{ .path }}
{{- end }}
path: {{ .path | default "." }}
{{- else }}
path: {{ .path }}
{{- end }}
{{- else }}
path: sources/{{ .path }}
{{- end }}
{{- if or .valuesFile .valuesFiles .valuesObject .helmParameters }}
{{- if or .valuesFile .valuesObject .helmParameters }}
helm:
{{- if or .valuesFile .valuesFiles }}
valueFiles:
{{- end }}
{{- if .valuesFile }}
valueFiles:
- {{ .valuesFile }}
{{- end }}
{{- if .valuesFiles }}
{{- if kindIs "slice" .valuesFiles }}
{{- range .valuesFiles }}
- {{ . }}
{{- end }}
{{- else }}
- {{ .valuesFiles }}
{{- end }}
{{- end }}
{{- if .valuesObject }}
values: |
{{ .valuesObject | toYaml | nindent 8 }}
Expand Down
4 changes: 2 additions & 2 deletions root/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ ociRegistry:
apps:
aim-engine:
repoURL: "oci://{{ .Values.ociRegistry.dockerHub }}/aim-engine-chart"
repoVersion: "v0.2.2"
repoVersion: "0.2.2"
path: "."
namespace: aim-system
valuesFile: values.yaml
syncWave: 0
aim-engine-crds:
repoURL: "oci://{{ .Values.ociRegistry.dockerHub }}/aim-engine-crds-chart"
repoVersion: "v0.2.2"
repoVersion: "0.2.2"
path: "."
namespace: aim-system
syncWave: 0
Expand Down
5 changes: 2 additions & 3 deletions sbom/SBOM-QUICK-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The new modular validation system ensures data consistency:
2. Components Sync Check
├── Verifies components.yaml matches enabledApps from all cluster configurations
├── Checks for missing/extra components
└── Validates path/valuesFile/valuesFiles consistency across cluster files
└── Validates path/valuesFile consistency across cluster files

3. Metadata Completeness Check
├── Ensures sourceUrl and projectUrl are populated
Expand All @@ -83,8 +83,7 @@ The new modular validation system ensures data consistency:
- **projectUrl**: Main project repository (⚠️ Manual entry required - use GitHub for auto-license detection)
- **license/licenseUrl**: Auto-populated from GitHub by `update_licenses.sh`
- **path**: Auto-synced from values.yaml by generation script
- **valuesFile**: Auto-synced from values.yaml when present (single file)
- **valuesFiles**: Auto-synced from values.yaml when present (multiple files array)
- **valuesFile**: Auto-synced from values.yaml when present

## CI/CD Integration

Expand Down
44 changes: 12 additions & 32 deletions sbom/validate-components-sync.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,16 @@ while IFS= read -r app; do
values_path=""
for config_file in "$BASE_VALUES_FILE" "$SMALL_VALUES_FILE" "$MEDIUM_VALUES_FILE" "$LARGE_VALUES_FILE"; do
if [[ -f "$config_file" ]]; then
app_path=$(yq eval ".apps.\"$app\".path // \"null\"" "$config_file" 2>/dev/null || echo "null")
if [[ "$app_path" != "null" ]]; then
# Check if app exists by looking for any field (path, repoURL, namespace, etc.)
app_exists=$(yq eval ".apps.\"$app\" // \"null\"" "$config_file" 2>/dev/null || echo "null")
if [[ "$app_exists" != "null" ]]; then
app_path=$(yq eval ".apps.\"$app\".path // \"null\"" "$config_file" 2>/dev/null || echo "null")
values_path="$app_path"
break
fi
fi
done

component_path=$(yq eval ".components.\"$app\".path" "$COMPONENTS_FILE" 2>/dev/null || echo "null")

# Normalize empty string and null for comparison
Expand All @@ -122,44 +124,22 @@ while IFS= read -r app; do
echo "❌ Path mismatch for '$app': cluster-configs='$values_path' vs components.yaml='$component_path'"
fi

# Check valuesFile/valuesFiles consistency
# Check valuesFile consistency
values_file_values="null"
values_files_values="null"
config_file_source=""
for config_file in "$BASE_VALUES_FILE" "$SMALL_VALUES_FILE" "$MEDIUM_VALUES_FILE" "$LARGE_VALUES_FILE"; do
if [[ -f "$config_file" ]]; then
app_path_check=$(yq eval ".apps.\"$app\".path // \"null\"" "$config_file" 2>/dev/null || echo "null")
if [[ "$app_path_check" != "null" ]]; then
# Check if app exists by looking for any field (not just path)
app_exists=$(yq eval ".apps.\"$app\" // \"null\"" "$config_file" 2>/dev/null || echo "null")
if [[ "$app_exists" != "null" ]]; then
values_file_values=$(yq eval ".apps.\"$app\".valuesFile // \"null\"" "$config_file" 2>/dev/null || echo "null")
values_files_values=$(yq eval ".apps.\"$app\".valuesFiles // \"null\"" "$config_file" 2>/dev/null || echo "null")
config_file_source="$config_file"
break
fi
fi
done

values_file_components=$(yq eval ".components.\"$app\".valuesFile // \"null\"" "$COMPONENTS_FILE" 2>/dev/null || echo "null")
values_files_components=$(yq eval ".components.\"$app\".valuesFiles // \"null\"" "$COMPONENTS_FILE" 2>/dev/null || echo "null")

# Compare - prefer valuesFiles if present, otherwise fall back to valuesFile
if [[ "$values_files_values" != "null" ]] || [[ "$values_files_components" != "null" ]]; then
# At least one side uses valuesFiles (array) - compare as JSON to normalize formatting
if [[ "$values_files_values" != "null" ]] && [[ "$values_files_components" != "null" ]]; then
# Both have valuesFiles - convert to JSON for comparison
values_files_values_json=$(yq eval ".apps.\"$app\".valuesFiles" "$config_file_source" -o=json 2>/dev/null || echo "null")
values_files_components_json=$(yq eval ".components.\"$app\".valuesFiles" "$COMPONENTS_FILE" -o=json 2>/dev/null || echo "null")

if [[ "$values_files_values_json" != "$values_files_components_json" ]]; then
path_mismatches+=("$app valuesFiles: cluster-configs='$values_files_values_json' vs components.yaml='$values_files_components_json'")
echo "❌ ValuesFiles mismatch for '$app': cluster-configs='$values_files_values_json' vs components.yaml='$values_files_components_json'"
fi
else
# Only one side has valuesFiles - they don't match
path_mismatches+=("$app valuesFiles: cluster-configs='$values_files_values' vs components.yaml='$values_files_components'")
echo "❌ ValuesFiles mismatch for '$app': cluster-configs='$values_files_values' vs components.yaml='$values_files_components'"
fi
elif [[ "$values_file_values" != "$values_file_components" ]]; then
# Both sides use valuesFile (singular)

if [[ "$values_file_values" != "$values_file_components" ]]; then
path_mismatches+=("$app valuesFile: cluster-configs='$values_file_values' vs components.yaml='$values_file_components'")
echo "❌ ValuesFile mismatch for '$app': cluster-configs='$values_file_values' vs components.yaml='$values_file_components'"
fi
Expand Down
22 changes: 9 additions & 13 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -822,22 +822,18 @@ render_actual_helm_manifests() {
echo "{}" > "${temp_dir}/size_values.yaml"
fi

# Get additional valuesFiles if specified
# Use yq to output as JSON array, then iterate to avoid bash array syntax issues
# Get additional valuesFile if specified
local helm_value_args=()
local values_files_json
values_files_json=$(yq eval -o=json ".apps.\"$app_name\".valuesFiles // []" "${SOURCE_ROOT}/root/${VALUES_FILE}" 2>/dev/null || echo "[]")
local values_file
values_file=$(yq eval ".apps.\"$app_name\".valuesFile // \"null\"" "${SOURCE_ROOT}/root/${VALUES_FILE}" 2>/dev/null || echo "null")

# Read each value file from the JSON array
while IFS= read -r value_file; do
if [ -n "$value_file" ] && [ "$value_file" != "null" ]; then
# Resolve the path relative to the chart directory
local resolved_path="${chart_path}/${value_file}"
if [ -f "$resolved_path" ]; then
helm_value_args+=("-f" "$resolved_path")
fi
if [ -n "$values_file" ] && [ "$values_file" != "null" ]; then
# Resolve the path relative to the chart directory
local resolved_path="${chart_path}/${values_file}"
if [ -f "$resolved_path" ]; then
helm_value_args+=("-f" "$resolved_path")
fi
done < <(echo "$values_files_json" | yq eval '.[]' - 2>/dev/null || true)
fi

# Determine namespace
local namespace=$(yq eval ".apps.\"$app_name\".namespace // \"default\"" "${SOURCE_ROOT}/root/${VALUES_FILE}")
Expand Down
3 changes: 0 additions & 3 deletions sources/kaiwo/values.yaml

This file was deleted.

Loading