#186 Remove copr rhts.
Merged 5 years ago by astepano. Opened 5 years ago by astepano.

@@ -127,7 +127,7 @@ 

                               "-net", "nic,model=virtio", "-net", "user,hostfwd=tcp:127.0.0.3:{0}-:22".format(port),

                               "-device", "virtio-rng-pci", "-rtc", "base=utc",

                               "-device", "isa-serial,chardev=pts2", "-chardev", "file,id=pts2,path=" + log,

-                              "-display", "none"], stdout=open(log, 'a'), stderr=subprocess.STDOUT), port

+                              "-display", "none", "-vnc", ":1"], stdout=open(log, 'a'), stderr=subprocess.STDOUT), port

  

  

  def inv_host(image):

@@ -0,0 +1,3 @@ 

+ # This care about this lists will take str-common-init

+ role_pkgs_req:

+   - rsync

@@ -1,4 +1,4 @@ 

  ---

  

  dependencies:

-   - role: str-common

+   - role: str-common-init

@@ -47,13 +47,18 @@ 

      with_items:

      - "{{ tests }}"

  

-   - 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

      shell: grep "^FAIL" {{ remote_artifacts }}/test.log

      register: test_fails

-     failed_when: test_fails.stdout or test_fails.stderr

+     # Never fail at this step. Just store result of tests.

+     failed_when: False

+ 

+   - name: Set role result

+     set_fact:

+       role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}"

+       role_result_msg: "{{ test_fails.stdout|d('tests failed.') }}"

+ 

+   - include_role:

+       name: str-common-final

@@ -6,3 +6,12 @@ 

    centos_7: *rhel_7

    fedora:

      - python2-lxml

+ 

+ # This care about this lists will take str-common-init

+ role_pkgs_req:

+   - beakerlib

+   - rsync

+   - make

+   - libselinux-python

+   - "{{ beakerlib_pkgs_req[distro_name_ver] | default([]) }}"

+   - "{{ beakerlib_pkgs_req[distro_name] | default([]) }}"

@@ -0,0 +1,49 @@ 

+ #!/bin/bash

+ # Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material 

+ # is made available to anyone wishing to use, modify, copy, or 

+ # redistribute it subject to the terms and conditions of the GNU General 

+ # Public License v.2.

+ # 

+ # This program is distributed in the hope that it will be useful, but WITHOUT ANY

+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

+ # PARTICULAR PURPOSE. See the GNU General Public License for more details.

+ #

+ # You should have received a copy of the GNU General Public License

+ # along with this program; if not, write to the Free Software

+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

+ #

+ # Authors: Bill Peck

+ 

+ if [ -z "$OUTPUTFILE" ]; then

+         export OUTPUTFILE=`mktemp /mnt/testarea/tmp.XXXXXX`

+ fi

+ 

+ if [ -z "$ARCH" ]; then

+         ARCH=$(uname -i)

+ fi

+ 

+ if [ -z "$FAMILY" ]; then

+         FAMILY=$(cat /etc/redhat-release | sed -e 's/\(.*\)release\s\([0-9]*\).*/\1\2/; s/\s//g')

+ fi

+ 

+ function report_result {

+ 	# Pass OUTPUTFILE to rstrnt-report-result in case the variable wasn't exported

+     # astepano@ : Not implemented for standard-test-roles

+         #OUTPUTFILE=$OUTPUTFILE rstrnt-report-result "$@"

+     :

+ }

+ 

+ function runuser_ {

+         $(which runuser 2>/dev/null || which /sbin/runuser 2>/dev/null || echo /bin/su) "$@"

+ }

+ 

+ function runas_ {

+         local user=$1 cmd=$2

+         if [ -n "$user" ]; then

+                 echo "As $user: "

+                 HOME=$(eval "echo ~$user") LOGNAME=$user USER=$user runuser_ -m -c "$cmd" $user

+         else

+                 echo "As $(whoami): "

+                 $cmd

+         fi

+ }

@@ -0,0 +1,32 @@ 

