/
get_hashes_from_commit_yaml.yaml
62 lines (51 loc) · 1.58 KB
/
get_hashes_from_commit_yaml.yaml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
- name: get commit.yaml file
get_url:
url: "{{ commit_url }}"
dest: "{{ workspace }}/commit.yaml"
force: yes
register: result
until: result is success
retries: 6
delay: 50
- name: fetch commit.yaml file to ansible controller
fetch:
dest: "/tmp/"
src: "{{ workspace }}/commit.yaml"
flat: yes
- name: load data from commit.yaml file
include_vars:
file: "/tmp/commit.yaml"
name: hashes
- name: get individual commit/distro hashes
set_fact:
distro_hash: "{{ hashes['commits'][0]['distro_hash'] }}"
commit_hash: "{{ hashes['commits'][0]['commit_hash'] }}"
- name: get individual extended hash - if it is not None
set_fact:
extended_hash: "{{ hashes['commits'][0]['extended_hash'] }}"
when: hashes['commits'][0]['extended_hash'] != 'None'
- name: print out commit_hash
debug:
msg: "{{ commit_hash }}"
- name: print out distro_hash
debug:
msg: "{{ distro_hash }}"
- name: print out extended_hash
debug:
msg: "{{ extended_hash }}"
when: extended_hash is defined
- name: converge commit/distro hashes into full_hash
set_fact:
full_hash: "{{ commit_hash }}_{{ distro_hash[:8] }}"
- name: add extended_hash to full_hash if defined
set_fact:
full_hash: "{{ full_hash }}_{{ extended_hash.split('_')[0][:8] }}_{{ extended_hash.split('_')[1][:8] }}"
when: extended_hash is defined
- name: print out full_hash
debug:
msg: "{{ full_hash }}"
- name: get component (if it exists and is not known)
set_fact:
component: "{{ hashes['commits'][0]['component'] }}"
when: get_component_from_hash|default(false)|bool