Skip to content

Update rock

Update rock #6

Workflow file for this run

name: Update ROCK
on:
workflow_dispatch: {}
schedule:
- cron: '0 0,4,8,12,16,20 * * *'
jobs:
build:
uses: canonical/observability/.github/workflows/rock-update.yaml@main
with:
rock-name: prometheus
source-repo: prometheus/prometheus
check-go: true
update-script: |
# The caller must provide $application_src and $rockcraft_yaml
# $application_src: The root folder of the cloned upstream project
# $rockcraft_yaml: Path of the rockcraft.yaml to update
if [[ -z "$application_src" || -z "$rockcraft_yaml"]]; then
echo "Remember to set the variables for application_src and rockcraft_yaml!"
exit 1;
fi
## Node dependency
node_version=$(jq -r '.devDependencies."@types/node"' "$application_src"/web/ui/package.json | tr -d '^')
yq -i 'del(.parts.prometheus.build-snaps.[] | select(. == "node/*"))' "$rockcraft_yaml"
ver="${node_version%%\.*}" yq -i '.parts.prometheus.build-snaps += "node/"+strenv(ver)+"/stable"' "$rockcraft_yaml"