diff options
author | Andreas Geissler <andreas-geissler@telekom.de> | 2022-10-19 17:49:04 +0200 |
---|---|---|
committer | Andreas Geissler <andreas-geissler@telekom.de> | 2022-10-19 17:52:13 +0200 |
commit | d273edeccd97122de1caec74243d702a652cacb9 (patch) | |
tree | 4414e752f4a6aebc6fa29ef79b36d9b5f5571858 /roles/legal-tern | |
parent | ed3c78887493baa5855ac5256683b68ab7b74073 (diff) |
[GITLAB] Initial content for gitlab project xtesting-onap
Issue-ID: INT-2150
Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
Change-Id: I6a429e2f661474fe54b13b6513eca64f13e99b50
Diffstat (limited to 'roles/legal-tern')
-rw-r--r-- | roles/legal-tern/tasks/main.yaml | 90 | ||||
-rw-r--r-- | roles/legal-tern/templates/.netrc.j2 | 3 |
2 files changed, 93 insertions, 0 deletions
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 }} |