+ #!/bin/bash

+ # Copyright (c) 2006 Red Hat, Inc.

+ #

+ # This program is free software: you can redistribute it and/or

+ # modify it under the terms of the GNU General Public License as

+ # published by the Free Software Foundation, either version 2 of

+ # the License, or (at your option) any later version.

+ #

+ # This program is distributed in the hope that it will be

+ # useful, but WITHOUT ANY WARRANTY; without even the implied

+ # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR

+ # PURPOSE. See the GNU General Public License for more details.

+ #

+ # You should have received a copy of the GNU General Public License

+ # along with this program. If not, see http://www.gnu.org/licenses/.

+ #

+ # Author: Greg Nichols <gnichols@redhat.com>

+ # Author: Bill Peck <bpeck@redhat.com>

+ 

+ #

+ # rhts-make.include

+ #

+ # Stripped everything but the basics so rhts tests can run.

+ #

+ 

+ # This file was copied to STR from restraint-rhts RPM.

+ 

+ # Common Variables.

+ TEST_DIR=/mnt/tests$(TEST)

+ INSTALL_DIR=$(DEST)$(TEST_DIR)

+ METADATA=testinfo.desc

+ 

@@ -1,4 +1,9 @@ 

  ---

  

+ # Before this run:

+ # If roles/x/vars/main.yml exists, variables listed therein will be added to the play.

+ # If roles/x/defaults/main.yml exists, variables listed therein will be added to the play.

+ # https://docs.ansible.com/ansible/2.5/user_guide/playbooks_reuse_roles.html

+ 

  dependencies:

-   - role: str-common

+   - role: str-common-init

@@ -1,81 +1,49 @@ 

  ---

  

- - delegate_to: "{{ test_runner_inventory_name }}"

-   block:

-   - name: Add restraint repo for restraint-rhts using DNF

-     block:

-       - package: name=dnf-plugins-core state=present

-       - shell: dnf copr enable -y bpeck/restraint

-         ignore_errors: True

-     when: "hostvars[test_runner_inventory_name]['is_dnf_os'] | bool"

- 

-   - name: Add restraint repo for restraint-rhts using YUM

-     block:

-       - package: name=yum-plugin-copr

-       - shell: yum copr -y enable bpeck/restraint

-         ignore_errors: True

-     when: "hostvars[test_runner_inventory_name]['is_yum_os'] | bool"

- 

-   - name: Install the beakerlib requirements

-     package: name={{item}} state=present

-     with_items:

-     - beakerlib

-     - restraint-rhts

-     - rsync

- 

  - debug:

      msg: >

        1 req pkgs for: {{ distro_name }}: {{ beakerlib_pkgs_req[distro_name] | default([]) }}

        2 req pkgs for: {{ distro_name_ver }}: {{ beakerlib_pkgs_req[distro_name_ver] | default([]) }}

      verbosity: 1

  

- - name: Install the beakerlib requirements to test environment

-   package: name={{item}} state=latest

-   with_flattened:

-     - - rsync

-       - findutils

-       - make

-       - libselinux-python

-     - "{{ beakerlib_pkgs_req[distro_name_ver] | default([]) }}"

-     - "{{ beakerlib_pkgs_req[distro_name] | default([]) }}"

-   when: not is_atomic

+ - name: Turn on usroverlay for Atomic Host

+   when: is_atomic

+   # This is dirty hack. It was made as temporary solution.

+   command: rpm-ostree usroverlay

  

- - name: Put beakerlib binaries to test environment

+ - name: Put beakerlib binaries to test environment Atomic Host

+   when: is_atomic

    copy:

      src: "{{ item }}"

      dest: "{{ tenv_workdir }}"

      mode: 755

    with_fileglob:

-     - "/usr/bin/beakerlib-*"

-     - "/usr/share/beakerlib/*"

-     - "/usr/bin/rhts-*"

-     - "/usr/share/rhts/*"

-     - "/usr/share/rhts/lib/*"

-     - "/usr/bin/rstrnt-*"

