From c0d8e38d0333cb6c3a1561dbe6adaf918a555b4f Mon Sep 17 00:00:00 2001 From: pkomarov Date: Thu, 20 Jun 2019 15:19:14 +0300 Subject: [PATCH] allow specifying custom tobiko gerrit refsec for checking out and testing a specific patch Change-Id: I8e7b3ac16700fd28ef6f00577e822838713904d9 --- infrared/tasks/install.yml | 29 +++++++++++++++++++++++++++++ plugin.spec | 7 +++++++ 2 files changed, 36 insertions(+) diff --git a/infrared/tasks/install.yml b/infrared/tasks/install.yml index 79fa33537..bccdb834a 100644 --- a/infrared/tasks/install.yml +++ b/infrared/tasks/install.yml @@ -11,10 +11,35 @@ name: "{{ required_packages }}" state: present +- name: "Ensure {{ test.dir }} doesn't exist" + file: + path: "{{ test.dir }}" + state: absent + - name: Clone Tobiko project git: repo: 'https://review.opendev.org/x/tobiko' dest: "{{ test.dir }}" + when: test.refsec == '' + +- name: Checkout specific gerrit patch + git: + repo: 'https://review.opendev.org/x/tobiko' + dest: "{{ test.dir }}" + refspec: "{{ test.refsec }}" + version: 'FETCH_HEAD' + when: test.refsec != '' + +- name: output gerrit patch log + shell: | + git log -n 1 + register: git_log + args: + chdir: "{{ test.dir }}" + when: test.refsec != '' + +- debug: var=git_log.stdout_lines + when: test.refsec != '' - name: Create Virtualenv vars: @@ -24,6 +49,10 @@ name: "{{ packages }}" state: latest + args: + chdir: "{{ test.dir }}" + when: test.gerrit-patch != '' + - name: Install Tobiko pip: chdir: "{{ test.dir }}" diff --git a/plugin.spec b/plugin.spec index eb80c777f..7a6001365 100644 --- a/plugin.spec +++ b/plugin.spec @@ -41,3 +41,10 @@ subparsers: help: | The set of tests to execute default: neutron + refsec: + type: Value + help: | + specific gerrit patch refsec to + checkout, example: + --refsec refs/changes/66/665966/7 + default: ''