Skip to content

Initial changes for dashboards automation #163

Initial changes for dashboards automation

Initial changes for dashboards automation #163

Workflow file for this run

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@v2
- 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@v2
- name: Compile dashboards
run: make build
- 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