Work around ansible issues using Browbeat-ML to classify pipeline builds

1. Fixed the bug where the browbeat_run.log file is empty.
2. UUID will now be grepped from the log file directly. Bypassing an
ansible issue that made grepping it directly from the registered result
impossible in specific situations.

Change-Id: Icc0bfb18d0491622d523d30412674f2cd62e80e9
This commit is contained in:
agopi 2017-06-23 17:53:08 -04:00 committed by Justin Kilpatrick
parent f94517bc7c
commit 773f06aa16
3 changed files with 4 additions and 10 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
grep -o 'UUID: [^,]*' /tmp/browbeatrun_log.log| tail -1 | grep -o ' [^,]*' | tr -d ' ' | sed 's/\x27/ /g' grep -o 'UUID: [^,]*' $1 | tail -1 | grep -o ' [^,]*' | tr -d ' ' | sed 's/\x27/ /g'

View File

@ -1,15 +1,12 @@
--- ---
- name: Echo variable to browbeatrun_log.log
shell: "echo {{browbeatrun_log}} > /tmp/browbeatrun_log.log"
- name: Copy bash file - name: Copy bash file
copy: copy:
src: uuid_extract.sh src: uuid_extract.sh
dest: /tmp dest: /tmp
- name: Parse uuid from variable - name: Parse uuid from variable
shell: sh /tmp/uuid_extract.sh shell: "sh /tmp/uuid_extract.sh {{ ansible_env.HOME }}/browbeat/results/browbeat_run.log"
register: browbeat_uuid register: browbeat_uuid
- name: Clone and Install Browbeat-ML dependencies - name: Clone and Install Browbeat-ML dependencies
@ -17,9 +14,6 @@
name: "git+https://github.com/aakarshg/Browbeat-ML#egg=bml" name: "git+https://github.com/aakarshg/Browbeat-ML#egg=bml"
virtualenv: "{{ ansible_env.HOME }}/browbeat-venv" virtualenv: "{{ ansible_env.HOME }}/browbeat-venv"
- name: Print uuid
debug: msg="{{browbeat_uuid.stdout}}"
- name: Run Browbeat-ML on uuid - name: Run Browbeat-ML on uuid
shell: "source {{ ansible_env.HOME }}/browbeat-venv/bin/activate; bml --summary-uuid {{browbeat_uuid.stdout}}" shell: "source {{ ansible_env.HOME }}/browbeat-venv/bin/activate; bml --summary-uuid {{browbeat_uuid.stdout}}"
register: browbeatml_summary register: browbeatml_summary

View File

@ -4,5 +4,5 @@
shell: shell:
"source {{ ansible_env.HOME }}/browbeat-venv/bin/activate; \ "source {{ ansible_env.HOME }}/browbeat-venv/bin/activate; \
cd {{ ansible_env.HOME }}/browbeat/; \ cd {{ ansible_env.HOME }}/browbeat/; \
python browbeat.py all | tee {{ ansible_env.HOME }}/browbeat/results/browbeat_run.log" python browbeat.py all |& tee {{ ansible_env.HOME }}/browbeat/results/browbeat_run.log"
register: browbeatrun_log