From e19f6ee1f9e7d45e3c197f11bae669f6d3bc14f1 Mon Sep 17 00:00:00 2001 From: Andrei Stepanov Date: Feb 28 2018 15:50:17 +0000 Subject: always for end.yml, adjust with for str-common for not-root-user Signed-off-by: Andrei Stepanov --- diff --git a/roles/standard-test-basic/tasks/main.yml b/roles/standard-test-basic/tasks/main.yml index 9a32655..25ca4bb 100644 --- a/roles/standard-test-basic/tasks/main.yml +++ b/roles/standard-test-basic/tasks/main.yml @@ -32,13 +32,15 @@ with_items: - "{{ tests }}" + always: - include_role: name: str-common tasks_from: end.yml - # Can't go in block. See - # https://github.com/ansible/ansible/issues/20736 - - name: Check the results + # This task must be run at the end. This playbook must fail if one of the + # tests was failed. + - name: Check that all tests have PASS status shell: grep "^FAIL" {{ remote_artifacts }}/test.log register: test_fails failed_when: test_fails.stdout or test_fails.stderr + # After this task cannot follow any more tasks. diff --git a/roles/standard-test-beakerlib/tasks/main.yml b/roles/standard-test-beakerlib/tasks/main.yml index 3bdf77b..4af2b5a 100644 --- a/roles/standard-test-beakerlib/tasks/main.yml +++ b/roles/standard-test-beakerlib/tasks/main.yml @@ -117,9 +117,10 @@ name: str-common tasks_from: end.yml - # Can't go in block. See - # https://github.com/ansible/ansible/issues/20736 - - name: Check the results + # This task must be run at the end. This playbook must fail if one of the + # tests was failed. + - name: Check that all tests have PASS status shell: grep "^FAIL" {{ remote_artifacts }}/test.log register: test_fails failed_when: test_fails.stdout or test_fails.stderr + # After this task cannot follow any more tasks. diff --git a/roles/str-common/tasks/main.yml b/roles/str-common/tasks/main.yml index f259710..ad3d9c5 100644 --- a/roles/str-common/tasks/main.yml +++ b/roles/str-common/tasks/main.yml @@ -16,7 +16,7 @@ - import_tasks: pkgs.yml - name: Make artifacts directory - file: path={{ remote_artifacts }} state=directory owner=root mode=755 recurse=yes + file: path={{ remote_artifacts }} state=directory mode=755 recurse=yes # Next task requires rsync on test environment - name: Copy tests to test environment diff --git a/roles/str-common/tasks/pkgs.yml b/roles/str-common/tasks/pkgs.yml index 6e75ae9..1cab555 100644 --- a/roles/str-common/tasks/pkgs.yml +++ b/roles/str-common/tasks/pkgs.yml @@ -27,3 +27,9 @@ verbosity: 1 - include_tasks: "pkgs-{{ pkg_mgr | trim}}.yml" + # `become` param was added as an exception by request userspace + # Containerization Team. In particular by ttomecek@. Adding this parameter + # as it doesn't contradict with current workflow. Their workflow requires to + # run tests as ordinary user. In future this parameter is a question to + # remove. + become: true