From 63be2a424c20a8d7e512b73f48e841a03d8fe4ca Mon Sep 17 00:00:00 2001 From: Bruno Goncalves Date: Jun 03 2020 09:52:12 +0000 Subject: update source role documentation * source role already copies files to the VM, no need to define it on test playbook * there is no need to set tenv_workdir in the playbooks anymore * Add quotes to example to make it more clear. Ansible requires quotes when parameter is just the ansible variable, but it is optional if it is part of string. fix: https://pagure.io/standard-test-roles/issue/384 --- diff --git a/roles/standard-test-source/README.md b/roles/standard-test-source/README.md index d419a50..8eeab1d 100644 --- a/roles/standard-test-source/README.md +++ b/roles/standard-test-source/README.md @@ -6,13 +6,17 @@ the package spec file into a test/source/ directory. You can then use or execute files (usually tests) from the upstream sources in your playbook. +The whole playbook directory including tarball(s), patches and the spec file will be available on {{ tenv_workdir }}. + You can redefine the following variables: * srcdir: A directory to extract sources into. This defaults to {{ playbook_dir }}/source/ + This variable is ignored if fetch_only is True. * flatten: Strip one level of path prefix in source tree. This defaults to True - * fetch_only: If True the role will only fetch the source and will skip rpmbuild --bp part. + This variable is ignored if fetch_only is True. + * fetch_only: If True the role will fetch the source, copy files including source to test environment under {{ tenv_workdir }} and it will skip rpmbuild --bp part. Set to True if spec file %prep section requires packages that are not available on test runner. This defaults to False @@ -40,22 +44,12 @@ Example usage with fetch_only = True: - hosts: localhost tags: - classic - vars: - # standard-test-basic directory for tests are relative to {{ tenv_workdir }} - tenv_workdir: /var/test pre_tasks: - import_role: name: standard-test-source vars: fetch_only: True - - name: Copy files including source to test environment - synchronize: - src: "{{ playbook_dir }}/.." - dest: "{{ tenv_workdir }}" - mode: push - ssh_args: "-o UserKnownHostsFile=/dev/null" - roles: - role: standard-test-basic required_packages: @@ -65,11 +59,12 @@ Example usage with fetch_only = True: - rpm-build tests: - prepare-source: + # basic role uses the path from dir parameter as relative to test directory, therefore dir: "{{tenv_workdir}}" doesn't work dir: ./ - run: rpmbuild -bp {{tenv_workdir}}/*.spec --nodeps --define "_sourcedir {{tenv_workdir}}" --define "_builddir {{tenv_workdir}}/source" + run: "rpmbuild -bp {{tenv_workdir}}/*.spec --nodeps --define '_sourcedir {{tenv_workdir}}' --define '_builddir {{tenv_workdir}}/source'" - flatten-source: dir: ./ - run: shopt -s dotglob; mv {{tenv_workdir}}/source/*/* {{tenv_workdir}}/source + run: "shopt -s dotglob; mv {{tenv_workdir}}/source/*/* {{tenv_workdir}}/source" - smoke: dir: ./source - run: make check + run: "make check"