Bug 1714377 - Review Request: ansible-bender - build container images using ansible playbooks
Summary: Review Request: ansible-bender - build container images using ansible playbooks
Status: POST
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2019-05-27 22:27 UTC by Gordon Messmer
Modified: 2019-07-03 19:33 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:
mhroncok: fedora-review+

Attachments (Terms of Use)
rpm build output with tests enabled, from Fedora 30 system (25.61 KB, text/plain)
2019-05-29 22:40 UTC, Gordon Messmer
no flags Details
privileged build log (25.56 KB, text/plain)
2019-05-30 14:08 UTC, Gordon Messmer
no flags Details

Description Gordon Messmer 2019-05-27 22:27:05 UTC
Spec URL: https://bitbucket.org/gordonmessmer/ansible-bender/raw/4521f815aa6d28fdea8440147430313431f7c44b/ansible-bender.spec
SRPM URL: https://kojipkgs.fedoraproject.org//work/tasks/9252/35099252/ansible-bender-0.6.1-1.fc30.src.rpm

This is a tool which bends containers using Ansible playbooks and
turns them into container images. It has a pluggable builder selection
— it is up to you to pick the tool which will be used to construct
your container image. Right now the only supported builder is
buildah. More to come in the future. Ansible-bender (ab) relies on
Ansible connection plugins for performing builds.

tl;dr Ansible is the frontend, buildah is the backend.

Fedora Account System Username: gordonmessmer

Comment 1 Gordon Messmer 2019-05-27 22:28:39 UTC
This is my first package in Fedora, so I need a sponsor.

Successful koji task is here:

Comment 2 Miro Hrončok 2019-05-28 11:50:41 UTC
I can sponsor you.

Let's finish this review first and later I'll need you to do some reviews for others, if that's OK.


Early feedback:

Spec looks simple and sane. 


Please, add a %check section with tests:



As a matter of style (totally feel free to ignore this):

1) when requires are one package per line, they tend to be better managed in git than putting them all in one line

2) the package already requires this by RPM mechanisms:

python(abi) = 3.7

 => there is no need to require python3 manually (and while harmless in Fedora, such require could break for example in RHEL 8 if building for other Python version).

Comment 3 Gordon Messmer 2019-05-28 16:44:54 UTC
I'd be very happy to review other submissions.  Are there guidelines for reviewers?

I've added a %check section, and expanded buildrequires to support it.  I've also used the python3_pkgversion macro to support a future build in EPEL (which currently lacks a few required modules).

Updated spec:

Updated koji build:

Comment 5 Dominik 'Rathann' Mierzejewski 2019-05-28 20:07:14 UTC
Please conditionalize the BuildRequires: needed for %check so that the package can be built without them. See https://src.fedoraproject.org/rpms/sbsigntools/blob/master/f/sbsigntools.spec for a simple example. In short, put %bcond_without check at the top and wrap %check-related BRs and the whole %check section with %if %{with check} / %endif.

Another important point is to bump the Release: field and add a %changelog entry for each review iteration.

Lastly, please see if you can run the tests in parallel, using something like (if necessary):

PYTHONPATH=%{buildroot}%{python3_sitelib}:%{buildroot}%{python3_sitearch} \
 pytest-%{python3_version} \
 -v \
 --disable-pytest-warnings \
 --numprocesses=auto \

You might need to add python3-pytest-xdist to BRs.

Comment 6 Miro Hrončok 2019-05-28 21:04:38 UTC
No tests are run:

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.4t5w9E
+ umask 022
+ cd /builddir/build/BUILD
+ cd ansible-bender-0.6.1
+ /usr/bin/python3 setup.py test
running test
running egg_info
writing ansible_bender.egg-info/PKG-INFO
writing dependency_links to ansible_bender.egg-info/dependency_links.txt
writing entry points to ansible_bender.egg-info/entry_points.txt
writing requirements to ansible_bender.egg-info/requires.txt
writing top-level names to ansible_bender.egg-info/top_level.txt
reading manifest file 'ansible_bender.egg-info/SOURCES.txt'
writing manifest file 'ansible_bender.egg-info/SOURCES.txt'
running build_ext
BUILDSTDERR: ----------------------------------------------------------------------
BUILDSTDERR: Ran 0 tests in 0.000s

