Skip to content
Snippets Groups Projects
Commit ba1e0564 authored by qweqweasdasd's avatar qweqweasdasd
Browse files

Splitted the main in subfiles

parent ea5fd3fa
No related branches found
No related tags found
No related merge requests found
- name: Get template
get_url:
url: "{{ paas_ci_test.template_url }}"
dest: "{{ paas_ci_workdir + '/template.yaml' }}"
- name: Deployment command
set_fact:
depcreate_cmd: "orchent depcreate --ojson template.yaml -g admins/beta-testers {{ paas_ci_test.inputs }}"
- name: Create the deployment
command: "{{ depcreate_cmd }}"
args:
chdir: "{{ paas_ci_workdir }}"
register: depcreate_output
failed_when: "'CREATE' not in depcreate_output.stdout"
- set_fact:
deployment: "{{ depcreate_output.stdout|from_json }}"
- debug:
var: deployment
- 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 }}"
\ No newline at end of file
- name: Set SSH tunnel
command: ssh -f -N -L "{{ ansible_default_ipv4.address }}":9390:192.168.187.162:9390 jenkins@scans.cloud.infn.it
- set_fact:
endpoints_to_scan: "{{ paas_ci_test.endpoints_to_scan }}"
- debug:
var: endpoints_to_scan
- name: Run scan
command: "{{ python3_script_path }} {{ endpoints_to_scan }} {{ paas_ci_workdir + '/dep.json'}} {{ paas_ci_workdir }}"
register: scan_output
- name: Find report files
find:
paths: "{{paas_ci_workdir}}"
patterns: '*report.txt'
register: report_files
- name: Show reports
debug:
msg: "{{lookup('file', item.path)}}"
with_items: "{{report_files.files}}"
- name: get Severity file content
shell: cat "{{ paas_ci_workdir + '/severity.json'}}"
register: severity
- name: import severity
set_fact:
severity_json: "{{ severity.stdout | from_json }}"
- debug:
var: severity_json
- name: Get scan outputs (if successful)
assert:
that:
- severity_json.global == 'OK'
fail_msg: "SCAN FAILED - global_severity: {{ severity_json.global_severity }}"
success_msg: "SCAN PASSED - global_severity: {{ severity_json.global_severity }}"
\ No newline at end of file
- 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"
\ No newline at end of file
......@@ -7,110 +7,11 @@
- debug:
var: paas_ci_workdir
- block:
- name: Get template
get_url:
url: "{{ paas_ci_test.template_url }}"
dest: "{{ paas_ci_workdir + '/template.yaml' }}"
- name: Deployment command
set_fact:
depcreate_cmd: "orchent depcreate --ojson template.yaml -g admins/beta-testers {{ paas_ci_test.inputs }}"
- name: Create the deployment
command: "{{depcreate_cmd}}"
args:
chdir: "{{ paas_ci_workdir }}"
register: depcreate_output
failed_when: "'CREATE' not in depcreate_output.stdout"
- set_fact:
deployment: "{{ depcreate_output.stdout|from_json }}"
- debug:
var: deployment
- 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 }}"
- include: 1-create-deployment.yml
when: paas_ci_test_step == 'create_deployment'
- block:
- name: Set ssh bind
command: ssh -f -N -L "{{ ansible_default_ipv4.address }}":9390:192.168.187.162:9390 jenkins@scans.cloud.infn.it
- set_fact:
endpoints_to_scan: "{{ paas_ci_test.endpoints_to_scan }}"
- debug:
var: endpoints_to_scan
- name: Run scan
command: "{{ python3_script_path }} {{ endpoints_to_scan }} {{ paas_ci_workdir + '/dep.json'}} {{ paas_ci_workdir }}"
register: scan_output
- name: Find report files
find:
paths: "{{paas_ci_workdir}}"
patterns: '*report.txt'
register: report_files
- name: Show reports
debug:
msg: "{{lookup('file', item.path)}}"
with_items: "{{report_files.files}}"
- name: get Severity file content
shell: cat "{{ paas_ci_workdir + '/severity.json'}}"
register: severity
- name: import severity
set_fact:
severity_json: "{{ severity.stdout | from_json }}"
- debug:
var: severity_json
- name: Get scan outputs (if successful)
assert:
that:
- severity_json.global == 'OK'
fail_msg: "SCAN FAILED - global_severity: {{ severity_json.global_severity }}"
success_msg: "SCAN PASSED - global_severity: {{ severity_json.global_severity }}"
- include: 2-scan.yml
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'
- include: 3-clean.yml
when: paas_ci_test_step == 'clean'
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment