summaryrefslogtreecommitdiffstats
path: root/roles/openqa/server
diff options
context:
space:
mode:
authorAdam Williamson <awilliam@redhat.com>2016-09-06 12:30:26 -0700
committerAdam Williamson <awilliam@redhat.com>2016-09-06 12:30:53 -0700
commit8ef24ecd61d4197a6eb92b4a9b1e0b24ea2160a7 (patch)
tree2b4fd9c7f7bf3df10538213768b523bd9db86ee4 /roles/openqa/server
parent29047b44578280835518776b2711892ca0a98547 (diff)
downloadansible-8ef24ecd61d4197a6eb92b4a9b1e0b24ea2160a7.tar.gz
ansible-8ef24ecd61d4197a6eb92b4a9b1e0b24ea2160a7.tar.xz
ansible-8ef24ecd61d4197a6eb92b4a9b1e0b24ea2160a7.zip
openqa/server: don't check out tests when on non-standard branch
Diffstat (limited to 'roles/openqa/server')
-rw-r--r--roles/openqa/server/tasks/main.yml22
1 files changed, 19 insertions, 3 deletions
diff --git a/roles/openqa/server/tasks/main.yml b/roles/openqa/server/tasks/main.yml
index ef0839904..2df6006d3 100644
--- a/roles/openqa/server/tasks/main.yml
+++ b/roles/openqa/server/tasks/main.yml
@@ -93,6 +93,21 @@
tags:
- packages
+- name: Check test directory exists with correct ownership
+ file: path=/var/lib/openqa/share/tests/fedora state=directory owner=geekotest group=geekotest recurse=yes
+
+# we don't want to run the checkout if the tests are on a non-standard
+# branch, as that usually means we're messing around on staging and
+# don't want the checkout reset to HEAD.
+- name: Check if tests are checked out and on a non-standard branch
+ command: "git status"
+ args:
+ chdir: /var/lib/openqa/share/tests/fedora
+ register: testsbranch
+ failed_when: "1 != 1"
+ changed_when: "1 != 1"
+ always_run: true
+
- name: Check out the tests
git:
repo: https://bitbucket.org/rajcze/openqa_fedora
@@ -100,6 +115,7 @@
register: gittests
become: true
become_user: geekotest
+ when: "(testsbranch.stdout.find('Not a git repository') != -1) or (testsbranch.stdout.find('On branch develop') != -1)"
- name: Check out openqa_fedora_tools
git:
@@ -223,7 +239,7 @@
- name: Dump existing config for checking changes
shell: "/usr/share/openqa/script/dump_templates --json > /tmp/tmpl-old.json"
- when: "gittests|changed"
+ when: "(gittests is defined) and (gittests|changed)"
changed_when: "1 != 1"
# Because of the boring details of how template loading works, getting
@@ -232,12 +248,12 @@
# the *following* step will register as changed.
- name: Load tests
shell: "/var/lib/openqa/share/tests/fedora/templates --clean"
- when: "gittests|changed"
+ when: "(gittests is defined) and (gittests|changed)"
changed_when: "1 != 1"
- name: Check if the tests changed in previous step
shell: "/usr/share/openqa/script/dump_templates --json > /tmp/tmpl-new.json && json_diff /tmp/tmpl-old.json /tmp/tmpl-new.json"
- when: "gittests|changed"
+ when: "(gittests is defined) and (gittests|changed)"
register: testsdiff
changed_when: "testsdiff.rc > 0"
failed_when: "1 != 1"