-     - "/usr/share/restraint/*"

      - "rpm.py"

  

+ - name: Copy rhts files to test environment /usr/share/rhts/lib

+   copy:

+     src: "{{ item }}"

+     dest: "/usr/share/rhts/lib/"

+     mode: 755

+     force: no

+   with_fileglob:

+     - "rhts-make.include"

+ 

+ - name: Copy rhts files to test environment /bin

+   copy:

+     src: "{{ item }}"

+     dest: "/usr/bin/"

+     mode: 755

+     force: no

+   with_fileglob:

+     - "rhts-environment.sh"

+ 

  - name: Copy tests to test environment

    synchronize:

      src: "{{ playbook_dir }}/"

      dest: "{{ tenv_workdir }}"

      ssh_args: "-o UserKnownHostsFile=/dev/null"

  

- - name: Fix up beakerlib at tests environment

-   shell: >

-     find {{ tenv_workdir }} -type f

-     |

-     xargs sed -i

-     -e 's|/usr/share/beakerlib|{{ tenv_workdir }}|g'

-     -e 's|/usr/lib/beakerlib|{{ tenv_workdir }}|g'

-     -e 's|/usr/share/rhts/lib/rhts-|{{ tenv_workdir }}/rhts-|g'

-     -e 's|/usr/bin/rhts-|{{ tenv_workdir }}/rhts-|g'

-     -e 's|/usr/share/rhts/lib/rhts_|{{ tenv_workdir }}/rhts-|g'

-     -e 's|/usr/bin/rhts_|{{ tenv_workdir }}/rhts-|g'

-     -e 's|/usr/share/rhts-library/rhtslib.sh|{{ tenv_workdir }}/beakerlib.sh|g'

-     -e 's|/usr/bin/rstrnt-|{{ tenv_workdir }}/rstrnt-|g'

- 

- 

  - block:

    - name: Run beakerlib tests

      shell: |
@@ -124,13 +92,18 @@ 

      with_items:

      - "{{ tests }}"

  

-   - 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

      shell: grep "^FAIL" {{ remote_artifacts }}/test.log

      register: test_fails

-     failed_when: test_fails.stdout or test_fails.stderr

+     # Never fail at this step. Just store result of tests.

+     failed_when: False

+ 

+   - name: Set role result

+     set_fact:

+       role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}"

+       role_result_msg: "{{ test_fails.stdout|d('Beaker tests failed.') }}"

+ 

+   - include_role:

+       name: str-common-final

roles/str-common-final/tasks/main.yml roles/str-common/tasks/end.yml
file renamed
+9
@@ -7,3 +7,12 @@ 

      mode: pull

      ssh_args: "-o UserKnownHostsFile=/dev/null"

    when: artifacts|default("") != ""

+ 

+ - name: Report role result

+   vars:

+     msg: |

+        Tests failed: {{ role_result_failed|d('Undefined') }}

+        Tests msg: {{ role_result_msg|d('None') }}

+   debug:

+     msg: "{{ msg.split('\n') }}"

+   failed_when: "role_result_failed|bool"

roles/str-common-init/defaults/main.yml roles/str-common/defaults/main.yml
file renamed
file was moved with no change to the file
roles/str-common-init/tasks/inspect.yml roles/str-common/tasks/inspect.yml
file renamed
file was moved with no change to the file
roles/str-common-init/tasks/main.yml roles/str-common/tasks/main.yml
file renamed
file was moved with no change to the file
roles/str-common-init/tasks/pkgs-dnf.yml roles/str-common/tasks/pkgs-dnf.yml
file renamed
+3 -2
@@ -1,8 +1,9 @@ 

  - name: Install test-specific package requirements

    # Note, this method cannot install -debuginfo packages.

    package: name={{item}} state=present

-   with_items:

-     - "{{ pkgs_ordinary_req|d|list }}"

+   with_flattened:

+     - "{{ pkgs_ordinary_req|d|list|flatten }}"

+     - "{{ role_pkgs_req|d|list|flatten }}"

  

  - name: Install the common requirements on target

    package: name={{item}} state=present