Comment 7 Gordon Messmer 2019-05-29 22:39:01 UTC
So, the bad news is that all of the tests, including the unit tests, require network connectivity and cannot be run in mock.

The good news is that I built an F30 VM and ran the build with tests there and got a successful run.  I'll attach the build log, and hope that's suitable until tests that run in mock are available.  (Tests also revealed a packaging bug: the tool requires ansible-python3.)

The updated spec is here: https://bitbucket.org/gordonmessmer/ansible-bender/raw/7420961d8ad0a2727407b36a22348cce8552d8dc/ansible-bender.spec

The updated koji build is here: https://koji.fedoraproject.org/koji/taskinfo?taskID=35135459

Tests are conditional, but off by default so that the build completes in koji.  The release is bumped and new changelog entries added.  Tests are run in parallel.

Your feedback has been invaluable.  Thank you both for your time.  Please let me know if any other changes are needed.

Comment 8 Gordon Messmer 2019-05-29 22:40:10 UTC
Created attachment 1575004 [details]
rpm build output with tests enabled, from Fedora 30 system

Comment 9 Miro Hrončok 2019-05-29 22:57:13 UTC
On Fedora 29, 30 and rawhide, ansible-python3 is provided by the ansible package for backwards compatibility only. It should just need ansible.


When the tests are disabled by default, I suggest adding a comment to the spec explaining why, something like:

# All tests require Internet access
# to test in mock use:  --enable-network --with check
%bcond_with     check



the sitearch part is useless here, as the package only installs to sitelib.


pytest-%{python3_version} can be simplified to: pytest-3

Comment 10 Gordon Messmer 2019-05-30 01:14:24 UTC
I wasn't previously aware of the "--enable-network" flag for mock.  However, that's not enough to allow the tests to run.  The build log includes:

Error: error running newgidmap: exit status 1: newgidmap: write to gid_map failed: Operation not permitted

I'll continue to look into that for a while (unless there are known solutions for using rootless container tools in mock).  I see that the mock environment includes values for mockbuild in /etc/sub[ug]id, so I'm actually surprised that this doesn't work.

Comment 11 Gordon Messmer 2019-05-30 03:50:02 UTC
spec URL: https://bitbucket.org/gordonmessmer/ansible-bender/raw/e4b6e6b31b183acfc1c4bd748b402e07986446b9/ansible-bender.spec
koji URL: https://koji.fedoraproject.org/koji/taskinfo?taskID=35138464

I've included each of the suggested changes other than the comment regarding mock builds.  Hopefully that narrows the focus of the review to just the issue of tests, for now.

If you'd like, I could include two levels of conditions.  --with check could be used to run the unit tests only by default and --with check --with alltests could be used to run the full set.  This gets a little messy, but I have a branch in the git repo so that you can review that option.  It does allow unit tests to run successfully in mock.


Comment 12 Miro Hrončok 2019-05-30 09:53:58 UTC
I like the double conditional, but I'd call it --with privileged_tests (that's a gain a matter of style and feel free to keep as is).

The %check section can be simplified:

%if %{with check}
PYTHONPATH=%{buildroot}%{python3_sitelib} \
  pytest-3 \
  -v \
  --disable-pytest-warnings \
  --numprocesses=auto \
%if %{with privileged_tests}

Comment 14 Gordon Messmer 2019-05-30 14:08:13 UTC
Created attachment 1575249 [details]
privileged build log

Comment 15 Miro Hrončok 2019-05-30 14:20:48 UTC
Gordon, you receive feedback very well, thanks!

Once you decide to do some reviews, feel free to ask me for help (here, e-mail or IRC (mhrocnok at #fedora-devel)) but even if you don't, please:

 * indicate that you are not yet sponsored when providing reviews
 * share the reviews with me (link them here or CC me in bugzilla)


Dominik, would you like to finish the review here?

Comment 16 Gordon Messmer 2019-07-02 16:11:37 UTC
Thanks for sponsoring me (and for all of the kind words), Miro.  Are there any additional steps required to approve this review?

Comment 17 Miro Hrončok 2019-07-02 16:41:29 UTC
This still needs to be reviewed. So far I've only provided informal feedback.

Let me do that now.

Comment 18 Miro Hrončok 2019-07-02 16:50:39 UTC
Please post new URLs in the form of

Spec URL: ...

The Koji SRPM was garbage collected.

Comment 20 Miro Hrončok 2019-07-02 22:16:47 UTC
Package Review


1) The actual license seems to be MIT, not GPLv3.

2) There are no versions in %changelog.

