aboutsummaryrefslogtreecommitdiffstats
path: root/roles/xtesting-healthcheck/tasks/launch.yaml
blob: 5ec978b020ce2b848a9bef0836fd843ac11052ea (plain)
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
---
- block:
    - name: ensure secret is present
      community.kubernetes.k8s:
        state: present
        src: "{{ k8s_job__dir_path }}/s3-keys-{{ run_type }}.yaml"
        kubeconfig: "{{ global_local_path }}/{{ kube_conf_file }}"
      when: use_s3 | bool

    - name: start healthcheck job
      community.kubernetes.k8s:
        state: present
        src: "{{ k8s_job__dir_path }}/healthcheck-{{ run_type }}.yaml"
        kubeconfig: "{{ global_local_path }}/{{ kube_conf_file }}"

    - name: wait for end of job
      community.kubernetes.k8s_info:
        kind: Job
        name: "integration-onap-{{ run_type }}"
        namespace: "{{ onap_namespace }}"
      register: job_info
      until: (job_info.resources[0].status.succeeded is defined and
        job_info.resources[0].status.succeeded == 1) or
        (job_info.resources[0].status.failed is defined and
        job_info.resources[0].status.failed >= 1)
      retries: "{{ run_timeout }}"
      delay: 1

    - name: job has failed
      ansible.builtin.fail:
        msg: "The job has failed"
      when: job_info.resources[0].status.failed is defined and
        job_info.resources[0].status.failed >= 1

  always:
    - name: "save healthcheck {{ run_type }} results for artifacts"
      ansible.posix.synchronize:
        src: "{{ res_local_path }}/{{ run_tiers }}/{{ run_type }}"
        use_ssh_args: true
        dest: "./results/{{ run_tiers }}"
        mode: pull
        rsync_opts:
          - "--exclude=output.xml"
      ignore_errors: True
      when: not use_s3 | bool

    - name: remove secret file
      ansible.builtin.file:
        path: "{{ k8s_job__dir_path }}/s3-keys-{{ run_type }}.yaml"
        state: absent