Build role: support using sources from directory

Support copying sources from ready directories in addition
to cloning from repository. It's good both for CI -
when using cloned by ZUUL repos and for local development.
Remove built data from previous runs from DLRN folder.

Change-Id: I99ec5dfcc2ca05d133a125e6d53383ff86c65e1c
This commit is contained in:
Sagi Shnaidman 2016-12-01 15:16:47 +02:00
parent 9b9b90fa35
commit 82b15ac2a5
3 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,8 @@ Role Variables
This is useful if the project is directly checked out by the gate job as this
retains "Depends-On" functionality for the rest of the projects. Also useful
to skip projects that DLRN cannot build.
* `artg_repos_dir` -- Root directory which contains project directories with
sources for build.
```yaml
artg_change_list:

View File

@ -32,12 +32,22 @@
args:
chdir: '{{ ansible_user_dir }}/DLRN'
- name: Create data directory if doesn't exist yet
file: path="{{ ansible_user_dir }}/DLRN/data/" state=directory
- name: Clone the gated change
git:
repo: 'https://{{ artg_change.host }}/{{ artg_change.project }}'
dest: '{{ ansible_user_dir }}/DLRN/data/{{ project_name_mapped.stdout }}'
refspec: '{{ artg_change.refspec }}'
version: 'FETCH_HEAD'
when: artg_repos_dir is not defined
- name: Copy from ready directories if configured
command: >
cp -raf {{ artg_repos_dir }}/{{ artg_change.project|regex_replace('openstack[^/]*/', '') }}
{{ ansible_user_dir }}/DLRN/data/{{ project_name_mapped.stdout }}
when: artg_repos_dir is defined
- name: Run DLRN
shell: >

View File

@ -33,6 +33,12 @@
stat: path='{{ ansible_user_dir }}/DLRN'
register: dlrn_cloned
- name: Remove data files from previous runs
file:
path: '{{ ansible_user_dir }}/DLRN/data'
state: absent
when: dlrn_cloned.stat.exists
- name: Clone DLRN
git:
repo: '{{ artg_dlrn_repo_url }}'