Skip to content

Commit

Permalink
First step towards custom datasources #634
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Oct 6, 2023
1 parent 703f16d commit 3316406
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
16 changes: 0 additions & 16 deletions renovate-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,6 @@
"patch": { "labels": [ "bump/patch", "type/renovate" ] },
"pin": { "labels": [ "bump/pin", "type/renovate" ] },
"digest": { "labels": [ "bump/digest", "type/renovate" ] },
"customDatasources": {
"curl": {
"defaultRegistryUrlTemplate": "https://api.github.com/repos/curl/curl/releases",
"format": "json",
"transformTemplates": [
"{ \"releases\": [ $[].{ \"version\": $replace( $substring( tag_name, 5 ), '_', '.' ) } ] }"
]
},
"mu-repo": {
"defaultRegistryUrlTemplate": "https://api.github.com/repos/fabioz/mu-repo/git/matching-refs/tags/mu_repo_",
"format": "json",
"transformTemplates": [
"{ \"releases\": [ $[].{ \"version\": $replace( $substring( ref, 18 ), '_', '.') } ] }"
]
}
},
"packageRules": [
{
"matchDatasources": [ "docker" ],
Expand Down
4 changes: 3 additions & 1 deletion scripts/renovate.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/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 '
{
"regexManagers": [
Expand Down Expand Up @@ -65,5 +67,5 @@ jq '
]
}
' metadata.json \
| jq --slurp '.[0].regexManagers += .[1].regexManagers | .[0].packageRules += .[1].packageRules | .[0]' renovate-root.json - \
| jq --slurp '.[0].regexManagers += .[1].regexManagers | .[0].packageRules += .[1].packageRules | .[0].customDatasources += .[1].customDatasources | .[0]' renovate-root.json - \
>renovate.json
2 changes: 2 additions & 0 deletions tools/curl/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ homepage: https://github.com/curl/curl
description: Tool and library for transferring data with URL syntax
renovate:
datasource: custom.curl
datasourceUrl: https://api.github.com/repos/curl/curl/releases
datasourceTramsformJsonata: "{ \"releases\": [ $[].{ \"version\": $replace( $substring( tag_name, 5 ), '_', '.' ) } ] }"
package: curl/curl
priority: low
2 changes: 2 additions & 0 deletions tools/mu-repo/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ homepage: http://fabioz.github.io/mu-repo
description: Help in dealing with multiple git repositories
renovate:
datasource: custom.mu-repo
datasourceUrl: https://api.github.com/repos/fabioz/mu-repo/git/matching-refs/tags/mu_repo_
datasourceTramsformJsonata: "{ \"releases\": [ $[].{ \"version\": $replace( $substring( ref, 18 ), '_', '.') } ] }"
package: fabioz/mu-repo
priority: low

0 comments on commit 3316406

Please sign in to comment.