aboutsummaryrefslogtreecommitdiffstats
path: root/roles/run-ci/tasks/grafana_stop.yml
diff options
context:
space:
mode:
authorMarek Szwałkiewicz <marek.szwalkiewicz@external.t-mobile.pl>2023-03-01 12:27:28 +0100
committerMarek Szwałkiewicz <marek.szwalkiewicz@external.t-mobile.pl>2023-03-03 13:46:02 +0100
commit70fa03898ee412e30b6b87cf961004bf16ccaef4 (patch)
tree10cca3196bd5db69ee643316365a00f1276dba04 /roles/run-ci/tasks/grafana_stop.yml
parent0399d9842c2a5670e4ee21d45343d2ac168eee2d (diff)
[GATING] Add configuration for Azure3 gating in the fork of chained-ci
This change includes: * moving submodules of chained-ci-roles and chained-ci-vue as static folders to the repo (they were quite old and not updated for some time) * create azure access artifacts * add config for azure3 gating pipeline Issue-ID: INT-2207 Signed-off-by: Marek Szwałkiewicz <marek.szwalkiewicz@external.t-mobile.pl> Change-Id: Idb475c166d78f10ed4204153ab634110aa9093f6
Diffstat (limited to 'roles/run-ci/tasks/grafana_stop.yml')
-rw-r--r--roles/run-ci/tasks/grafana_stop.yml53
1 files changed, 53 insertions, 0 deletions
diff --git a/roles/run-ci/tasks/grafana_stop.yml b/roles/run-ci/tasks/grafana_stop.yml
new file mode 100644
index 0000000..4d5a7e7
--- /dev/null
+++ b/roles/run-ci/tasks/grafana_stop.yml
@@ -0,0 +1,53 @@
+---
+- block:
+ - name: get end time
+ set_fact:
+ time_end: "{{ lookup('pipe', 'date +%s%N | head -c 13' ) | int }}"
+
+ - name: calculate duration
+ set_fact:
+ duration:
+ "{{ ((time_end|int) - (time_start|int))/1000 }}"
+
+ - name: "update a grafana annotation start"
+ uri:
+ url:
+ "{{ grafana.api | regex_replace('\\/$', '') }}/annotations/{{
+ grafana_events.json.id }}"
+ method: PUT
+ status_code: 200
+ body_format: "json"
+ body: "{{
+ {
+ 'time': time_start | int,
+ 'tags': grafana_tags + [ result ],
+ 'text': text + '<br/>Duration (s): ' + duration
+ }
+ }}"
+ headers:
+ Content-Type: "application/json"
+ Accept: "application/json"
+ Authorization: "Bearer {{ grafana.token }}"
+
+ - name: "update a grafana annotation end"
+ uri:
+ url:
+ "{{ grafana.api | regex_replace('\\/$', '') }}/annotations/{{
+ grafana_events.json.endId }}"
+ method: PUT
+ status_code: 200
+ body_format: "json"
+ body: "{{
+ {
+ 'time': time_end | int,
+ 'tags': grafana_tags + [ result ],
+ 'text': text + '<br/>Duration (s): ' + duration
+ }
+ }}"
+ headers:
+ Content-Type: "application/json"
+ Accept: "application/json"
+ Authorization: "Bearer {{ grafana.token }}"
+
+ delegate_to: "{{ grafana.jumphost }}"
+ ignore_errors: true