Skip to content
Snippets Groups Projects
Unverified Commit a2d731da authored by Timo Furrer's avatar Timo Furrer
Browse files

Make update scripts for renovate more robust

parent cfa7c715
No related branches found
No related tags found
No related merge requests found
......@@ -12,3 +12,5 @@ project_dir="$script_dir/../.."
yq --inplace '.".data".supported_versions = ([.".data".latest_version] + .".data".supported_versions | unique)' "$project_dir/opentofu_versions.yaml"
"$script_dir/update-opentofu-versions.sh"
make -C "$project_dir"
......@@ -2,14 +2,18 @@
set -e
script_dir="$(dirname "$0")"
project_dir="$script_dir/../.."
echo "Updating template files ..."
templates="templates/apply.yml templates/custom-command.yml templates/destroy.yml templates/fmt.yml templates/full-pipeline.yml templates/job-templates.yml templates/plan.yml templates/test.yml templates/validate-plan-apply.yml templates/validate-plan-destroy.yml templates/validate-plan.yml templates/validate.yml"
for template_file in $templates; do
for relative_template_file in $templates; do
template_file="$project_dir/$relative_template_file"
tmp_template_file1=$(mktemp)
tmp_template_file2=$(mktemp)
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" 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" opentofu_versions.yaml > "$tmp_template_file2"
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 '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" -
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment