Skip to content

Commit

Permalink
Added customDatasources to renovate.sh #634
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Oct 6, 2023
1 parent 3316406 commit fccfa70
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
48 changes: 37 additions & 11 deletions scripts/renovate.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
#!/bin/bash
set -o errexit

# jq 'reduce (.tools[] | select(.renovate != null) | select(.renovate.datasource | startswith("custom.")) | { "key": .renovate.datasource, "url": .renovate.datasourceUrl, "transform": .renovate.datasourceTransformJsonata }) as $hash ([]; . + [$hash]) | [.[]] | map( { (.key): {"transform": .transform, "url": .url} } ) | add | { "customDatasources": . }' metadata.json
jq '
.tools as $tools |
reduce (
$tools[] |
select(.renovate != null) |
select(.renovate.datasource | startswith("custom.")) |
{
"key": .renovate.datasource[7:],
"defaultRegistryUrlTemplate": .renovate.datasourceUrl,
"format": "json",
"transformTemplates": [ .renovate.datasourceTramsformJsonata ]
}
) as $hash ([]; . + [$hash]) |
[ .[] ] | map(
{
(.key): {
"defaultRegistryUrlTemplate": .defaultRegistryUrlTemplate,
"format": .format,
"transformTemplates": .transformTemplates
}
}
) | add as $customDatasources |
jq '
{
"regexManagers": [
.tools[] |
[
$tools[] |
if .renovate != null then
{
"fileMatch": [ "^tools/" + .name + "/manifest.yaml$" ],
Expand Down Expand Up @@ -46,9 +65,10 @@ jq '
else
empty
end
],
"packageRules": [
.tools[] |
] as $regexManagers |
[
$tools[] |
if .renovate != null then
if .renovate.allowPrereleases == true then
{
Expand All @@ -64,8 +84,14 @@ jq '
else
empty
end
]
}
' metadata.json \
] as $packageRules |
{
"customDatasources": $customDatasources,
"packageRules": $packageRules,
"regexManagers": $regexManagers
}
' \
metadata.json \
| jq --slurp '.[0].regexManagers += .[1].regexManagers | .[0].packageRules += .[1].packageRules | .[0].customDatasources += .[1].customDatasources | .[0]' renovate-root.json - \
>renovate.json
Empty file removed tools/curl/post_install.sh
Empty file.

0 comments on commit fccfa70

Please sign in to comment.