| 1 | |
| 2 |
|
| 3 | |
| 4 | |
| 5 | set -eu -o pipefail
|
| 6 |
|
| 7 | version=${1?Please provide a version}
|
| 8 |
|
| 9 | case $version in
|
| 10 | v*) ;;
|
| 11 | *) echo "Version should start with 'v'"; exit 1;;
|
| 12 | esac
|
| 13 |
|
| 14 | req() {
|
| 15 | local request="$1"
|
| 16 | curl \
|
| 17 | -H 'Accept: application/vnd.github+json' \
|
| 18 | -Ssf https://api.github.com/repos/"$request"
|
| 19 | }
|
| 20 |
|
| 21 | submodule_commit() {
|
| 22 | local path="$1"
|
| 23 |
|
| 24 | jq -r --arg path "$path" 'select(.path == $path) | .sha'
|
| 25 | }
|
| 26 |
|
| 27 | netdata_submodules="$(req netdata/netdata/git/trees/"${version}"\?recursive=true | jq '.tree[] | select(.type == "commit")')"
|
| 28 |
|
| 29 | printf "_aclk_schemas_commit=%s\n" "$(echo "$netdata_submodules" | submodule_commit src/aclk/aclk-schemas)"
|
| 30 | printf "_ml_dlib_commit=%s\n" "$(echo "$netdata_submodules" | submodule_commit src/ml/dlib)"
|
| 31 | printf "_h2o_commit=%s\n" "$(echo "$netdata_submodules" | submodule_commit src/web/server/h2o/libh2o)"
|