From d273edeccd97122de1caec74243d702a652cacb9 Mon Sep 17 00:00:00 2001 From: Andreas Geissler Date: Wed, 19 Oct 2022 17:49:04 +0200 Subject: [GITLAB] Initial content for gitlab project xtesting-onap Issue-ID: INT-2150 Signed-off-by: Andreas Geissler Change-Id: I6a429e2f661474fe54b13b6513eca64f13e99b50 --- roles/legal-tern/tasks/main.yaml | 90 ++++++++++++++++++++++++++++++++++++ roles/legal-tern/templates/.netrc.j2 | 3 ++ 2 files changed, 93 insertions(+) create mode 100644 roles/legal-tern/tasks/main.yaml create mode 100644 roles/legal-tern/templates/.netrc.j2 (limited to 'roles/legal-tern') diff --git a/roles/legal-tern/tasks/main.yaml b/roles/legal-tern/tasks/main.yaml new file mode 100644 index 0000000..534672f --- /dev/null +++ b/roles/legal-tern/tasks/main.yaml @@ -0,0 +1,90 @@ +--- +- name: "Install tern prerequisites" + become: yes + ansible.builtin.apt: + name: + - attr + - fuse-overlayfs + - python3-venv + - jq + state: latest + +- name: "Install pip dependencies" + become: yes + ansible.builtin.pip: + name: + - wheel + - lftools + state: latest + +- name: "Set variables for tern run" + ansible.builtin.set_fact: + tern_output: "/tmp/tern/archives/{{ run_tiers }}/{{ run_type }}" + tern_archives: "/tmp/tern" + tern_k8_namespace: "onap" + +- name: "Delete directory with/for results" + become: yes + ansible.builtin.file: + path: "{{ tern_output }}" + state: absent + +- name: "Copy tern script" + ansible.builtin.copy: + src: scripts/run_tern.sh + dest: "{{ ansible_user_dir }}/run_tern.sh" + mode: '500' + +- name: "Copy netrc for lftool" + ansible.builtin.template: + src: .netrc.j2 + dest: "{{ ansible_user_dir }}/.netrc" + mode: 0600 + +- name: "Create directory for results" + become: yes + ansible.builtin.file: + path: "{{ tern_output }}" + state: directory + mode: '0700' + recurse: yes + owner: "{{ ansible_user }}" + +- name: "Add fuse group" + become: yes + ansible.builtin.group: + name: "fuse" + state: present + system: yes + +- name: "Add user to fuse group" + become: yes + ansible.builtin.user: + append: yes + groups: fuse + user: "{{ ansible_user }}" + +- name: "Launch tern analysis & push artifacts" + become: no + ansible.builtin.shell: + cmd: "{{ ansible_user_dir }}/run_tern.sh > {{ tern_output }}/run_tern.log" + chdir: "{{ tern_output }}" + environment: + LF_RESULTS_BACKUP: '{{ lf_results_backup }}' + POD: '{{ pod }}' + CI_PIPELINE_CREATED_AT: '{{ ci_pipeline_created_at }}' + TERN_LOCATION: '{{ ansible_user_dir }}' + K8NAMESPACE: '{{ tern_k8_namespace }}' + ARCHIVES_LOCATION: '{{ tern_archives }}' + async: 259200 # 60*60*24*3 = 3 days + poll: 0 # dont wait for it + register: tern_analysis + +- name: "Check if tern analysis is running" + become: no + async_status: + jid: "{{ tern_analysis.ansible_job_id }}" + register: tern_result + until: tern_result.started + retries: 10 + delay: 10 diff --git a/roles/legal-tern/templates/.netrc.j2 b/roles/legal-tern/templates/.netrc.j2 new file mode 100644 index 0000000..e4c22e3 --- /dev/null +++ b/roles/legal-tern/templates/.netrc.j2 @@ -0,0 +1,3 @@ +machine nexus.onap.org +login onap-integration +password {{ lf_it_nexus_pwd }} -- cgit 1.2.3-korg