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
This commit is contained in:
parent
293430cd65
commit
077dc49e40
@ -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
|
||||
|
10
infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml
Normal file
10
infrared_plugin/roles/tobiko-ir-deploy/defaults/main.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
|
||||
deploy_dir: ''
|
||||
deploy_clean: no
|
||||
deploy_src_dir: ''
|
||||
|
||||
deploy_git_repo: ''
|
||||
deploy_git_version: ''
|
||||
deploy_git_refspec: ''
|
||||
deploy_git_remote: ''
|
61
infrared_plugin/roles/tobiko-ir-deploy/tasks/main.yaml
Normal file
61
infrared_plugin/roles/tobiko-ir-deploy/tasks/main.yaml
Normal file
@ -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
|
52
infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml
Normal file
52
infrared_plugin/roles/tobiko-ir-init/tasks/main.yaml
Normal file
@ -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
|
4
infrared_plugin/roles/tobiko-ir-jenkins/tasks/main.yaml
Normal file
4
infrared_plugin/roles/tobiko-ir-jenkins/tasks/main.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
- name: 'apply Jenkins settings'
|
||||
include_vars: jenkins.yaml
|
63
infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml
Normal file
63
infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml
Normal file
@ -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'
|
@ -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'
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
roles:
|
||||
- tobiko-ensure-tox
|
||||
- tobiko-ensure-git
|
||||
- tobiko-ensure-rsync
|
||||
|
||||
tasks:
|
||||
- name: "remove '{{ test_collect_dir }}' dir"
|
||||
|
@ -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'
|
@ -2,4 +2,3 @@
|
||||
|
||||
dependencies:
|
||||
- role: tobiko-common
|
||||
- role: tobiko-ensure-rsync
|
||||
|
@ -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 }}'
|
@ -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 }}'
|
||||
|
@ -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 ----------------------------------------------
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -1,6 +0,0 @@
|
||||
---
|
||||
|
||||
dependencies:
|
||||
- role: tobiko-common
|
||||
- role: tobiko-ensure-rsync
|
||||
- role: tobiko-ensure-git
|
@ -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
|
@ -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
|
@ -1,6 +0,0 @@
|
||||
---
|
||||
|
||||
- name: "deploy test cases"
|
||||
include_tasks: deploy.yaml
|
||||
when:
|
||||
- test_stage in ['all', 'pre-run', 'deploy']
|
@ -1,3 +0,0 @@
|
||||
---
|
||||
|
||||
git_executable: git
|
@ -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 }}'
|
@ -1,6 +0,0 @@
|
||||
---
|
||||
|
||||
- name: "ensure '{{ git_executable }}' command is available"
|
||||
include_tasks: git.yaml
|
||||
when:
|
||||
- git_version is not defined
|
@ -1,3 +0,0 @@
|
||||
---
|
||||
|
||||
rsync_executable: rsync
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
|
||||
dependencies:
|
||||
- role: tobiko-common
|
@ -1,6 +0,0 @@
|
||||
---
|
||||
|
||||
- name: "ensure '{{ rsync_executable }}' command is available"
|
||||
include_tasks: rsync.yaml
|
||||
when:
|
||||
- rsync_version is not defined
|
@ -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 }}'
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
|
||||
dependencies:
|
||||
- role: tobiko-collect
|
@ -1,6 +0,0 @@
|
||||
---
|
||||
|
||||
dependencies:
|
||||
- role: tobiko-common
|
||||
- role: tobiko-deploy
|
||||
- role: tobiko-configure
|
Loading…
Reference in New Issue
Block a user