3) please see why ansible_bender/version.py is empty.

[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated

===== MUST items =====

[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
[!]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "Unknown or generated", "Expat License".
[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[-]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Package is not known to require an ExcludeArch tag.
[-]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 30720 bytes in 2 files.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[x]: Package requires other packages for directories it uses.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

[x]: Python eggs must not download any dependencies during the build
[x]: A package which is used by another package via an egg interface should
     provide egg info.
[x]: Package meets the Packaging Guidelines::Python
[x]: Package contains BR: python2-devel or python3-devel
[x]: Packages MUST NOT have dependencies (either build-time or runtime) on
     packages named with the unversioned python- prefix unless no properly
     versioned package exists. Dependencies on Python packages instead MUST
     use names beginning with python2- or python3- as appropriate.
[x]: Python packages must not contain %{pythonX_site(lib|arch)}/* in %files
[x]: Binary eggs must be removed in %prep

===== SHOULD items =====

[-]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[?]: Package functions as described.
[?]: Latest version is packaged.
[-]: Package does not include license text files separate from upstream.
[-]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[?]: Package should compile and build into binary rpms on all supported
[x]: %check is present and all tests pass.
[?]: Packages should try to preserve timestamps of original installed
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Spec file according to URL is the same as in SRPM.

Checking: ansible-bender-0.6.1-5.fc31.noarch.rpm
ansible-bender.noarch: W: spelling-error %description -l en_US tl -> Tl, t, l
ansible-bender.noarch: W: spelling-error %description -l en_US dr -> rd, Dr, fr
ansible-bender.noarch: W: spelling-error %description -l en_US frontend -> fronted, front end, front-end
ansible-bender.noarch: W: no-version-in-last-changelog
ansible-bender.noarch: E: zero-length /usr/lib/python3.7/site-packages/ansible_bender/version.py
ansible-bender.noarch: W: no-manual-page-for-binary ansible-bender
ansible-bender.src: W: spelling-error %description -l en_US buildah -> build ah, build-ah, build
ansible-bender.src: W: spelling-error %description -l en_US tl -> Tl, t, l
ansible-bender.src: W: spelling-error %description -l en_US dr -> rd, Dr, fr
ansible-bender.src: W: spelling-error %description -l en_US frontend -> fronted, front end, front-end
ansible-bender.src: W: no-version-in-last-changelog
2 packages and 0 specfiles checked; 1 errors, 10 warnings.

Source checksums
https://files.pythonhosted.org/packages/source/a/ansible-bender/ansible-bender-0.6.1.tar.gz :
  CHECKSUM(SHA256) this package     : 812f0cff2030a92251b515a3670c6a795292ccdd962d6004af3f70c4b7a701da
  CHECKSUM(SHA256) upstream package : 812f0cff2030a92251b515a3670c6a795292ccdd962d6004af3f70c4b7a701da

ansible-bender (rpmlib, GLIBC filtered):


Comment 21 Gordon Messmer 2019-07-02 22:53:05 UTC
Spec URL: https://bitbucket.org/gordonmessmer/ansible-bender/raw/f0e302132eb77f95e2a6843040a75fcd78a7987b/ansible-bender.spec
SRPM URL: https://kojipkgs.fedoraproject.org//work/tasks/1047/36011047/ansible-bender-0.6.1-6.fc30.src.rpm

> 1) The actual license seems to be MIT, not GPLv3.

I have no idea how I managed to get that wrong.

> 2) There are no versions in %changelog.


> 3) please see why ansible_bender/version.py is empty.

The last commit to that file appears to have emptied it but not removed it:

I'm unsure why the author might leave the file present, but I can ask them if the answer is important.

Comment 22 Miro Hrončok 2019-07-02 23:18:51 UTC
3 is not important.

Package APPROVED. Feel free to trim the changelog when importing as the in-review releases were never shipped to users.

Comment 23 Gwyn Ciesla 2019-07-03 19:33:14 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/ansible-bender

Note You need to log in before you can comment on or make changes to this bug.