Newer
Older
---
# tasks file for paas-ci
- name: "Check Orchestrator endpoint"
uri:
url: "{{ paas_ci_orchestrator_url }}"
dest: "{{ paas_ci_workdir + '/template.yaml' }}"
depcreate_cmd: "orchent depcreate --ojson template.yaml -g admins/beta-testers {{ paas_ci_test.inputs }}"
- name: Create the deployment
command: "{{depcreate_cmd}}"
register: depcreate_output
failed_when: "'CREATE' not in depcreate_output.stdout"
- set_fact:
deployment: "{{ depcreate_output.stdout|from_json }}"
- name: Sleep for 60 seconds and timeout
wait_for:
delay: 60
timeout: 0
- name: Check the deployment status (every 5 mins)
command: orchent depshow --ojson "{{ deployment.uuid }}"
register: depshow_output
until: "'PROGRESS' not in depshow_output.stdout"
retries: 10
delay: 300
failed_when: "'error' in depshow_output.stdout"
- set_fact:
deployment: "{{ depshow_output.stdout|from_json }}"
- name: Save result to file
copy:
dest: "{{ paas_ci_workdir }}/dep.json"
content: "{{ depshow_output.stdout }}"
- name: Get deployment status and outputs (if successful)
assert:
that:
- deployment.status == 'CREATE_COMPLETE'
fail_msg: "TEST FAILED - deployment uuid: {{ deployment.uuid }}, status: {{ deployment.status }}"
success_msg: "TEST PASSED - deployment uuid: {{ deployment.uuid }}, status: {{ deployment.status }}, outputs: {{ deployment.outputs }}"
when: paas_ci_test_step == 'create_deployment'
- set_fact:
endpoints_to_scan: "{{ paas_ci_test.endpoints_to_scan }}"
- name: Concatenate endpoints_to_scan items
set_fact:
endpoints_to_scan_list: "{{ endpoints_to_scan | join(',') }}"
command: python3 /home/gmp/script.py "{{ endpoints_to_scan_list }}" "{{ paas_ci_workdir }} '/dep.json'" "{{ paas_ci_workdir }} + '/report.txt'" "{{ paas_ci_workdir }} + '/severity'"
command: cat "{{ paas_ci_workdir }} + '/report.txt'"
register: report_output
- name: show report
debug:
var: report_output
- name: Get scan outputs (if successful)
assert:
that:
- deployment.status == 'CREATE_COMPLETE'
fail_msg: "TEST FAILED - deployment uuid: {{ deployment.uuid }}, status: {{ deployment.status }}"
success_msg: "TEST PASSED - deployment uuid: {{ deployment.uuid }}, status: {{ deployment.status }}, outputs: {{ deployment.outputs }}"
when: paas_ci_test_step == 'scan'
- block:
- set_fact:
deployment: "{{ lookup('file', paas_ci_workdir + '/dep.json') }}"
- name: Delete deployment
command: orchent depdel "{{ deployment.uuid }}"
register: depdel_output
failed_when: "'error' in depdel_output.stdout"
when: paas_ci_test_step == 'clean'