-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_json_exporter.yml
26 lines (26 loc) · 1.42 KB
/
test_json_exporter.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
- 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: Ensure JSON exporter CLI is working properly
shell: "cd {{ SCAPHANDRE_PATH }} && res=$(./target/debug/scaphandre --no-header json -s 4 -t 10 --process-regex=\".*prometheus.*\" | jq .consumers[0].consumption); for r in $res; do if [ $(echo \"$r > 0.0\" | bc -l) -eq 1 ]; then echo OK; else exit 1; fi; done"
register: json_result
- name: Display json result
debug:
var: json_result