diff --git a/infrared_plugin/plugin.spec b/infrared_plugin/plugin.spec index c9f59405b..6aa63ca14 100644 --- a/infrared_plugin/plugin.spec +++ b/infrared_plugin/plugin.spec @@ -37,7 +37,7 @@ subparsers: clean: type: Flag help: Cleanup directory where test cases will be downloaded - ansible_variable: clean_deploy_dir + ansible_variable: deploy_clean git-base: type: Value help: Git Url prefix where test projects are fetched from @@ -58,10 +58,6 @@ subparsers: type: Value help: Git URL from where to download test files ansible_variable: test_git_repo - test-version: - type: Value - help: Git version to be used for checking out test scripts - ansible_variable: test_git_version test-remote: type: Value help: Git remote name to be used for checking out test scripts @@ -91,10 +87,6 @@ subparsers: help: Git URL from where to download tobiko files ansible_variable: tobiko_git_repo default: 'https://opendev.org/x/tobiko.git' - tobiko-version: - type: Value - help: Git version to be used for checking out Tobiko scripts - ansible_variable: tobiko_git_version tobiko-remote: type: Value help: Git remote name to be used for checking out test scripts diff --git a/infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml b/infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml index 2d22baf4e..a0b2f2235 100644 --- a/infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml +++ b/infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml @@ -1,10 +1,9 @@ --- deploy_dir: '' -deploy_clean: no +deploy_clean: '{{ (deploy_git_refspec | length) > 0 | default(false) }}' 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 index 62281cdd8..672ee3e22 100644 --- a/infrared_plugin/roles/tobiko-ir-deploy/tasks/main.yaml +++ b/infrared_plugin/roles/tobiko-ir-deploy/tasks/main.yaml @@ -5,7 +5,7 @@ path: "{{ deploy_dir | realpath }}" state: absent when: - - deploy_clean | bool + - (deploy_clean | bool) - name: "ensure target directory exists: '{{ deploy_dir }}'" @@ -15,6 +15,19 @@ register: create_dest_dir +- name: "checkout files from '{{ deploy_git_repo }}[{{ deploy_git_refspec }}]' to '{{ deploy_dir }}'" + git: + dest: '{{ deploy_dir }}' + repo: '{{ deploy_git_repo }}' + refspec: '{{ deploy_git_refspec }}' + version: FETCH_HEAD + remote: '{{ deploy_git_remote or omit }}' + force: yes + register: checkout_files + when: + - (deploy_git_refspec | length) > 0 + + - name: "copy '{{ deploy_src_dir }}' to '{{ deploy_dir }}'" synchronize: src: "{{ deploy_src_dir | realpath }}/." @@ -26,27 +39,7 @@ register: copy_src_dir when: - (deploy_src_dir | length) > 0 - - -- when: copy_src_dir is skipped - block: - - - name: "override deploy_git_version and deploy_src_dir because deploy_git_refspec is '{{ deploy_git_refspec }}'" - set_fact: - deploy_git_version: 'FETCH_HEAD' - 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 or omit }}' - remote: '{{ deploy_git_remote or omit }}' - force: yes - register: checkout_files - when: - - (deploy_git_version | length) > 0 + - checkout_files is skipped - name: "get last change details for '{{ deploy_dir }}'" # noqa 303 @@ -60,8 +53,9 @@ - name: "show last change details" debug: var=get_git_log.stdout_lines -#we install validations-common here since it's -#packaged by rhel-osp + +# we install validations-common here since it's +# packaged by rhel-osp - name: install validations-common ignore_errors: yes become: true diff --git a/infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml b/infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml index d58b835e5..d0b00bd35 100644 --- a/infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml +++ b/infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml @@ -12,9 +12,8 @@ vars: deploy_dir: '{{ tobiko_src_dir | realpath }}' deploy_git_repo: '{{ tobiko_git_repo }}' - deploy_git_version: "{{ tobiko_git_version | default('HEAD') }}" - deploy_git_refspec: "{{ tobiko_git_refspec | default('') }}" - deploy_git_remote: '{{ tobiko_git_remote | default(omit) }}' + deploy_git_refspec: "{{ tobiko_git_refspec | default('latest') }}" + deploy_git_remote: "{{ tobiko_git_remote | default('') }}" when: create_tobiko_dir is changed diff --git a/infrared_plugin/roles/tobiko-ir-run/defaults/main.yaml b/infrared_plugin/roles/tobiko-ir-run/defaults/main.yaml new file mode 100644 index 000000000..133d94ef8 --- /dev/null +++ b/infrared_plugin/roles/tobiko-ir-run/defaults/main.yaml @@ -0,0 +1,7 @@ +--- + +# tobiko_git_refspec is empty to allow copying files from tobini_src_dir +tobiko_git_refspec: '' +test_git_refspec: '' +tobiko_git_remote: '' +test_git_remote: '' diff --git a/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml b/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml index 0796f8081..950d752f9 100644 --- a/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml +++ b/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml @@ -9,13 +9,11 @@ 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 }}" @@ -25,7 +23,6 @@ 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 }}' @@ -35,7 +32,6 @@ 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 diff --git a/roles/tobiko-common/defaults/main.yaml b/roles/tobiko-common/defaults/main.yaml index ac6891a65..fe99c0d43 100644 --- a/roles/tobiko-common/defaults/main.yaml +++ b/roles/tobiko-common/defaults/main.yaml @@ -16,9 +16,6 @@ test_dir: "{{ test_deploy_home }}/{{ test_project }}" 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: '' -test_git_version: '' test_src_dir: '' @@ -30,9 +27,6 @@ tobiko_dir: "{{ test_deploy_home }}/{{ tobiko_project }}" 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: '' -tobiko_git_version: '' tobiko_src_dir: ''