Update pre-run roles

Change-Id: Iaf9f31c46dbf11f3c57c084def50c0a3ab88f3f5
This commit is contained in:
Federico Ressi 2020-04-14 13:57:09 +02:00
parent f1b479c990
commit c9716ccac2
4 changed files with 25 additions and 41 deletions

View File

@ -7,11 +7,11 @@ test_stage: all
# --- Test deploy options -----------------------------------------------------
deploy_home: '{{ ansible_user_dir | realpath }}/src'
test_deploy_home: '{{ ansible_user_dir | realpath }}/src'
git_base: 'https://opendev.org'
test_dir: "{{ deploy_home }}/{{ test_project }}"
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'
@ -23,12 +23,12 @@ test_src_dir: ''
# directory then test_src and test_git_* variables will be overriden
# tobiko_src and tobiko_git_* variables
tobiko_dir: "{{ deploy_home }}/{{ tobiko_project }}"
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_version: ''
tobiko_git_version: 'master'
tobiko_src_dir: ''
@ -39,9 +39,6 @@ test_conf_file: '{{ test_dir | realpath }}/tobiko.conf'
test_conf: {}
# Logging options
test_log_debug: true
# --- Test report options -----------------------------------------------------
# Remote directory where test cases shoulw write report files to

View File

@ -1,19 +1,12 @@
---
# Configuration options
conf_file: '{{ test_conf_file | realpath }}'
default_conf:
test_default_conf:
DEFAULT:
debug: "{{ log_debug }}"
log_dir: "{{ log_file | dirname }}"
log_file: "{{ log_file | basename }}"
debug: "{{ test_log_debug }}"
log_dir: "{{ test_log_file | dirname }}"
log_file: "{{ test_log_file | basename }}"
conf: {}
# Logging options
log_debug: '{{ test_log_debug | bool }}'
log_file: "{{ test_log_file | realpath }}"
test_log_debug: true
# OpenStack client credentials
stackrc_file: '{{ ansible_user_dir }}/overcloudrc'

View File

@ -2,7 +2,7 @@
- name: "list configuration options"
set_fact:
conf_yaml: |
test_conf_yaml: |
{% for section, options in (sections.items() | sort) %}
{% for option, value in (options.items() | sort) %}
- section: "{{ section }}"
@ -11,12 +11,12 @@
{% endfor %}
{% endfor %}
vars:
sections: "{{ default_conf | combine(conf, recursive=True) }}"
sections: "{{ test_default_conf | combine(test_conf, recursive=True) }}"
- name: "generate '{{ conf_file }}' file"
- name: "generate '{{ test_conf_file }}' file"
ini_file:
path: "{{ conf_file }}"
path: "{{ test_conf_file }}"
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
@ -25,16 +25,16 @@
- item.section
- item.option
- item.value
loop: "{{ conf_yaml | from_yaml | list }}"
loop: "{{ test_conf_yaml | from_yaml | list }}"
- name: "read resulting {{ conf_file }} file"
command: "cat '{{ conf_file }}'"
register: read_conf_file
- name: "read resulting '{{ test_conf_file }}' file"
command: "cat '{{ test_conf_file }}'"
register: read_test_conf_file
- name: "show resulting '{{ conf_file }}' file"
debug: var=read_conf_file.stdout_lines
- name: "show resulting '{{ test_conf_file }}' file"
debug: var=read_test_conf_file.stdout_lines
# TODO (fressi): move it to a Tobiko python fixture

View File

@ -14,13 +14,10 @@
state: absent
when:
- clean_dir | bool
- |
(src_dir | length) == 0 or
(git_version | length) > 0 or
(git_refspec | length) == 0
- (src_dir | length) == 0
- name: "create directory {{ dest_dir }}"
- name: "create directory '{{ dest_dir }}'"
file:
path: "{{ dest_dir | realpath }}"
state: directory
@ -35,10 +32,9 @@
delete: "{{ clean_dir | bool }}"
rsync_opts:
- "--exclude-from={{ src_dir | realpath }}/.gitignore"
register: copied_dir
when:
- (src_dir | length) > 0
- (git_version | length) == 0
- (git_refspec | length) == 0
- name: "checkout test cases from '{{ git_repo }}[{{ git_refspec or git_version }}]' to '{{ dest_dir }}'"
@ -46,12 +42,10 @@
dest: '{{ dest_dir }}'
repo: '{{ git_repo }}'
refspec: '{{ git_refspec }}'
version: '{%if (git_refspec | length) %}FETCH_HEAD{% else %}{{ git_version }}{% endif %}'
version: '{%if (git_refspec | length) %}FETCH_HEAD{% elif (git_version | length) %}{{ git_version }}{% else %}master{% endif %}'
force: yes
when: |
(src_dir | length) == 0 or
(git_version | length) > 0 or
(git_refspec | length) > 0
when:
- copied_dir is not defined
- name: "get last change details for '{{ dest_dir }}'" # noqa 303