Migrating dashboards to v2 Version #311
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Jsonnet CI | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- templates/** | |
- .github/** | |
pull_request: | |
branches: [ master ] | |
paths: | |
- templates/** | |
- .github/** | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Get dependencies | |
run: make deps | |
- name: Run jsonnetfmt | |
run: make format | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Compile dashboards | |
run: make v2 | |
- name: Run grafana container | |
run: sudo docker run -d -p 3000:3000 docker.io/grafana/grafana:9.4.3 | |
- name: Wait for grafana | |
run: while [[ $(curl -s -o /dev/null -w '%{http_code}' http://localhost:3000/api/health) != "200" ]]; do sleep 1; done | |
- name: Import dashboards to grafana | |
run: > | |
for t in rendered/**/*.json; do | |
echo "Importing ${t}"; | |
dashboard=$(cat ${t}); | |
echo "{\"dashboard\": ${dashboard}, \"overwrite\": true}" | | |
curl -k -Ss -XPOST -H "Content-Type: application/json" -H "Accept: application/json" -d@- | |
"http://admin:admin@localhost:3000/api/dashboards/db" -o /dev/null; | |
done |