Skip to content
Snippets Groups Projects
Unverified Commit 865d0547 authored by mptr's avatar mptr Committed by mptr
Browse files

feat: add renovate shared config

parent d655ee86
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,26 @@ for relative_template_file in $templates; do ...@@ -16,7 +16,26 @@ for relative_template_file in $templates; do
tmp_template_file1=$(mktemp) tmp_template_file1=$(mktemp)
tmp_template_file2=$(mktemp) tmp_template_file2=$(mktemp)
echo "Updating $template_file ... " echo "Updating $template_file ... "
yq eval-all 'select(fileIndex == 0 and document_index == 0).spec.inputs.opentofu_version.default = select(fileIndex == 1).".data".latest_version | select(fileIndex == 0)' "$template_file" "$project_dir/opentofu_versions.yaml" > "$tmp_template_file1" yq eval-all '
yq eval-all 'select(fileIndex == 0 and document_index == 0).spec.inputs.opentofu_version.options = (select(fileIndex == 1).".data".hack_templates_supported_versions | explode(.) | flatten) | select(fileIndex == 0)' "$tmp_template_file1" "$project_dir/opentofu_versions.yaml" > "$tmp_template_file2" select(fileIndex == 0 and document_index == 0).spec.inputs.opentofu_version.default
= select(fileIndex == 1).".data".latest_version
| select(fileIndex == 0)
' "$template_file" "$project_dir/opentofu_versions.yaml" > "$tmp_template_file1"
yq eval-all '
select(fileIndex == 0 and document_index == 0).spec.inputs.opentofu_version.options
= (select(fileIndex == 1).".data".hack_templates_supported_versions
| explode(.)
| flatten
) | select(fileIndex == 0)
' "$tmp_template_file1" "$project_dir/opentofu_versions.yaml" > "$tmp_template_file2"
diff -Bw "$template_file" "$tmp_template_file2" | patch "$template_file" - diff -Bw "$template_file" "$tmp_template_file2" | patch "$template_file" -
done done
renovate_config="default.json"
echo "Updating Renovate config $renovate_config ... "
yq eval-all -p yaml -I4 -o json -i '
select(fileIndex == 0 and documentIndex == 0).packageRules[0].allowedVersions
= "<="
+ select(fileIndex == 1 and documentIndex == 0).".data".latest_version
| select(fileIndex == 0)
' "$renovate_config" "$project_dir/opentofu_versions.yaml"
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "Renovate configuration for OpenTofu versioning with CI/CD Components",
"packageRules": [
{
"matchDepNames": [
"opentofu/opentofu"
],
"fileMatch": [
"\\.gitlab-ci\\.ya?ml",
"templates/.*\\.ya?ml"
],
"allowedVersions": "<=1.8.2"
}
],
"customManagers": [
{
"customType": "regex",
"fileMatch": [
"\\.gitlab-ci\\.ya?ml",
"templates/.*\\.ya?ml"
],
"matchStrings": [
"opentofu_version:\\s*['\"](?<currentValue>[^'\"]+)['\"]"
],
"datasourceTemplate": "github-tags",
"depNameTemplate": "opentofu/opentofu",
"versioningTemplate": "semver",
"extractVersionTemplate": "^v(?<version>.*)$"
}
]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment