From 077dc49e40c572c67d8332b7a4aa4fa8c02c7f3a Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Tue, 12 May 2020 11:43:20 +0200 Subject: [PATCH] Move CI tasks from roles to infrared_plugin/roles - create plugin roles folder with tasks required only by the plugin - remove unused roles from tobiko roles folder - link tobiko roles one by one to plugin roles folder Change-Id: If74642f04b451cffc61c55560cd5004db14475ae --- infrared_plugin/main.yaml | 54 ++------------ .../roles/tobiko-ir-deploy/defaults/main.yaml | 10 +++ .../roles/tobiko-ir-deploy/tasks/main.yaml | 61 +++++++++++++++ .../roles/tobiko-ir-init/tasks/main.yaml | 52 +++++++++++++ .../roles/tobiko-ir-jenkins/tasks/main.yaml | 4 + .../tobiko-ir-jenkins/vars}/jenkins.yaml | 0 .../roles/tobiko-ir-run}/meta/main.yaml | 0 .../roles/tobiko-ir-run/tasks/main.yaml | 63 ++++++++++++++++ roles/tests/provision.yaml | 18 ++++- roles/tests/test_infrared_plugin.yaml | 2 - roles/tobiko-all/tasks/all.yaml | 0 roles/tobiko-all/tasks/main.yaml | 28 ------- roles/tobiko-collect/meta/main.yaml | 1 - roles/tobiko-collect/tasks/collect.yaml | 50 ------------- roles/tobiko-collect/tasks/main.yaml | 52 ++++++++++++- roles/tobiko-common/defaults/main.yaml | 14 +--- roles/tobiko-configure/tasks/configure.yaml | 46 ------------ roles/tobiko-configure/tasks/main.yaml | 46 +++++++++++- roles/tobiko-deploy/defaults/main.yaml | 33 --------- roles/tobiko-deploy/meta/main.yaml | 6 -- roles/tobiko-deploy/tasks/deploy-dir.yaml | 74 ------------------- roles/tobiko-deploy/tasks/deploy.yaml | 23 ------ roles/tobiko-deploy/tasks/main.yaml | 6 -- roles/tobiko-ensure-git/defaults/main.yaml | 3 - roles/tobiko-ensure-git/tasks/git.yaml | 45 ----------- roles/tobiko-ensure-git/tasks/main.yaml | 6 -- roles/tobiko-ensure-rsync/defaults/main.yaml | 3 - roles/tobiko-ensure-rsync/meta/main.yaml | 4 - roles/tobiko-ensure-rsync/tasks/main.yaml | 6 -- roles/tobiko-ensure-rsync/tasks/rsync.yaml | 45 ----------- roles/tobiko-post-run/meta/main.yaml | 4 - roles/tobiko-pre-run/meta/main.yaml | 6 -- 32 files changed, 309 insertions(+), 456 deletions(-) create mode 100644 infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml create mode 100644 infrared_plugin/roles/tobiko-ir-deploy/tasks/main.yaml create mode 100644 infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml create mode 100644 infrared_plugin/roles/tobiko-ir-jenkins/tasks/main.yaml rename infrared_plugin/{ => roles/tobiko-ir-jenkins/vars}/jenkins.yaml (100%) rename {roles/tobiko-ensure-git => infrared_plugin/roles/tobiko-ir-run}/meta/main.yaml (100%) create mode 100644 infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml delete mode 100644 roles/tobiko-all/tasks/all.yaml delete mode 100644 roles/tobiko-all/tasks/main.yaml delete mode 100644 roles/tobiko-collect/tasks/collect.yaml delete mode 100644 roles/tobiko-configure/tasks/configure.yaml delete mode 100644 roles/tobiko-deploy/defaults/main.yaml delete mode 100644 roles/tobiko-deploy/meta/main.yaml delete mode 100644 roles/tobiko-deploy/tasks/deploy-dir.yaml delete mode 100644 roles/tobiko-deploy/tasks/deploy.yaml delete mode 100644 roles/tobiko-deploy/tasks/main.yaml delete mode 100644 roles/tobiko-ensure-git/defaults/main.yaml delete mode 100644 roles/tobiko-ensure-git/tasks/git.yaml delete mode 100644 roles/tobiko-ensure-git/tasks/main.yaml delete mode 100644 roles/tobiko-ensure-rsync/defaults/main.yaml delete mode 100644 roles/tobiko-ensure-rsync/meta/main.yaml delete mode 100644 roles/tobiko-ensure-rsync/tasks/main.yaml delete mode 100644 roles/tobiko-ensure-rsync/tasks/rsync.yaml delete mode 100644 roles/tobiko-post-run/meta/main.yaml delete mode 100644 roles/tobiko-pre-run/meta/main.yaml diff --git a/infrared_plugin/main.yaml b/infrared_plugin/main.yaml index e49c51cc2..8d10f0fab 100644 --- a/infrared_plugin/main.yaml +++ b/infrared_plugin/main.yaml @@ -1,54 +1,14 @@ --- - hosts: 'localhost' - tasks: - - name: "select test host from inventory" - set_fact: - test_host: '{{ item }}' - when: - - test_host is not defined - - item in hostvars - loop: - - undercloud-0 - - tempest - - tester - - primary - - - name: "ensure '{{ tobiko_src_dir }}' directory exists" - file: - dest: '{{ tobiko_src_dir }}' - state: directory - register: - create_tobiko_src_dir - - - name: "override tobiko_git_version because tobiko_git_refspec is '{{ tobiko_git_refspec }}'" - set_fact: - tobiko_git_version: 'FETCH_HEAD' - when: - - tobiko_git_refspec is defined - - '(tobiko_git_refspec | length) > 0' - - - name: "checkout Tobiko files from '{{ tobiko_git_repo }}' to '{{ tobiko_src_dir }}'" - git: - dest: '{{ tobiko_src_dir }}' - repo: '{{ tobiko_git_repo }}' - refspec: '{{ tobiko_git_refspec | default(omit) }}' - version: '{{ tobiko_git_version | default(omit) }}' - remote: '{{ tobiko_git_remote | default(omit) }}' - when: create_tobiko_src_dir is changed - - - name: "ensure Tobiko roles are accessible to IR plugin" - file: - src: '{{ tobiko_src_dir | realpath }}/roles' - dest: '{{ playbook_dir }}/roles' - state: link + roles: + - role: tobiko-ir-init -- hosts: - '{{ test_host | default(hostvars.localhost.test_host) | default("localhost") }}' +- hosts: > + {{ test_host | + default(hostvars.localhost.test_host) | + default('localhost') }} gather_facts: yes tasks: - - name: "include Jenkins settings" - include_vars: jenkins.yaml - when: "(lookup('env','JENKINS_URL') | length) > 0" - - include_role: name=tobiko-all + - include_role: name=tobiko-ir-run diff --git a/infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml b/infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml new file mode 100644 index 000000000..2d22baf4e --- /dev/null +++ b/infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml @@ -0,0 +1,10 @@ +--- + +deploy_dir: '' +deploy_clean: no +deploy_src_dir: '' + +deploy_git_repo: '' +deploy_git_version: '' +deploy_git_refspec: '' +deploy_git_remote: '' diff --git a/infrared_plugin/roles/tobiko-ir-deploy/tasks/main.yaml b/infrared_plugin/roles/tobiko-ir-deploy/tasks/main.yaml new file mode 100644 index 000000000..ccc5d0af9 --- /dev/null +++ b/infrared_plugin/roles/tobiko-ir-deploy/tasks/main.yaml @@ -0,0 +1,61 @@ +--- + +- name: "clean target directory '{{ deploy_dir }}'" + file: + path: "{{ deploy_dir | realpath }}" + state: absent + when: + - deploy_clean | bool + + +- name: "ensure target directory exists: '{{ deploy_dir }}'" + file: + path: "{{ deploy_dir | realpath }}" + state: directory + register: create_dest_dir + + +- name: "override deploy_git_version and deploy_src_dir because deploy_git_refspec is '{{ deploy_git_refspec }}'" + set_fact: + deploy_git_version: 'FETCH_HEAD' + deploy_src_dir: '' + when: "(deploy_git_refspec | length) > 0" + + +- name: "checkout files from '{{ deploy_git_repo }}[{{ deploy_git_refspec | default(deploy_git_version) }}]' to '{{ deploy_dir }}'" + git: + dest: '{{ deploy_dir }}' + repo: '{{ deploy_git_repo }}' + refspec: '{{ deploy_git_refspec or omit }}' + version: '{{ deploy_git_version }}' + remote: '{{ deploy_git_remote or omit }}' + force: yes + register: checkout_files + when: + - (deploy_git_version | length) > 0 + + +- name: "copy '{{ deploy_src_dir }}' to '{{ deploy_dir }}'" + synchronize: + src: "{{ deploy_src_dir | realpath }}/." + dest: "{{ deploy_dir | realpath }}" + use_ssh_args: yes + recursive: yes + rsync_opts: + - '--exclude-from={{ deploy_src_dir | realpath }}/.gitignore' + register: copy_src_dir + when: + - checkout_files is skipped + - (deploy_src_dir | length) > 0 + + +- name: "get last change details for '{{ deploy_dir }}'" # noqa 303 + command: + chdir: "{{ deploy_dir }}" + cmd: git log -n 1 + changed_when: no + register: get_git_log + + +- name: "show last change details" + debug: var=get_git_log.stdout_lines diff --git a/infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml b/infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml new file mode 100644 index 000000000..f5898f082 --- /dev/null +++ b/infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml @@ -0,0 +1,52 @@ +--- + +- name: "ensure Tobiko directory exists" + file: + path: '{{ tobiko_src_dir | realpath }}' + state: directory + register: create_tobiko_dir + + +- name: "get Tobiko files" + include_role: name=tobiko-ir-deploy + vars: + deploy_dir: '{{ tobiko_src_dir | realpath }}' + deploy_git_repo: '{{ tobiko_git_repo }}' + deploy_git_version: "{{ tobiko_git_version | default('') }}" + deploy_git_refspec: "{{ tobiko_git_refspec | default('') }}" + deploy_git_remote: '{{ tobiko_git_remote | default(omit) }}' + when: create_tobiko_dir is changed + + +- name: "find roles in directory '{{ tobiko_src_dir | realpath }}/roles'" + find: + paths: + - "{{ tobiko_src_dir | realpath }}/roles" + patterns: + - "tobiko-*" + file_type: directory + register: find_tobiko_roles + + +- name: "add links to Tobiko roles to IR plugin" + file: + src: '{{ item | realpath }}' + dest: '{{ playbook_dir }}/roles/{{ item | basename }}' + state: link + force: yes + loop: "{{ find_tobiko_roles.files | map(attribute='path') | list }}" + + +- name: "select test host from inventory" + set_fact: + test_host: '{{ item }}' + when: + - test_host is not defined + - item in hostvars + loop: + - tester-0 + - tester + - undercloud-0 + - undercloud + - tempest + - primary diff --git a/infrared_plugin/roles/tobiko-ir-jenkins/tasks/main.yaml b/infrared_plugin/roles/tobiko-ir-jenkins/tasks/main.yaml new file mode 100644 index 000000000..0b1aa70a9 --- /dev/null +++ b/infrared_plugin/roles/tobiko-ir-jenkins/tasks/main.yaml @@ -0,0 +1,4 @@ +--- + +- name: 'apply Jenkins settings' + include_vars: jenkins.yaml diff --git a/infrared_plugin/jenkins.yaml b/infrared_plugin/roles/tobiko-ir-jenkins/vars/jenkins.yaml similarity index 100% rename from infrared_plugin/jenkins.yaml rename to infrared_plugin/roles/tobiko-ir-jenkins/vars/jenkins.yaml diff --git a/roles/tobiko-ensure-git/meta/main.yaml b/infrared_plugin/roles/tobiko-ir-run/meta/main.yaml similarity index 100% rename from roles/tobiko-ensure-git/meta/main.yaml rename to infrared_plugin/roles/tobiko-ir-run/meta/main.yaml diff --git a/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml b/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml new file mode 100644 index 000000000..0796f8081 --- /dev/null +++ b/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml @@ -0,0 +1,63 @@ +--- + +- block: + - include_role: name=tobiko-ir-jenkins + when: "(lookup('env','JENKINS_URL') | length) > 0" + + - name: "consolidate deploy facts" + set_fact: + tobiko_dir: '{{ tobiko_dir | realpath }}' + tobiko_src_dir: '{{ tobiko_src_dir | realpath }}' + tobiko_git_repo: '{{ tobiko_git_repo }}' + tobiko_git_version: "{{ tobiko_git_version }}" + tobiko_git_refspec: "{{ tobiko_git_refspec }}" + tobiko_git_remote: "{{ tobiko_git_remote }}" + test_dir: '{{ test_dir | realpath }}' + test_src_dir: '{{ test_src_dir | realpath }}' + test_git_repo: '{{ test_git_repo }}' + test_git_version: "{{ test_git_version }}" + test_git_refspec: "{{ test_git_refspec }}" + test_git_remote: "{{ test_git_remote }}" + + - name: "deploy Tobiko files" + include_role: name=tobiko-ir-deploy + vars: + deploy_dir: '{{ tobiko_dir }}' + deploy_src_dir: '{{ tobiko_src_dir }}' + deploy_git_repo: '{{ tobiko_git_repo }}' + deploy_git_version: "{{ tobiko_git_version }}" + deploy_git_refspec: "{{ tobiko_git_refspec }}" + deploy_git_remote: '{{ tobiko_git_remote }}' + + - name: "deploy test files" + include_role: name=tobiko-ir-deploy + vars: + deploy_dir: '{{ test_dir }}' + deploy_src_dir: '{{ test_src_dir }}' + deploy_git_repo: '{{ test_git_repo }}' + deploy_git_version: "{{ test_git_version }}" + deploy_git_refspec: "{{ test_git_refspec }}" + deploy_git_remote: '{{ test_git_remote }}' + when: test_dir != tobiko_dir + + - name: "initialize test execution" + include_role: name=tobiko-configure + + - name: "run tests" + include_role: name=tobiko-run + + rescue: + - name: "finalize test execution" + include_role: name=tobiko-collect + ignore_errors: yes + + - fail: + msg: 'TEST EXECUTION FAILED' + + +- name: "finalize test execution" + include_role: name=tobiko-collect + + +- debug: + msg: 'TEST EXECUTION SUCCEEDED' diff --git a/roles/tests/provision.yaml b/roles/tests/provision.yaml index 144fbb4cb..0bcfc469d 100644 --- a/roles/tests/provision.yaml +++ b/roles/tests/provision.yaml @@ -78,6 +78,13 @@ state: present key: "{{ lookup('file', ssh_key_file + '.pub') }}" + - name: "ensure deploy tools are installed" + become: true + package: name='{{ item }}' + loop: + - git + - rsync + - hosts: primary tasks: @@ -120,4 +127,13 @@ - hosts: primary roles: - role: tobiko-inventory - - role: tobiko-deploy + + tasks: + - name: "copy '{{ tobiko_src_dir }}' to '{{ tobiko_dir }}'" + synchronize: + src: "{{ tobiko_src_dir | realpath }}/." + dest: "{{ tobiko_dir | realpath }}" + use_ssh_args: yes + recursive: yes + rsync_opts: + - '--exclude-from={{ tobiko_src_dir | realpath }}/.gitignore' diff --git a/roles/tests/test_infrared_plugin.yaml b/roles/tests/test_infrared_plugin.yaml index acb1ddfc8..b5326115b 100644 --- a/roles/tests/test_infrared_plugin.yaml +++ b/roles/tests/test_infrared_plugin.yaml @@ -6,8 +6,6 @@ roles: - tobiko-ensure-tox - - tobiko-ensure-git - - tobiko-ensure-rsync tasks: - name: "remove '{{ test_collect_dir }}' dir" diff --git a/roles/tobiko-all/tasks/all.yaml b/roles/tobiko-all/tasks/all.yaml deleted file mode 100644 index e69de29bb..000000000 diff --git a/roles/tobiko-all/tasks/main.yaml b/roles/tobiko-all/tasks/main.yaml deleted file mode 100644 index d88d714f4..000000000 --- a/roles/tobiko-all/tasks/main.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- - -- block: - - name: "initialize test execution" - include_role: - name: tobiko-pre-run - - - name: "run tests" - include_role: - name: tobiko-run - - rescue: - - name: "finalize test execution" - include_role: - name: tobiko-post-run - ignore_errors: yes - - - fail: - msg: 'TEST EXECUTION FAILED' - - -- name: "finalize test execution" - include_role: - name: tobiko-post-run - - -- debug: - msg: 'TEST EXECUTION SUCCEEDED' diff --git a/roles/tobiko-collect/meta/main.yaml b/roles/tobiko-collect/meta/main.yaml index 9ee06aeff..0d4361583 100644 --- a/roles/tobiko-collect/meta/main.yaml +++ b/roles/tobiko-collect/meta/main.yaml @@ -2,4 +2,3 @@ dependencies: - role: tobiko-common - - role: tobiko-ensure-rsync diff --git a/roles/tobiko-collect/tasks/collect.yaml b/roles/tobiko-collect/tasks/collect.yaml deleted file mode 100644 index d0c8a5b3e..000000000 --- a/roles/tobiko-collect/tasks/collect.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- - -- name: "ensure local directory '{{ collect_dir }}' exists" - file: - path: '{{ collect_dir }}' - state: directory - delegate_to: localhost - - -- name: "look for report files in {{ report_dir }}" - find: - paths: - - "{{ report_dir }}" - patterns: - - "{{ report_name }}*.log" - - "{{ report_name }}*.subunit" - - "{{ report_name }}*.html" - - "{{ report_name }}*.xml" - register: find_report_files - - -- name: "add found report files" - set_fact: - report_files: '{{ (( find_report_files.files | json_query("[*].path")) + report_files) | unique }}' - - -- name: "check if report files exists" - stat: - path: "{{ item }}" - get_checksum: no - register: stat_report_files - loop: '{{ report_files }}' - - -- name: "filter out non existing report files" - set_fact: - report_files: > - {{ stat_report_files.results | - json_query("[?stat.exists].stat.path") }} - - -- name: "collect report files to local directory '{{ collect_dir }}'" - synchronize: - dest: '{{ collect_dir }}/{{ item | basename }}' - mode: pull - src: '{{ item }}' - use_ssh_args: yes - recursive: yes - ignore_errors: yes - loop: '{{ report_files }}' diff --git a/roles/tobiko-collect/tasks/main.yaml b/roles/tobiko-collect/tasks/main.yaml index 3e4e3a6fc..d0c8a5b3e 100644 --- a/roles/tobiko-collect/tasks/main.yaml +++ b/roles/tobiko-collect/tasks/main.yaml @@ -1,6 +1,50 @@ --- -- name: "collect test results" - include_tasks: collect.yaml - when: - - test_stage in ['all', 'post-run', 'collect'] +- name: "ensure local directory '{{ collect_dir }}' exists" + file: + path: '{{ collect_dir }}' + state: directory + delegate_to: localhost + + +- name: "look for report files in {{ report_dir }}" + find: + paths: + - "{{ report_dir }}" + patterns: + - "{{ report_name }}*.log" + - "{{ report_name }}*.subunit" + - "{{ report_name }}*.html" + - "{{ report_name }}*.xml" + register: find_report_files + + +- name: "add found report files" + set_fact: + report_files: '{{ (( find_report_files.files | json_query("[*].path")) + report_files) | unique }}' + + +- name: "check if report files exists" + stat: + path: "{{ item }}" + get_checksum: no + register: stat_report_files + loop: '{{ report_files }}' + + +- name: "filter out non existing report files" + set_fact: + report_files: > + {{ stat_report_files.results | + json_query("[?stat.exists].stat.path") }} + + +- name: "collect report files to local directory '{{ collect_dir }}'" + synchronize: + dest: '{{ collect_dir }}/{{ item | basename }}' + mode: pull + src: '{{ item }}' + use_ssh_args: yes + recursive: yes + ignore_errors: yes + loop: '{{ report_files }}' diff --git a/roles/tobiko-common/defaults/main.yaml b/roles/tobiko-common/defaults/main.yaml index 16e451846..1378cb119 100644 --- a/roles/tobiko-common/defaults/main.yaml +++ b/roles/tobiko-common/defaults/main.yaml @@ -17,12 +17,9 @@ test_project: "{{ test_git_repo | urlsplit('path') | regex_replace('^\\/|\\/$', '') | splitext | first }}" test_git_repo: '{{ git_base }}/x/tobiko.git' test_git_refspec: '' -test_git_remote: '{{ omit }}' -test_git_version: 'master' +test_git_remote: '' +test_git_version: '' test_src_dir: '' -test_user: '{{ ansible_user | default(omit) }}' -test_group: '{{ test_user }}' -test_mode: '{{ omit }}' # NOTE: if test_dir and tobiko_dir variables endup being the same actual @@ -34,12 +31,9 @@ tobiko_project: "{{ tobiko_git_repo | urlsplit('path') | regex_replace('^\\/|\\/$', '') | splitext | first }}" tobiko_git_repo: '{{ git_base }}/x/tobiko.git' tobiko_git_refspec: '' -tobiko_git_remote: '{{ omit }}' -tobiko_git_version: 'master' +tobiko_git_remote: '' +tobiko_git_version: '' tobiko_src_dir: '' -tobiko_user: '{{ ansible_user | default(omit) }}' -tobiko_group: '{{ tobiko_user }}' -tobiko_mode: '{{ omit }}' # --- Test configuration options ---------------------------------------------- diff --git a/roles/tobiko-configure/tasks/configure.yaml b/roles/tobiko-configure/tasks/configure.yaml deleted file mode 100644 index 6aa158df2..000000000 --- a/roles/tobiko-configure/tasks/configure.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- - -- name: "list configuration options" - set_fact: - test_conf_yaml: | - {% for section, options in (sections.items() | sort) %} - {% for option, value in (options.items() | sort) %} - - section: "{{ section }}" - option: "{{ option }}" - value: "{{ value }}" - {% endfor %} - {% endfor %} - vars: - sections: "{{ test_default_conf | combine(test_conf, recursive=True) }}" - - -- name: "generate '{{ test_conf_file }}' file" - ini_file: - path: "{{ test_conf_file }}" - section: "{{ item.section }}" - option: "{{ item.option }}" - value: "{{ item.value }}" - mode: '0644' - when: - - item.section - - item.option - - item.value - loop: "{{ test_conf_yaml | from_yaml | list }}" - - -- name: "read resulting '{{ test_conf_file }}' file" - command: "cat '{{ test_conf_file }}'" - register: read_test_conf_file - - -- name: "show resulting '{{ test_conf_file }}' file" - debug: var=read_test_conf_file.stdout_lines - - -# TODO (fressi): move it to a Tobiko python fixture -- name: Set permissive quotas for instances and cores - shell: | - source "{{ stackrc_file }}" - openstack quota set --instances -1 admin - openstack quota set --cores -1 admin - ignore_errors: yes diff --git a/roles/tobiko-configure/tasks/main.yaml b/roles/tobiko-configure/tasks/main.yaml index c27f4eec8..6aa158df2 100644 --- a/roles/tobiko-configure/tasks/main.yaml +++ b/roles/tobiko-configure/tasks/main.yaml @@ -1,6 +1,46 @@ --- -- name: "configure test cases" - include_tasks: 'configure.yaml' +- name: "list configuration options" + set_fact: + test_conf_yaml: | + {% for section, options in (sections.items() | sort) %} + {% for option, value in (options.items() | sort) %} + - section: "{{ section }}" + option: "{{ option }}" + value: "{{ value }}" + {% endfor %} + {% endfor %} + vars: + sections: "{{ test_default_conf | combine(test_conf, recursive=True) }}" + + +- name: "generate '{{ test_conf_file }}' file" + ini_file: + path: "{{ test_conf_file }}" + section: "{{ item.section }}" + option: "{{ item.option }}" + value: "{{ item.value }}" + mode: '0644' when: - - test_stage in ['all', 'pre-run', 'configure'] + - item.section + - item.option + - item.value + loop: "{{ test_conf_yaml | from_yaml | list }}" + + +- name: "read resulting '{{ test_conf_file }}' file" + command: "cat '{{ test_conf_file }}'" + register: read_test_conf_file + + +- name: "show resulting '{{ test_conf_file }}' file" + debug: var=read_test_conf_file.stdout_lines + + +# TODO (fressi): move it to a Tobiko python fixture +- name: Set permissive quotas for instances and cores + shell: | + source "{{ stackrc_file }}" + openstack quota set --instances -1 admin + openstack quota set --cores -1 admin + ignore_errors: yes diff --git a/roles/tobiko-deploy/defaults/main.yaml b/roles/tobiko-deploy/defaults/main.yaml deleted file mode 100644 index e484ac5d4..000000000 --- a/roles/tobiko-deploy/defaults/main.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- - -# Directoies where files has to be deployed to - -clean_deploy_dir: false - -test_deploy_dirs: - # test suite directory - - clean_dir: '{{ clean_deploy_dir }}' - dest_dir: '{{ test_dir }}' - dest_mode: '{{ test_mode }}' - dest_user: '{{ test_user }}' - dest_group: '{{ test_group }}' - git_repo: '{{ test_git_repo }}' - git_refspec: '{{ test_git_refspec }}' - git_remote: '{{ test_git_remote }}' - git_version: '{{ test_git_version }}' - src_dir: '{{ test_src_dir }}' - - # Tobiko framework directory - - clean_dir: '{{ clean_deploy_dir }}' - dest_dir: '{{ tobiko_dir }}' - dest_mode: '{{ tobiko_mode }}' - dest_user: '{{ tobiko_user }}' - dest_group: '{{ tobiko_group }}' - git_repo: '{{ tobiko_git_repo }}' - git_refspec: '{{ tobiko_git_refspec }}' - git_remote: '{{ tobiko_git_remote }}' - git_version: '{{ tobiko_git_version }}' - src_dir: '{{ tobiko_src_dir }}' - -bindep_file: bindep.txt -bindep_profiles: test diff --git a/roles/tobiko-deploy/meta/main.yaml b/roles/tobiko-deploy/meta/main.yaml deleted file mode 100644 index b76c4ada7..000000000 --- a/roles/tobiko-deploy/meta/main.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -dependencies: - - role: tobiko-common - - role: tobiko-ensure-rsync - - role: tobiko-ensure-git diff --git a/roles/tobiko-deploy/tasks/deploy-dir.yaml b/roles/tobiko-deploy/tasks/deploy-dir.yaml deleted file mode 100644 index a315353b0..000000000 --- a/roles/tobiko-deploy/tasks/deploy-dir.yaml +++ /dev/null @@ -1,74 +0,0 @@ ---- - -- name: "set deploy source variables" - set_fact: - '{{ item.0 }}': '{{ item.1 }}' - loop: '{{ deploy.1 | dictsort }}' - loop_control: - label: '{{ item.0 }}' - - -- name: "clean directory '{{ dest_dir }}'" - file: - path: "{{ dest_dir | realpath }}" - state: absent - when: - - clean_dir | bool - - -- name: "setup directory '{{ dest_dir }}'" - file: - path: "{{ dest_dir | realpath }}" - state: directory - owner: '{{ dest_user | default(omit) }}' - group: '{{ dest_group | default(omit) }}' - mode: '{{ dest_mode | default(omit) }}' - recurse: yes - become: '{{ test_become | bool }}' - register: create_dest_dir - - -- debug: var=create_dest_dir - - -- name: "override git_version and src_dir because git_refspec is '{{ git_refspec }}'" - set_fact: - git_version: 'FETCH_HEAD' - src_dir: '' - when: '(git_refspec | length) > 0' - - -- name: "checkout files from '{{ git_repo }}[{{ git_refspec | default(git_version) }}]' to '{{ dest_dir }}'" - git: - dest: '{{ dest_dir }}' - repo: '{{ git_repo }}' - refspec: '{{ git_refspec | default(omit) }}' - version: '{{ git_version }}' - remote: '{{ git_remote | default(omit) }}' - force: yes - register: checkout_files - when: '((src_dir | length) == 0)' - - -- name: "copy '{{ src_dir }}' to '{{ dest_dir }}'" - synchronize: - src: "{{ src_dir | realpath }}/." - dest: "{{ dest_dir | realpath }}" - use_ssh_args: yes - recursive: yes - delete: "{{ clean_dir | bool }}" - rsync_opts: - - '--exclude-from={{ src_dir | realpath }}/.gitignore' - register: copy_src_dir - when: '(src_dir | length) > 0' - - -- name: "get last change details for '{{ dest_dir }}'" # noqa 303 - command: - chdir: "{{ dest_dir }}" - cmd: git log -n 1 - register: get_git_log - - -- name: "show last change details" - debug: var=get_git_log.stdout_lines diff --git a/roles/tobiko-deploy/tasks/deploy.yaml b/roles/tobiko-deploy/tasks/deploy.yaml deleted file mode 100644 index 4d6f518dc..000000000 --- a/roles/tobiko-deploy/tasks/deploy.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- - -- name: 'combine test_deploy_dirs variables' - set_fact: - _test_deploy_dirs: > - {{ _test_deploy_dirs | - default({}) | - combine({(item.dest_dir | expanduser | realpath): item}) }} - loop: '{{ test_deploy_dirs }}' - loop_control: - label: '{{ item.dest_dir }}' - - -- name: "show combined deploy variables" - debug: var=_test_deploy_dirs - - -- name: "deploy test directories'" - include_tasks: deploy-dir.yaml - loop: '{{ _test_deploy_dirs | dictsort }}' - loop_control: - label: '{{ deploy.0 }}' - loop_var: deploy diff --git a/roles/tobiko-deploy/tasks/main.yaml b/roles/tobiko-deploy/tasks/main.yaml deleted file mode 100644 index d2c7dc32d..000000000 --- a/roles/tobiko-deploy/tasks/main.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -- name: "deploy test cases" - include_tasks: deploy.yaml - when: - - test_stage in ['all', 'pre-run', 'deploy'] diff --git a/roles/tobiko-ensure-git/defaults/main.yaml b/roles/tobiko-ensure-git/defaults/main.yaml deleted file mode 100644 index 6e10e75d5..000000000 --- a/roles/tobiko-ensure-git/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -git_executable: git diff --git a/roles/tobiko-ensure-git/tasks/git.yaml b/roles/tobiko-ensure-git/tasks/git.yaml deleted file mode 100644 index 9311712f9..000000000 --- a/roles/tobiko-ensure-git/tasks/git.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- - -- block: - - name: "get '{{ git_executable }}' full path" - shell: > - which '{{ git_executable }}' - changed_when: no - register: get_git_path - - rescue: - - name: "install Git package" - become: '{{ test_become | bool }}' - package: - name: git - - - name: "get '{{ git_executable }}' full path" - shell: > - which '{{ git_executable }}' - changed_when: no - register: get_git_path - - -- name: "update git_executable fact" - set_fact: - git_executable: '{{ get_git_path.stdout_lines | first }}' - - -- name: "get Git version" - command: > - '{{ git_executable }}' --version - changed_when: no - register: - get_git_version - - -- name: update git_version fact - set_fact: - git_version: '{{ get_git_version.stdout_lines | first }}' - - -- name: "show Git facts" - debug: - msg: - git_executable: '{{ git_executable }}' - git_version: '{{ git_version }}' diff --git a/roles/tobiko-ensure-git/tasks/main.yaml b/roles/tobiko-ensure-git/tasks/main.yaml deleted file mode 100644 index e24c1e210..000000000 --- a/roles/tobiko-ensure-git/tasks/main.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -- name: "ensure '{{ git_executable }}' command is available" - include_tasks: git.yaml - when: - - git_version is not defined diff --git a/roles/tobiko-ensure-rsync/defaults/main.yaml b/roles/tobiko-ensure-rsync/defaults/main.yaml deleted file mode 100644 index 43019f0dd..000000000 --- a/roles/tobiko-ensure-rsync/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -rsync_executable: rsync diff --git a/roles/tobiko-ensure-rsync/meta/main.yaml b/roles/tobiko-ensure-rsync/meta/main.yaml deleted file mode 100644 index 0d4361583..000000000 --- a/roles/tobiko-ensure-rsync/meta/main.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -dependencies: - - role: tobiko-common diff --git a/roles/tobiko-ensure-rsync/tasks/main.yaml b/roles/tobiko-ensure-rsync/tasks/main.yaml deleted file mode 100644 index 6a51ee822..000000000 --- a/roles/tobiko-ensure-rsync/tasks/main.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -- name: "ensure '{{ rsync_executable }}' command is available" - include_tasks: rsync.yaml - when: - - rsync_version is not defined diff --git a/roles/tobiko-ensure-rsync/tasks/rsync.yaml b/roles/tobiko-ensure-rsync/tasks/rsync.yaml deleted file mode 100644 index f67cfef6a..000000000 --- a/roles/tobiko-ensure-rsync/tasks/rsync.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- - -- block: - - name: "get '{{ rsync_executable }}' full path" - shell: > - which '{{ rsync_executable }}' - changed_when: no - register: get_rsync_path - - rescue: - - name: "install Rsync packages" - become: '{{ test_become | bool }}' - package: - name: rsync - - - name: "get '{{ rsync_executable }}' full path" - shell: > - which '{{ rsync_executable }}' - changed_when: no - register: get_rsync_path - - -- name: "update rsync_executable fact" - set_fact: - rsync_executable: '{{ get_rsync_path.stdout_lines | first }}' - - -- name: "get Rsync version" - command: > - '{{ rsync_executable }}' --version - changed_when: no - register: - get_rsync_version - - -- name: update rsync_version fact - set_fact: - rsync_version: '{{ get_rsync_version.stdout_lines | first }}' - - -- name: "show Rsync facts" - debug: - msg: - rsync_executable: '{{ rsync_executable }}' - rsync_version: '{{ rsync_version }}' diff --git a/roles/tobiko-post-run/meta/main.yaml b/roles/tobiko-post-run/meta/main.yaml deleted file mode 100644 index 80c9226ff..000000000 --- a/roles/tobiko-post-run/meta/main.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -dependencies: - - role: tobiko-collect diff --git a/roles/tobiko-pre-run/meta/main.yaml b/roles/tobiko-pre-run/meta/main.yaml deleted file mode 100644 index af525a911..000000000 --- a/roles/tobiko-pre-run/meta/main.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -dependencies: - - role: tobiko-common - - role: tobiko-deploy - - role: tobiko-configure