-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprometheus_in_docker_test.yml
32 lines (32 loc) · 1.83 KB
/
prometheus_in_docker_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
- hosts: all
tasks:
- name: show parameters coming from github
debug:
msg: "Request coming from github: |
actor: {{ github_actor | default('undefined') }}
repo: {{ github_repository | default('undefined') }}
workflow: {{ github_workflow | default('undefined') }} workspace: {{ github_workspace | default('undefined') }} event_name: {{ github_event_name | default('undefined') }} event_path: {{ github_event_path | default('undefined') }}
sha: {{ github_sha | default('undefined') }}
ref: {{ github_ref | default('undefined') }}
head_ref: {{ github_head_ref | default('undefined') }}
base_ref: {{ github_base_ref | default('undefined')}}
server_url: {{ github_server_url | default('undefined')}}
"
- fail:
msg: Server URL is not authorized to run this job.
when: github_server_url != "https://github.com"
- fail:
msg: Repository is not authorized to run this job.
when: not "scaphandre" in github_repository
- name: rebuild the stack
shell: "cd {{ SCAPHANDRE_PATH }}/docker-compose && docker-compose -f docker-compose-dev.yaml build prometheus"
- name: boot docker stack
shell: "cd {{ SCAPHANDRE_PATH }}/docker-compose && docker-compose -f docker-compose-dev.yaml up -d"
- name: first metrics scraping test
shell: "curl -s http://localhost:8089/metrics"
- name: tests prometheus exporter
shell: sleep 25 && curl -s http://localhost:9099/api/v1/targets | jq .data.activeTargets[1].health | tr -d '"' | grep up
- name: check docker labels
shell: curl -s http://localhost:8089/metrics | grep 'container_scheduler="docker"' | grep 'container_names' | grep prometheus_1
- name: cleaning the stack
shell: "cd {{ SCAPHANDRE_PATH }}/docker-compose && docker-compose -f docker-compose-dev.yaml down"