roles/str-common-init/tasks/pkgs-rpm-ostree.yml roles/str-common/tasks/pkgs-rpm-ostree.yml
file renamed
+10 -4
@@ -1,14 +1,20 @@ 

  - block:

+   - name: Make a list of requested packages for Atomic Host

+     set_fact:

+       pkgs_atomic_req: "{{ pkgs_ordinary_req|d|flatten|join(' ') }} {{ role_pkgs_req|d|list|flatten|join(' ') }}"

+   - debug:

+       msg: "Requested packages for Atomic Host: {{ pkgs_atomic_req }}"

+       verbosity: 1

    - name: Check presence of test-specific package requirements

-     shell: rpm -q {{ pkgs_ordinary_req|join(" ") }}

+     shell: rpm -q {{ pkgs_atomic_req }}

      register: package_check

      changed_when: False

      failed_when: False

      args: { warn: no }

    - name: Install test-specific package requirements

      shell:

-       rpm-ostree install {{ pkgs_ordinary_req|join(" ") }}

+       rpm-ostree install {{ pkgs_atomic_req }}

        && rpm-ostree ex livefs

      when: package_check.rc != 0

-   when:

-     - pkgs_ordinary_req

+   when: (pkgs_ordinary_req|d(false)) or

+         (role_pkgs_req|d(false))

roles/str-common-init/tasks/pkgs-yum.yml roles/str-common/tasks/pkgs-yum.yml
file renamed
+3 -2
@@ -1,8 +1,9 @@ 

  - name: Install test-specific package requirements

    # Note, this method cannot install -debuginfo packages.

    package: name={{item}} state=present

-   with_items:

-     - "{{ pkgs_ordinary_req|d|list }}"

+   with_flattened:

+     - "{{ pkgs_ordinary_req|d|list|flatten }}"

+     - "{{ role_pkgs_req|d|list|flatten }}"

  

  - name: Install the common requirements on target

    package: name={{item}} state=present

roles/str-common-init/tasks/pkgs.yml roles/str-common/tasks/pkgs.yml
file renamed
+3 -1
@@ -19,7 +19,9 @@ 

        }}

      pkg_mgr: >

        {{

-          'rpm-ostree' if ansible_pkg_mgr == 'unknown' and is_atomic else ansible_pkg_mgr

+          'rpm-ostree' if (is_atomic and

+                              (ansible_pkg_mgr == 'unknown' or

+                               ansible_pkg_mgr == 'atomic_container')) else ansible_pkg_mgr

        }}

  

  - debug:

roles/str-common-init/tasks/trunner.yml roles/str-common/tasks/trunner.yml
file renamed
+1 -1
@@ -28,7 +28,7 @@ 

    # Fix python ansible interpreter when running on RHEL8. Currently RHEL8

    # uses python2, but it does miss some python2 modules, such as python2-dnf.

    # This can be removed once RHEL8 uses by default Python 3.

-   - name: Hardcode Python interpreter for ansible modules on RHEL8 based OS

+   - name: Hardcode Python interpreter for ansible modules on RHEL8 based OS for test-runner

      delegate_facts: True

      set_fact:

        ansible_python_interpreter: /usr/bin/env python3

Commit e88972a fixes this pull-request

Pull-Request has been merged by astepano

5 years ago

Pull-Request has been merged by astepano

5 years ago

Er, this PR seemes to contain a lot of things unrelated to rhts. Specifically, the change to add -vnc :1 in https://pagure.io/standard-test-roles/c/e88972ada073e660f69b7b35cb3899b47eb099e0?branch=master
causes port conflicts in the ostree tests:
https://s3.amazonaws.com/aos-ci/ghprb/ostreedev/ostree/3dab08fa72ea78ca24e50d18a9f6140f13263c4f.0.1525728778851879000/artifacts/artifacts/fedora-atomic-host.qcow2.log

But even that aside there's a lot going on besides rhts. Let's revert this and try again?

Metadata