Compare commits
72 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63beeb44cb | ||
|
|
d0c5874fea | ||
|
|
e47708bd5d | ||
|
|
f464c91523 | ||
|
|
23e4f0dde1 | ||
|
|
0bec49e0e1 | ||
|
|
21ade5ae2f | ||
|
|
c4e0616b31 | ||
|
|
a18cd68f16 | ||
|
|
bff15e3e6b | ||
|
|
ff7127f2a1 | ||
|
|
bd5c26b807 | ||
|
|
988d7d52ef | ||
|
|
242bfab597 | ||
|
|
4b3e04c726 | ||
|
|
4741d7d936 | ||
|
|
93e3f18058 | ||
|
|
5a52e37d2d | ||
|
|
953b4694b0 | ||
|
|
7600b1cbfe | ||
|
|
05ca2cd222 | ||
|
|
90f05b7f02 | ||
|
|
b170e380d7 | ||
|
|
fa7ff5ae4e | ||
|
|
5a5d543e34 | ||
|
|
3a806ca045 | ||
|
|
37fd89e2d1 | ||
|
|
901661cc11 | ||
|
|
97991f0caf | ||
|
|
c6a8933373 | ||
|
|
8c30ff072a | ||
|
|
7fd15342f5 | ||
|
|
556c89e3f2 | ||
|
|
e48d668fd2 | ||
|
|
054991ff9c | ||
|
|
681258f807 | ||
|
|
32faa4d5b4 | ||
|
|
2b0c2a9505 | ||
|
|
786f853eed | ||
|
|
53cd28aec0 | ||
|
|
4c4350aa4c | ||
|
|
673aa59188 | ||
|
|
32c6bc15a9 | ||
|
|
87e04b4b9a | ||
|
|
ebaff1a55e | ||
|
|
bc731a110c | ||
|
|
c966745051 | ||
|
|
2a5fe87a24 | ||
|
|
d3886bb02e | ||
|
|
19a0a91035 | ||
|
|
cb037f3273 | ||
|
|
0aec3a8165 | ||
|
|
90bb9e99ec | ||
|
|
58f8ab245d | ||
|
|
13dc2c9b38 | ||
|
|
6009b4eaac | ||
|
|
4000f6b905 | ||
|
|
9fcf25a30f | ||
|
|
66c7bbdf51 | ||
|
|
c813b56991 | ||
|
|
a8555fbe96 | ||
|
|
269ba7f4a4 | ||
|
|
740bb18c4e | ||
|
|
749efd55a5 | ||
|
|
0e13b110e6 | ||
|
|
a12a53ae2b | ||
|
|
3c5638e0d6 | ||
|
|
8f1f5a3284 | ||
|
|
2b977dae7e | ||
|
|
52ccad4069 | ||
|
|
8aaf23bd79 | ||
|
|
9abba20d38 |
42 changed files with 373 additions and 1150 deletions
29
.gitignore
vendored
29
.gitignore
vendored
|
|
@ -274,3 +274,32 @@
|
|||
/buildah-96a136e.tar.gz
|
||||
/buildah-2df08f0.tar.gz
|
||||
/buildah-a99139c.tar.gz
|
||||
/buildah-2c5da1b.tar.gz
|
||||
/buildah-413bd1f.tar.gz
|
||||
/buildah-0bafbfe.tar.gz
|
||||
/buildah-bdd78ad.tar.gz
|
||||
/buildah-21b4778.tar.gz
|
||||
/buildah-9513cb8.tar.gz
|
||||
/buildah-6cc4656.tar.gz
|
||||
/v1.13.2.tar.gz
|
||||
/v1.14.0.tar.gz
|
||||
/v1.14.1.tar.gz
|
||||
/v1.14.2.tar.gz
|
||||
/v1.14.3.tar.gz
|
||||
/buildah-843d15d.tar.gz
|
||||
/v1.14.4.tar.gz
|
||||
/v1.14.5.tar.gz
|
||||
/v1.14.6.tar.gz
|
||||
/v1.14.7.tar.gz
|
||||
/v1.14.8.tar.gz
|
||||
/v1.14.9.tar.gz
|
||||
/v1.15.0.tar.gz
|
||||
/v1.15.1.tar.gz
|
||||
/v1.15.2.tar.gz
|
||||
/v1.16.0.tar.gz
|
||||
/v1.16.1.tar.gz
|
||||
/v1.16.2.tar.gz
|
||||
/v1.16.4.tar.gz
|
||||
/v1.16.5.tar.gz
|
||||
/v1.17.0.tar.gz
|
||||
/v1.18.0.tar.gz
|
||||
|
|
|
|||
275
buildah.spec
275
buildah.spec
|
|
@ -1,5 +1,10 @@
|
|||
%global with_bundled 1
|
||||
|
||||
%if 0%{?fedora}
|
||||
%global with_debug 1
|
||||
%else
|
||||
%global with_debug 0
|
||||
%endif
|
||||
|
||||
%if 0%{?with_debug}
|
||||
%global _find_debuginfo_dwz_opts %{nil}
|
||||
|
|
@ -8,46 +13,56 @@
|
|||
%global debug_package %{nil}
|
||||
%endif
|
||||
|
||||
%global provider github
|
||||
%global provider_tld com
|
||||
%global project containers
|
||||
%global repo buildah
|
||||
%if ! 0%{?gobuild:1}
|
||||
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**};
|
||||
%endif
|
||||
|
||||
%define provider github
|
||||
%define provider_tld com
|
||||
%define project containers
|
||||
%define repo buildah
|
||||
# https://github.com/containers/buildah
|
||||
%global import_path %{provider}.%{provider_tld}/%{project}/%{repo}
|
||||
%global git0 https://%{import_path}
|
||||
%global commit0 a99139c1965b4426177fc70ee53a8e8dfdf3b6f9
|
||||
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
|
||||
%define import_path %{provider}.%{provider_tld}/%{project}/%{repo}
|
||||
%define git0 https://%{import_path}
|
||||
|
||||
# Used for comparing with latest upstream tag
|
||||
# to decide whether to autobuild (non-rawhide only)
|
||||
%define built_tag v1.18.0
|
||||
%define built_tag_strip %(b=%{built_tag}; echo ${b:1})
|
||||
%define download_url https://github.com/containers/%{name}/archive/%{built_tag}.tar.gz
|
||||
|
||||
Name: %{repo}
|
||||
Version: 1.11.0
|
||||
Release: 0.16.dev.git%{shortcommit0}%{?dist}
|
||||
Version: 1.18.0
|
||||
Release: 1%{?dist}
|
||||
Summary: A command line tool used for creating OCI Images
|
||||
License: ASL 2.0
|
||||
URL: https://%{name}.io
|
||||
Source: %{git0}/archive/%{commit0}/%{name}-%{shortcommit0}.tar.gz
|
||||
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
|
||||
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
||||
Source: %{download_url}
|
||||
BuildRequires: golang
|
||||
BuildRequires: git
|
||||
BuildRequires: glib2-devel
|
||||
BuildRequires: libseccomp-static
|
||||
BuildRequires: ostree-devel
|
||||
BuildRequires: glibc-static
|
||||
BuildRequires: golang-github-cpuguy83-md2man
|
||||
BuildRequires: go-md2man
|
||||
BuildRequires: gpgme-devel
|
||||
BuildRequires: device-mapper-devel
|
||||
BuildRequires: btrfs-progs-devel
|
||||
BuildRequires: libassuan-devel
|
||||
BuildRequires: make
|
||||
Requires: runc >= 1.0.0-17
|
||||
Requires: containers-common
|
||||
%if 0%{?fedora}
|
||||
Requires: crun >= 0.10-1
|
||||
BuildRequires: btrfs-progs-devel
|
||||
BuildRequires: device-mapper-devel
|
||||
BuildRequires: ostree-devel
|
||||
BuildRequires: libseccomp-static
|
||||
Recommends: container-selinux
|
||||
Recommends: slirp4netns >= 0.3-0
|
||||
Recommends: fuse-overlayfs
|
||||
%else
|
||||
#### DO NOT REMOVE - NEEDED FOR CENTOS
|
||||
BuildRequires: libseccomp-devel
|
||||
Requires: libseccomp
|
||||
Requires: container-selinux
|
||||
Requires: slirp4netns >= 0.3-0
|
||||
Requires: runc
|
||||
%endif
|
||||
|
||||
%description
|
||||
|
|
@ -59,8 +74,25 @@ or
|
|||
* save container's root file system layer to create a new image
|
||||
* delete a working container or an image
|
||||
|
||||
%package tests
|
||||
Summary: Tests for %{name}
|
||||
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: bats
|
||||
Requires: bzip2
|
||||
Requires: podman
|
||||
Requires: golang
|
||||
Requires: jq
|
||||
Requires: httpd-tools
|
||||
Requires: openssl
|
||||
|
||||
%description tests
|
||||
%{summary}
|
||||
|
||||
This package contains system tests for %{name}
|
||||
|
||||
%prep
|
||||
%autosetup -Sgit -n %{name}-%{commit0}
|
||||
%autosetup -Sgit -n %{name}-%{built_tag_strip}
|
||||
sed -i 's/GOMD2MAN =/GOMD2MAN ?=/' docs/Makefile
|
||||
sed -i '/docs install/d' Makefile
|
||||
|
||||
|
|
@ -75,7 +107,12 @@ mv vendor src
|
|||
|
||||
export GOPATH=$(pwd)/_build:$(pwd)
|
||||
export BUILDTAGS='seccomp selinux'
|
||||
%gobuild -o %{name} %{import_path}/cmd/%{name}
|
||||
%if 0%{?centos}
|
||||
export BUILDTAGS="exclude_graphdriver_btrfs exclude_graphdriver_devicemapper containers_image_ostree_stub"
|
||||
%endif
|
||||
export GO111MODULE=off
|
||||
%gobuild -o bin/%{name} %{import_path}/cmd/%{name}
|
||||
%gobuild -o bin/imgtype %{import_path}/tests/imgtype
|
||||
GOMD2MAN=go-md2man %{__make} -C docs
|
||||
|
||||
%install
|
||||
|
|
@ -83,6 +120,10 @@ export GOPATH=$(pwd)/_build:$(pwd):%{gopath}
|
|||
make DESTDIR=%{buildroot} PREFIX=%{_prefix} install install.completions
|
||||
make DESTDIR=%{buildroot} PREFIX=%{_prefix} -C docs install
|
||||
|
||||
install -d -p %{buildroot}/%{_datadir}/%{name}/test/system
|
||||
cp -pav tests/. %{buildroot}/%{_datadir}/%{name}/test/system
|
||||
cp bin/imgtype %{buildroot}/%{_bindir}/%{name}-imgtype
|
||||
|
||||
#define license tag if not already defined
|
||||
%{!?_licensedir:%global license %doc}
|
||||
|
||||
|
|
@ -95,7 +136,199 @@ make DESTDIR=%{buildroot} PREFIX=%{_prefix} -C docs install
|
|||
%dir %{_datadir}/bash-completion/completions
|
||||
%{_datadir}/bash-completion/completions/%{name}
|
||||
|
||||
%files tests
|
||||
%license LICENSE
|
||||
%{_bindir}/%{name}-imgtype
|
||||
%{_datadir}/%{name}/test
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Nov 16 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.18.0-1
|
||||
- autobuilt v1.18.0
|
||||
|
||||
* Thu Nov 5 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.17.0-1
|
||||
- autobuilt v1.17.0
|
||||
|
||||
* Thu Oct 22 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.16.5-1
|
||||
- autobuilt v1.16.5
|
||||
|
||||
* Fri Oct 2 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.16.4-1
|
||||
- autobuilt v1.16.4
|
||||
|
||||
* Tue Sep 22 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.16.2-1
|
||||
- autobuilt v1.16.2
|
||||
|
||||
* Fri Sep 11 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.16.1-1
|
||||
- autobuilt v1.16.1
|
||||
|
||||
* Wed Sep 09 2020 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.16.0-2
|
||||
- fix gating tests
|
||||
|
||||
* Wed Sep 9 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.16.0-1
|
||||
- autobuilt v1.16.0
|
||||
|
||||
* Thu Sep 3 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.15.2-1
|
||||
- autobuilt v1.15.2
|
||||
|
||||
* Fri Jul 31 16:10:16 GMT 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.15.1-1
|
||||
- autobuilt v1.15.1
|
||||
|
||||
* Thu Jun 18 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.15.0-1
|
||||
- autobuilt v1.15.0
|
||||
|
||||
* Tue May 26 2020 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.14.9-1
|
||||
- bump to v1.14.9
|
||||
|
||||
* Thu Apr 09 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.8-1
|
||||
- autobuilt v1.14.8
|
||||
|
||||
* Tue Apr 07 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.7-1
|
||||
- autobuilt v1.14.7
|
||||
|
||||
* Fri Apr 03 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.6-1
|
||||
- autobuilt v1.14.6
|
||||
|
||||
* Fri Mar 27 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.5-1
|
||||
- autobuilt v1.14.5
|
||||
|
||||
* Thu Mar 26 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.4-1
|
||||
- autobuilt v1.14.4
|
||||
|
||||
* Wed Mar 18 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.3-1
|
||||
- autobuilt v1.14.3
|
||||
|
||||
* Wed Mar 04 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.2-1
|
||||
- autobuilt v1.14.2
|
||||
|
||||
* Fri Feb 28 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.1-1
|
||||
- autobuilt v1.14.1
|
||||
|
||||
* Sat Feb 15 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-1
|
||||
- autobuilt v1.14.0
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Sat Feb 08 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Fri Feb 07 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Fri Feb 07 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Fri Feb 07 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Fri Feb 07 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Fri Feb 07 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Fri Feb 07 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Fri Feb 07 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Fri Feb 07 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.14.0-2
|
||||
- bump to v1.14.0
|
||||
- autobuilt 5965d9a
|
||||
|
||||
* Thu Feb 06 2020 Eduardo Santiago <santiago@redhat.com> - 1.13.2-3
|
||||
- new -tests subpackage
|
||||
|
||||
* Tue Feb 04 2020 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.13.2-2
|
||||
- bump to v1.13.2
|
||||
- autobuilt b8a8a01
|
||||
|
||||
* Fri Dec 13 2019 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.12.0-2
|
||||
- bump to v1.12.0
|
||||
- autobuilt 6cc4656
|
||||
|
||||
* Fri Dec 06 2019 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.11.6-2
|
||||
- bump to v1.11.6
|
||||
- autobuilt 9513cb8
|
||||
|
||||
* Wed Oct 30 2019 Lokesh Mandvekar <lsm5@redhat.com> - 1.11.4-3
|
||||
- crun only for fedora ATM
|
||||
|
||||
* Mon Oct 28 2019 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.11.4-2
|
||||
- bump to v1.11.4
|
||||
- autobuilt 21b4778
|
||||
|
||||
* Wed Oct 16 2019 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.11.3-3
|
||||
- update libseccomp dep for centos
|
||||
|
||||
* Fri Oct 04 2019 RH Container Bot <rhcontainerbot@fedoraproject.org> - 1.11.3-2
|
||||
- bump to v1.11.3
|
||||
- autobuilt bdd78ad
|
||||
|
||||
* Tue Oct 01 2019 Debarshi Ray <rishi@fedoraproject.org> - 1.11.2-3.git0bafbfe
|
||||
- Switch to crun for Cgroups v2 support
|
||||
|
||||
* Tue Sep 17 2019 Lokesh Mandvekar (Bot) <lsm5+bot@fedoraproject.org> - 1.11.2-2.git0bafbfe
|
||||
- bump to v1.11.2
|
||||
- autobuilt 0bafbfe
|
||||
|
||||
* Thu Sep 12 2019 Lokesh Mandvekar (Bot) <lsm5+bot@fedoraproject.org> - 1.11.1-2.git413bd1f
|
||||
- bump to v1.11.1
|
||||
- autobuilt 413bd1f
|
||||
|
||||
* Thu Sep 05 2019 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.11.0-1.git2c5da1b
|
||||
- built tag v1.11.0
|
||||
|
||||
* Mon Aug 12 2019 Lokesh Mandvekar (Bot) <lsm5+bot@fedoraproject.org> - 1.11.0-0.16.dev.gita99139c
|
||||
- autobuilt a99139c
|
||||
|
||||
|
|
|
|||
7
gating.yaml
Normal file
7
gating.yaml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_context: bodhi_update_push_testing
|
||||
subject_type: koji_build
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (buildah-a99139c.tar.gz) = ab07eb7c0bbc95232005a9c5c7ad16c6f3c29e26483383b98c4fcfdcdb2b79507065b7182324d6285cb16473ace77ba46f4c6b91b7d48b70487e7bdbc0b46b66
|
||||
SHA512 (v1.18.0.tar.gz) = e8d7bebc61ff724d08a26e6a9ccab572ce9a275ca94ffb50fc6bff4eb97b5840e6a196655a2a0f41b4088382949c84f13a923c1a19367a4746911e026f8f4bac
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
---
|
||||
# test buildah
|
||||
- hosts: all
|
||||
become: true
|
||||
tags:
|
||||
- classic
|
||||
roles:
|
||||
- binary
|
||||
- prepare-env
|
||||
- cli
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
# 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 3 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/>.
|
||||
|
||||
# Inspired from: https://github.com/redhat-openstack/khaleesi/blob/master/plugins/callbacks/human_log.py
|
||||
# Further improved support Ansible 2.0
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
try:
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
BASECLASS = CallbackBase
|
||||
except ImportError: # < ansible 2.1
|
||||
BASECLASS = DEFAULT_MODULE.CallbackModule
|
||||
|
||||
import os, sys
|
||||
try:
|
||||
reload # Python 2.7
|
||||
except NameError:
|
||||
try:
|
||||
from importlib import reload # Python 3.4+
|
||||
except ImportError:
|
||||
from imp import reload
|
||||
reload(sys)
|
||||
|
||||
try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
# Fields to reformat output for
|
||||
FIELDS = ['cmd', 'command', 'msg', 'stdout',
|
||||
'stderr', 'failed', 'reason']
|
||||
|
||||
|
||||
class CallbackModule(CallbackBase):
|
||||
|
||||
"""
|
||||
Ansible callback plugin for human-readable result logging
|
||||
"""
|
||||
CALLBACK_VERSION = 2.0
|
||||
CALLBACK_TYPE = 'notification'
|
||||
CALLBACK_NAME = 'human_log'
|
||||
CALLBACK_NEEDS_WHITELIST = False
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
# pylint: disable=non-parent-init-called
|
||||
BASECLASS.__init__(self, *args, **kwargs)
|
||||
if os.getenv("TEST_ARTIFACTS") is not None:
|
||||
self.artifacts = os.getenv("TEST_ARTIFACTS")
|
||||
else:
|
||||
self.artifacts = './artifacts'
|
||||
self.result_file = os.path.join(self.artifacts, 'test.log')
|
||||
if not os.path.exists(self.artifacts):
|
||||
os.makedirs(self.artifacts)
|
||||
with open(self.result_file, 'w'): pass
|
||||
|
||||
def human_log(self, data, taskname, status):
|
||||
if type(data) == dict:
|
||||
with open(self.result_file, 'a') as f:
|
||||
f.write("################################################################\n")
|
||||
f.write('The status is "%s" for task: %s.\n' % (status, taskname))
|
||||
f.write("Ansible outputs: \n\n")
|
||||
for field in FIELDS:
|
||||
no_log = data.get('_ansible_no_log', False)
|
||||
if field in data.keys() and data[field] and no_log != True:
|
||||
output = self._format_output(data[field], field)
|
||||
# The following two lines are a hack to make it work with UTF-8 characters
|
||||
if type(output) != list:
|
||||
output = output.encode('utf-8', 'replace')
|
||||
if type(output) == bytes:
|
||||
output = output.decode('utf-8')
|
||||
|
||||
f.write("{0}: {1}".format(field, output.replace("\\n","\n"))+"\n")
|
||||
|
||||
|
||||
def _format_output(self, output, field):
|
||||
# Strip unicode
|
||||
try:
|
||||
if type(output) == unicode:
|
||||
output = output.encode(sys.getdefaultencoding(), 'replace')
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
# If output is a dict
|
||||
if type(output) == dict:
|
||||
return json.dumps(output, indent=2, sort_keys=True)
|
||||
|
||||
# If output is a list of dicts
|
||||
if type(output) == list and type(output[0]) == dict:
|
||||
# This gets a little complicated because it potentially means
|
||||
# nested results, usually because of with_items.
|
||||
real_output = list()
|
||||
for index, item in enumerate(output):
|
||||
copy = item
|
||||
if type(item) == dict:
|
||||
for field in FIELDS:
|
||||
if field in item.keys():
|
||||
copy[field] = self._format_output(item[field], field)
|
||||
real_output.append(copy)
|
||||
return json.dumps(output, indent=2, sort_keys=True)
|
||||
|
||||
# If output is a list of strings
|
||||
if type(output) == list and type(output[0]) != dict:
|
||||
if field == "cmd":
|
||||
return ' '.join(output)
|
||||
return '\n'.join(output)
|
||||
|
||||
# Otherwise it's a string, (or an int, float, etc.) just return it
|
||||
return str(output)
|
||||
|
||||
####### V2 METHODS ######
|
||||
def v2_on_any(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def v2_runner_on_failed(self, result, ignore_errors=False):
|
||||
self.human_log(result._result, result._task.name, "FAIL")
|
||||
|
||||
def v2_runner_on_ok(self, result):
|
||||
if result._task.name == "":
|
||||
return
|
||||
self.human_log(result._result, result._task.name, "PASS")
|
||||
|
||||
def v2_runner_on_skipped(self, result):
|
||||
pass
|
||||
|
||||
def v2_runner_on_unreachable(self, result):
|
||||
self.human_log(result._result, result._task.name, "UNREACHABLE")
|
||||
|
||||
def v2_runner_on_no_hosts(self, task):
|
||||
pass
|
||||
|
||||
def v2_runner_on_async_poll(self, result):
|
||||
self.human_log(result._result, result._task.name, "")
|
||||
|
||||
def v2_runner_on_async_ok(self, host, result):
|
||||
self.human_log(result._result, result._task.name, "PASS")
|
||||
|
||||
def v2_runner_on_async_failed(self, result):
|
||||
self.human_log(result._result, result._task.name, "FAIL")
|
||||
|
||||
def v2_playbook_on_start(self, playbook):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_notify(self, result, handler):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_no_hosts_matched(self):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_no_hosts_remaining(self):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_task_start(self, task, is_conditional):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_vars_prompt(self, varname, private=True, prompt=None,
|
||||
encrypt=None, confirm=False, salt_size=None,
|
||||
salt=None, default=None):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_setup(self):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_import_for_host(self, result, imported_file):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_not_import_for_host(self, result, missing_file):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_play_start(self, play):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_stats(self, stats):
|
||||
pass
|
||||
|
||||
def v2_on_file_diff(self, result):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_item_ok(self, result):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_item_failed(self, result):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_item_skipped(self, result):
|
||||
pass
|
||||
|
||||
def v2_playbook_on_include(self, included_file):
|
||||
pass
|
||||
|
||||
def v2_playbook_item_on_ok(self, result):
|
||||
pass
|
||||
|
||||
def v2_playbook_item_on_failed(self, result):
|
||||
pass
|
||||
|
||||
def v2_playbook_item_on_skipped(self, result):
|
||||
pass
|
||||
|
|
@ -1 +0,0 @@
|
|||
ansible-playbook -i inventory github.yml "$@"
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
# test buildah
|
||||
- hosts: localhost
|
||||
become: true
|
||||
tags:
|
||||
- classic
|
||||
roles:
|
||||
- role: prepare-env
|
||||
tags:
|
||||
- env
|
||||
- role: github-buildah
|
||||
tags:
|
||||
- github-buildah
|
||||
- role: github-runc
|
||||
tags:
|
||||
- github-runc
|
||||
- role: cli
|
||||
tags:
|
||||
- cli
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
---
|
||||
- name: pull latest buildah source from github
|
||||
git:
|
||||
repo: https://github.com/projectatomic/buildah
|
||||
dest: "{{ HOME }}/go/src/github.com/projectatomic/buildah"
|
||||
|
||||
- name: make binary for buildah
|
||||
command: make
|
||||
args:
|
||||
chdir: "{{ HOME }}/go/src/github.com/projectatomic/buildah"
|
||||
|
||||
- name: install buildah to /usr/local/bin
|
||||
command: make install
|
||||
args:
|
||||
chdir: "{{ HOME }}/go/src/github.com/projectatomic/buildah"
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
- import_tasks: runc.yml
|
||||
|
||||
- import_tasks: buildah.yml
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
- name: pull latest runc source from github
|
||||
git:
|
||||
repo: https://github.com/opencontainers/runc
|
||||
dest: "{{ HOME }}/go/src/github.com/opencontainers/runc"
|
||||
|
||||
- name: building runc for buildah runtime
|
||||
command: make
|
||||
args:
|
||||
chdir: "{{ HOME }}/go/src/github.com/opencontainers/runc"
|
||||
|
||||
- name: copy runc to /usr/bin
|
||||
copy:
|
||||
remote_src: True
|
||||
src: "{{ HOME }}/go/src/github.com/opencontainers/runc/runc"
|
||||
dest: /usr/bin/runc
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
---
|
||||
- name: buildah add
|
||||
command: buildah add nginxc /tmp/buildah/bud/Dockerfile
|
||||
|
||||
- name: check buildah add
|
||||
command: ls {{mount.stdout}}/Dockerfile
|
||||
|
||||
- name: buildah add to destination
|
||||
command: buildah add nginxc /tmp/buildah/bud/Dockerfile /home
|
||||
|
||||
- name: check buildah add to
|
||||
command: ls {{mount.stdout}}/home/Dockerfile
|
||||
|
||||
- name: buildah add URL
|
||||
command: buildah add nginxc https://github.com/projectatomic/buildah/raw/master/README.md
|
||||
|
||||
- name: check buildah add URL
|
||||
command: ls {{mount.stdout}}/README.md
|
||||
|
||||
- name: buildah add URL to destination
|
||||
command: buildah add nginxc https://github.com/projectatomic/buildah/raw/master/README.md /home
|
||||
|
||||
- name: check buildah add URL to destination
|
||||
command: ls {{mount.stdout}}/home/README.md
|
||||
|
||||
- name: create /tmp/buildah/addcopy
|
||||
file: path=/tmp/buildah/addcopy state=directory
|
||||
|
||||
- name: Download buildah README.md
|
||||
get_url:
|
||||
url: https://github.com/projectatomic/buildah/raw/master/README.md
|
||||
dest: /tmp/buildah/addcopy/
|
||||
|
||||
- name: buildah add dir
|
||||
command: buildah add nginxc /tmp/buildah
|
||||
|
||||
- name: check buildah add dir
|
||||
command: ls {{mount.stdout}}/addcopy/README.md
|
||||
|
||||
- name: buildah add dir to destination
|
||||
command: buildah add nginxc /tmp/buildah /home
|
||||
|
||||
- name: check buildah add dir to destination
|
||||
command: ls {{mount.stdout}}/home/addcopy/README.md
|
||||
|
||||
- name: buildah add a tarball file
|
||||
command: buildah add nginxc /var/www/html/bud/Dockerfile.tar.gz /home
|
||||
|
||||
- name: check buildah has added content of tarball to container
|
||||
command: ls {{mount.stdout}}/home/hello
|
||||
|
||||
- name: buildah add with option chown
|
||||
command: buildah add --chown bin:bin nginxc /tmp/buildah/bud /home
|
||||
|
||||
- name: check user after add with option chown
|
||||
raw: buildah run nginxc -- ls -l /home/hello
|
||||
register: ast
|
||||
failed_when: '"bin" not in ast.stdout'
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
---
|
||||
- name: buildah bud with image's format oci
|
||||
command: buildah bud --format=oci --tag testing/fmtoci /tmp/buildah/bud
|
||||
|
||||
- name: buildah bud with image's format docker
|
||||
command: buildah bud -t testing/fmtdocker --format=docker /tmp/buildah/bud
|
||||
|
||||
- name: buildah bud localfile
|
||||
command: buildah bud -t testing/hello --pull /tmp/buildah/bud
|
||||
|
||||
- name: buildah bud -f localfile
|
||||
command: buildah bud -t testing/hello2 -f /tmp/buildah/bud/Dockerfile /tmp/buildah/bud
|
||||
|
||||
- name: buildah bud URL
|
||||
command: buildah bud -t testing/hello3 http://localhost/bud/Dockerfile.tar.gz
|
||||
|
||||
- name: buildah build-using-dockerfile localfile
|
||||
command: buildah build-using-dockerfile -t testing/hello4 /tmp/buildah/bud
|
||||
|
||||
- lineinfile:
|
||||
path: /tmp/buildah/bud/Dockerfile
|
||||
regexp: '^COPY'
|
||||
line: 'COPY $foo /'
|
||||
|
||||
- name: buildah bud with build-arg
|
||||
command: buildah bud -t testing/hello5 --build-arg foo=hello /tmp/buildah/bud
|
||||
|
||||
- name: create container from bud images
|
||||
command: buildah from docker.io/testing/{{ item }}
|
||||
with_items:
|
||||
- hello
|
||||
- hello2
|
||||
- hello3
|
||||
- hello4
|
||||
- hello5
|
||||
|
||||
- name: list containers
|
||||
command: buildah containers
|
||||
register: ctrs
|
||||
|
||||
- name: run containers from bud images
|
||||
command: buildah run {{ item }}-working-container
|
||||
register: hello
|
||||
with_items:
|
||||
- hello
|
||||
- hello2
|
||||
- hello3
|
||||
- hello4
|
||||
- hello5
|
||||
|
||||
- name: verify string hello in container hellos
|
||||
fail:
|
||||
msg: '"Hello from Docker" not found after container run'
|
||||
when: '"Hello from Docker" not in item.stdout'
|
||||
with_items: "{{ hello.results }}"
|
||||
|
||||
- name: buildah rm containers of hello
|
||||
command: buildah rm {{ item }}-working-container
|
||||
with_items:
|
||||
- hello
|
||||
- hello2
|
||||
- hello3
|
||||
- hello4
|
||||
- hello5
|
||||
|
||||
|
||||
- name: buildah bud --quiet
|
||||
command: buildah bud --quiet -t testing/hello6 /tmp/buildah/bud
|
||||
register: budquiet
|
||||
failed_when: '"STEP" in budquiet.stdout'
|
||||
|
||||
- name: buildah bud -q
|
||||
command: buildah bud -q -t testing/hello7 /tmp/buildah/bud
|
||||
register: budq
|
||||
failed_when: '"STEP" in budq.stdout'
|
||||
|
||||
- lineinfile:
|
||||
path: /tmp/buildah/bud/Dockerfile
|
||||
regexp: "^FROM"
|
||||
line: "FROM localhost:5000/buildah/busybox"
|
||||
|
||||
- name: verify bud image from local docker registry without tls-verify is failed
|
||||
command: buildah bud -t testing/hellofail /tmp/buildah/bud
|
||||
register: st
|
||||
failed_when: st.rc != 1
|
||||
|
||||
- name: buildah bud image from local docker registry is successful
|
||||
command: buildah bud --tls-verify=false -t testing/hello8 /tmp/buildah/bud
|
||||
|
||||
- name: buildah rmi hello images
|
||||
command: buildah rmi {{ item }}
|
||||
with_items:
|
||||
- testing/hello
|
||||
- testing/hello2
|
||||
- testing/hello3
|
||||
- testing/hello4
|
||||
- testing/hello5
|
||||
- testing/hello6
|
||||
- testing/hello7
|
||||
- testing/hello8
|
||||
- testing/fmtoci
|
||||
- testing/fmtdocker
|
||||
- localhost:5000/buildah/busybox
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
---
|
||||
- block:
|
||||
- name: remove all buildah containers after testing
|
||||
command: buildah rm -a
|
||||
|
||||
- name: remove all images after testing
|
||||
command: buildah rmi -a
|
||||
|
||||
always:
|
||||
- include_role:
|
||||
name: tear-down
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
---
|
||||
- name: buildah commit an image by name
|
||||
command: buildah commit nginxc-2 commitbyname/nginxbyname
|
||||
|
||||
- name: check commit images by name is existed
|
||||
command: buildah images commitbyname/nginxbyname
|
||||
|
||||
- name: get container ID
|
||||
shell: buildah containers | grep nginxc-2 | awk '{print $1}'
|
||||
register: cid
|
||||
|
||||
- name: buildah commit an image by ID
|
||||
command: buildah commit {{ cid.stdout }} commitbyid/nginxbyid
|
||||
|
||||
- name: check commit images by ID is existed
|
||||
command: buildah images commitbyid/nginxbyid
|
||||
|
||||
- name: buildah from commit image
|
||||
command: buildah from docker.io/commitbyid/nginxbyid
|
||||
|
||||
- name: check container nginxbyid exists by inspect
|
||||
command: buildah inspect nginxbyid-working-container
|
||||
|
||||
- name: buildah commit to docker-distribution
|
||||
command: buildah commit --tls-verify=false nginxbyid-working-container docker://localhost:5000/commit/nginx
|
||||
|
||||
- name: buildah commit quiet
|
||||
command: buildah commit --quiet --tls-verify=false nginxbyid-working-container docker://localhost:5000/commit/nginx
|
||||
register: quietcommit
|
||||
failed_when: '"Getting" in quietcommit.stdout'
|
||||
|
||||
- name: create container from commit images on docker-distribution
|
||||
command: buildah from --tls-verify=false docker://localhost:5000/commit/nginx
|
||||
|
||||
- name: buildah commit with rm container
|
||||
command: buildah commit --rm -q --tls-verify=false nginxbyid-working-container docker://localhost:5000/commit/nginx
|
||||
|
||||
- name: verify the container is removed after commit
|
||||
command: buildah inspect nginxbyid-working-container
|
||||
register: commitrm
|
||||
failed_when: commitrm.rc != 1
|
||||
|
||||
- name: buildah commit format oci
|
||||
command: buildah commit --disable-compression --format=oci nginx-working-container nginxoci
|
||||
|
||||
- name: buildah commit format docker
|
||||
command: buildah commit -D -f docker nginx-working-container nginxdocker
|
||||
|
||||
- name: remove containers from commit images
|
||||
command: buildah rm nginx-working-container
|
||||
|
||||
- name: remove images from commit
|
||||
command: buildah rmi {{ item }}
|
||||
with_items:
|
||||
- localhost:5000/commit/nginx
|
||||
- commitbyid/nginxbyid
|
||||
- commitbyname/nginxbyname
|
||||
- nginxoci
|
||||
- nginxdocker
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
---
|
||||
- name: buildah config annotation
|
||||
command: buildah config --annotation annotation=test-annotation nginxc
|
||||
|
||||
- name: buildah config arch
|
||||
command: buildah config --arch x86_64 nginxc
|
||||
|
||||
- name: buildah config author
|
||||
command: buildah config --author "Guohua Ouyang" nginxc
|
||||
|
||||
- name: buildah config cmd
|
||||
command: buildah config --cmd "nginx -g 'daemon off;'" nginxc
|
||||
|
||||
- name: buildah config createdby
|
||||
command: buildah config --created-by "manualcreated" nginxc
|
||||
|
||||
- name: buildah config label
|
||||
command: buildah config --label label=test-label nginxc
|
||||
|
||||
- name: buildah config port
|
||||
command: buildah config --port 8001 nginxc
|
||||
|
||||
- name: buildah config user
|
||||
command: buildah config --user www-data nginxc
|
||||
|
||||
- name: buildah config workingdir
|
||||
command: buildah config --workingdir /opt nginxc
|
||||
|
||||
- name: buildah config env
|
||||
command: buildah config --env foo=bar nginxc
|
||||
|
||||
- name: buildah config os
|
||||
command: buildah config --os unix nginxc
|
||||
|
||||
- name: verify the container after config
|
||||
shell: buildah inspect nginxc | grep '{{ item }}'
|
||||
with_items:
|
||||
- test-annotation
|
||||
- x86_64
|
||||
- test-label
|
||||
- Ouyang
|
||||
- daemon off
|
||||
- manualcreated
|
||||
- 8001
|
||||
- www-data
|
||||
- opt
|
||||
- foo=bar
|
||||
- unix
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
- name: buildah containers
|
||||
shell: buildah containers | grep nginxc
|
||||
|
||||
- name: buildah containers -q
|
||||
shell: buildah containers -q | grep -v nginxc
|
||||
|
||||
- name: buildah containers -n
|
||||
shell: buildah containers -n | grep -v NAME
|
||||
|
||||
- name: buildah containers --notruncate
|
||||
command: buildah containers -- notruncate
|
||||
|
||||
- name: buildah containers --all
|
||||
command: buildah containers --all
|
||||
|
||||
- name: buildah containers --json
|
||||
command: buildah containers --json
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
---
|
||||
- name: buildah copy
|
||||
command: buildah copy nginxc-2 /tmp/buildah/bud/Dockerfile
|
||||
|
||||
- name: check buildah copy
|
||||
command: ls {{mount.stdout}}/Dockerfile
|
||||
|
||||
- name: buildah copy to destination
|
||||
command: buildah copy nginxc-2 /tmp/buildah/bud/Dockerfile /home
|
||||
|
||||
- name: check buildah copy to
|
||||
command: ls {{mount.stdout}}/home/Dockerfile
|
||||
|
||||
- name: buildah copy URL
|
||||
command: buildah copy nginxc-2 https://github.com/projectatomic/buildah/raw/master/README.md
|
||||
|
||||
- name: check buildah copy URL
|
||||
command: ls {{mount.stdout}}/README.md
|
||||
|
||||
- name: buildah copy URL to destination
|
||||
command: buildah copy nginxc-2 https://github.com/projectatomic/buildah/raw/master/README.md /home
|
||||
|
||||
- name: check buildah copy URL to destination
|
||||
command: ls {{mount.stdout}}/home/README.md
|
||||
|
||||
- name: buildah copy dir
|
||||
command: buildah copy nginxc-2 /tmp/buildah
|
||||
|
||||
- name: check buildah copy dir
|
||||
command: ls {{mount.stdout}}/addcopy/README.md
|
||||
|
||||
- name: buildah copy dir to destination
|
||||
command: buildah copy nginxc-2 /tmp/buildah /home
|
||||
|
||||
- name: check buildah copy dir to destination
|
||||
command: ls {{mount.stdout}}/home/addcopy/README.md
|
||||
|
||||
- name: buildah copy with option chown
|
||||
command: buildah copy --chown nginx:nginx nginxc-2 /tmp/buildah/bud /home
|
||||
|
||||
- name: check user after copy with option chown
|
||||
command: buildah run nginxc-2 -- ls -l /home/hello
|
||||
register: cst
|
||||
failed_when: '"nginx" not in cst.stdout'
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
---
|
||||
- name: remove all containers before pull
|
||||
command: buildah rm --all
|
||||
|
||||
- name: buildah from without pull
|
||||
command: buildah from --name nginxc docker.io/nginx
|
||||
|
||||
- name: buildah from with pull
|
||||
command: buildah from --pull --name nginxc-2 docker.io/nginx
|
||||
|
||||
- name: buildah from with pull always
|
||||
command: buildah from --pull-always docker.io/busybox
|
||||
|
||||
- name: remove busybox-working-container
|
||||
command: buildah rm busybox-working-container
|
||||
|
||||
- name: remove exist image so it will pull again
|
||||
command: buildah rmi busybox
|
||||
|
||||
- name: buildah from with quiet
|
||||
command: buildah from --quiet docker.io/busybox
|
||||
register: quietpull
|
||||
failed_when: '"Getting" in quietpull.stdout'
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
---
|
||||
- name: verify buildah images digests
|
||||
command: buildah images --digests
|
||||
register: digest
|
||||
failed_when: '"sha256" not in digest.stdout'
|
||||
|
||||
- name: verify buildah images output json
|
||||
command: buildah images --json
|
||||
register: json
|
||||
failed_when: '"id" not in json.stdout'
|
||||
|
||||
- name: verify buildah images noheading
|
||||
command: buildah images --noheading
|
||||
register: head
|
||||
failed_when: '"IMAGE" in head.stdout'
|
||||
|
||||
- name: verify buildah images quiet
|
||||
command: buildah images --quiet
|
||||
register: quiet
|
||||
failed_when: '"NAME" in quiet.stdout'
|
||||
|
||||
- name: verify buildah images format output
|
||||
command: buildah images --format "{% raw %}{{.ID}} {{.Name}} {{.CreatedAt}} {{.Size}}{% endraw %}"
|
||||
register: format
|
||||
|
||||
- lineinfile:
|
||||
path: /tmp/buildah/bud/Dockerfile
|
||||
insertafter: '^FROM'
|
||||
line: 'LABEL project=buildah'
|
||||
|
||||
- name: buildah bud with LABEL in Dockerfile
|
||||
command: buildah bud --tls-verify=false -t testing/label /tmp/buildah/bud
|
||||
|
||||
- name: verify buildah images filter by label
|
||||
command: buildah images -f "label=project=buildah"
|
||||
register: label
|
||||
failed_when: '"testing/label" not in label.stdout'
|
||||
|
||||
- name: buildah bud an image to test filter since/before
|
||||
command: buildah bud -t testing/since /tmp/buildah/bud
|
||||
|
||||
- name: verify buildah images filter by since
|
||||
command: buildah images -f "since=label"
|
||||
register: since
|
||||
failed_when: '"testing/label" in since.stdout and "testing/since" in since.stdout'
|
||||
|
||||
- name: verify buildah images filter by before
|
||||
command: buildah images -f "before=since"
|
||||
register: before
|
||||
failed_when: '"testing/label" not in before.stdout and "testing/since" in before.stdout'
|
||||
|
||||
- name: buildah build an image to test filter dangling
|
||||
command: buildah bud -t testing/label /tmp/buildah/bud
|
||||
|
||||
- name: verify buildah images filter by dangling
|
||||
command: buildah images -f "dangling=true" -q
|
||||
register: dangling
|
||||
|
||||
- name: remove testing images after buildah images
|
||||
command: buildah rmi {{ item }}
|
||||
with_items:
|
||||
- testing/label
|
||||
- testing/since
|
||||
- "{{ dangling.stdout }}"
|
||||
- localhost:5000/buildah/busybox
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
- name: buildah inspect an image by name
|
||||
command: buildah inspect docker.io/library/nginx:latest
|
||||
|
||||
- name: get image ID
|
||||
command: buildah images -q docker.io/library/nginx:latest
|
||||
register: imgid
|
||||
|
||||
- name: buildah inspect an image by ID
|
||||
command: buildah inspect --type image {{ imgid.stdout }}
|
||||
|
||||
- name: buildah inspect image with format
|
||||
command: buildah inspect -t image -f {% raw %}'{{ .FromImageID }}'{% endraw %} {{ imgid.stdout }}
|
||||
register: inspectid
|
||||
failed_when: 'inspectid.stdout != imgid.stdout'
|
||||
|
||||
- name: buildah inspect container by name
|
||||
command: buildah inspect -t container nginxc-2
|
||||
|
||||
- name: buildah inspect container with format
|
||||
shell: buildah inspect -f {% raw %}'{{ .ContainerID }}'{% endraw %} nginxc-2
|
||||
register: inspectcid
|
||||
|
||||
- name: buildah inspect container by ID
|
||||
command: buildah inspect {{ inspectcid.stdout }}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
---
|
||||
- block:
|
||||
- name: buildah version
|
||||
import_tasks: version.yaml
|
||||
tags:
|
||||
- version
|
||||
|
||||
- name: buildah from
|
||||
import_tasks: from.yaml
|
||||
tags:
|
||||
- from
|
||||
|
||||
- name: buildah containers
|
||||
import_tasks: containers.yaml
|
||||
tags:
|
||||
- ctr
|
||||
|
||||
- name: buildah mount
|
||||
import_tasks: mount.yaml
|
||||
tags:
|
||||
- mount
|
||||
|
||||
- name: buildah tag
|
||||
import_tasks: tag.yaml
|
||||
tags:
|
||||
- tag
|
||||
|
||||
- name: buildah config
|
||||
import_tasks: config.yaml
|
||||
tags:
|
||||
- config
|
||||
|
||||
- name: buildah commit
|
||||
import_tasks: commit.yaml
|
||||
tags:
|
||||
- commit
|
||||
|
||||
- name: buildah inspect
|
||||
import_tasks: inspect.yaml
|
||||
tags:
|
||||
- inspect
|
||||
|
||||
- name: buildah push
|
||||
import_tasks: push.yaml
|
||||
tags:
|
||||
- push
|
||||
|
||||
- name: buildah build-using-dockerfile
|
||||
import_tasks: bud.yaml
|
||||
tags:
|
||||
- bud
|
||||
|
||||
- name: buildah images
|
||||
import_tasks: images.yaml
|
||||
tags:
|
||||
- images
|
||||
|
||||
- name: buildah run
|
||||
import_tasks: run.yaml
|
||||
tags:
|
||||
- run
|
||||
|
||||
always:
|
||||
- import_tasks: cleanup.yaml
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
---
|
||||
- name: buildah mount container nginxc
|
||||
command: buildah mount nginxc
|
||||
register: mount
|
||||
|
||||
- name: buildah mount without args will list all mounts
|
||||
shell: buildah mount | grep storage
|
||||
|
||||
- name: buildah add
|
||||
import_tasks: add.yaml
|
||||
tags:
|
||||
- add
|
||||
|
||||
- name: buildah umount
|
||||
command: buildah umount nginxc
|
||||
|
||||
- name: buildah mount --notruncate
|
||||
command: buildah mount --notruncate nginxc-2
|
||||
register: mount
|
||||
|
||||
- name: buildah copy
|
||||
import_tasks: copy.yaml
|
||||
tags:
|
||||
- copy
|
||||
|
||||
- name: buildah unmount
|
||||
command: buildah unmount nginxc-2
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
- name: prepare container nginxc for later testing
|
||||
command: buildah from --pull --name nginxc nginx
|
||||
|
||||
- name: prepare container nginxc-2 for later testing
|
||||
command: buildah from --name nginxc-2 nginx
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
---
|
||||
- name: pull busybox before push
|
||||
command: buildah from --pull --name busybox docker.io/busybox
|
||||
|
||||
- name: buildah push image to containers-storage
|
||||
command: buildah push docker.io/busybox:latest containers-storage:docker.io/busybox:latest
|
||||
|
||||
- name: buildah push image to docker daemon
|
||||
command: buildah push docker.io/busybox:latest docker-daemon:docker.io/buildah/busybox:latest
|
||||
|
||||
- name: check buildah/busybox exist in docker daemon
|
||||
command: docker images docker.io/buildah/busybox:latest
|
||||
|
||||
- name: buildah push image to docker local registry
|
||||
command: buildah push --tls-verify=false docker.io/busybox:latest docker://localhost:5000/buildah/busybox:latest
|
||||
|
||||
- name: create /tmp/buildah/busybox
|
||||
file: path=/tmp/buildah/docker state=directory
|
||||
|
||||
- name: rm busybox.tar because docker archive does not support modify
|
||||
file: path=/tmp/buildah/docker/busybox.tar state=absent
|
||||
|
||||
- name: buildah push image to docker-archive
|
||||
command: buildah push docker.io/busybox:latest docker-archive:/tmp/buildah/docker/busybox.tar:latest
|
||||
|
||||
- name: check docker archive exist
|
||||
file: path=/tmp/buildah/docker/busybox.tar state=file
|
||||
|
||||
- name: create /tmp/buildah/dir
|
||||
file: path=/tmp/buildah/dir state=directory
|
||||
|
||||
- name: buildah push image to dir
|
||||
command: buildah push docker.io/busybox:latest dir:/tmp/buildah/dir
|
||||
|
||||
- name: create /tmp/buildah/oci
|
||||
file: path=/tmp/buildah/oci state=directory
|
||||
|
||||
- name: buildah push image to oci
|
||||
command: buildah push docker.io/busybox:latest oci:/tmp/buildah/oci:latest
|
||||
|
||||
- name: buildah push image to oci archive
|
||||
command: buildah push docker.io/busybox:latest oci-archive:/tmp/buildah/oci/busybox.tar:latest
|
||||
|
||||
- name: check oci archive exist
|
||||
file: path=/tmp/buildah/oci/busybox.tar state=file
|
||||
|
||||
- name: init default ostree repo
|
||||
command: ostree --repo=/ostree/repo init
|
||||
when: not ansible_distribution == "CentOS"
|
||||
|
||||
- name: create /tmp/buildah/ostree/repo
|
||||
file: path=/tmp/buildah/ostree/repo state=directory
|
||||
when: not ansible_distribution == "CentOS"
|
||||
|
||||
- name: init tmp ostree repo
|
||||
command: ostree --repo=/tmp/buildah/ostree/repo init
|
||||
when: not ansible_distribution == "CentOS"
|
||||
|
||||
- name: buildah push image to ostree
|
||||
command: buildah push docker.io/busybox:latest ostree:busybox:latest
|
||||
when: not ansible_distribution == "CentOS"
|
||||
|
||||
- name: buildah push image to non-default ostree repo
|
||||
command: buildah push docker.io/busybox:latest ostree:busybox:latest@/tmp/buildah/ostree/repo
|
||||
when: not ansible_distribution == "CentOS"
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
---
|
||||
- name: buildah run with option hostname
|
||||
command: buildah run --hostname example.buildah.com nginxc -- hostname
|
||||
register: hostname
|
||||
failed_when: '"example.buildah.com" not in hostname.stdout'
|
||||
|
||||
- name: buildah run with option volume
|
||||
command: buildah run --volume /tmp/buildah/bud:/home nginxc ls /home
|
||||
register: volume
|
||||
failed_when: '"hello" not in volume.stdout'
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
---
|
||||
- name: buildah tag by name
|
||||
command: buildah tag busybox busybox1
|
||||
|
||||
- name: check busybox1 exists
|
||||
shell: buildah images | grep busybox1
|
||||
|
||||
- name: get image id
|
||||
command: buildah images -q busybox1
|
||||
register: busyboxID
|
||||
|
||||
- name: buildah tag by ID
|
||||
command: buildah tag {{busyboxID.stdout}} busybox2
|
||||
|
||||
- name: check busybox2 exists
|
||||
shell: buildah images | grep busybox2
|
||||
|
||||
- name: buildah from tagged image
|
||||
command: buildah from docker.io/busybox1
|
||||
|
||||
- name: mount the container which using tagged image
|
||||
command: buildah mount busybox1-working-container
|
||||
|
||||
- name: buildah umount the container
|
||||
command: buildah umount busybox1-working-container
|
||||
|
||||
- name: buildah rm container busybox
|
||||
command: buildah rm busybox-working-container
|
||||
|
||||
- name: buildah rm container busybox1
|
||||
command: buildah rm busybox1-working-container
|
||||
|
||||
- name: buildah rmi tagged image
|
||||
shell: buildah rmi busybox{1..2}
|
||||
|
||||
- name: check image busybox is not deleted
|
||||
shell: buildah images | grep busybox
|
||||
|
||||
- name: buildah rmi image busybox
|
||||
command: buildah rmi busybox
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
- name: check version of buildah rpm package
|
||||
command: rpm -q buildah
|
||||
register: rpmver
|
||||
args:
|
||||
warn: no
|
||||
|
||||
- debug: msg={{ rpmver.stdout }}
|
||||
|
||||
- name: check version of command buildah version
|
||||
command: buildah version
|
||||
register: ver
|
||||
|
||||
- debug: msg={{ ver.stdout }}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
- name: pull latest buildah source from github
|
||||
git:
|
||||
repo: https://github.com/projectatomic/buildah
|
||||
dest: "{{ ansible_env.HOME }}/go/src/github.com/projectatomic/buildah"
|
||||
|
||||
- name: make binary for buildah
|
||||
command: make
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/go/src/github.com/projectatomic/buildah"
|
||||
|
||||
- name: install buildah to /usr/local/bin
|
||||
command: make install
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/go/src/github.com/projectatomic/buildah"
|
||||
|
||||
- name: copy buildah to /usr/bin
|
||||
copy:
|
||||
remote_src: True
|
||||
src: "{{ ansible_env.HOME }}/go/src/github.com/projectatomic/buildah/buildah"
|
||||
dest: /usr/bin/buildah
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
- name: pull latest runc source from github
|
||||
git:
|
||||
repo: https://github.com/opencontainers/runc
|
||||
dest: "{{ ansible_env.HOME }}/go/src/github.com/opencontainers/runc"
|
||||
|
||||
- name: building runc for buildah runtime
|
||||
command: make
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/go/src/github.com/opencontainers/runc"
|
||||
|
||||
- name: copy runc to /usr/bin
|
||||
copy:
|
||||
remote_src: True
|
||||
src: "{{ ansible_env.HOME }}/go/src/github.com/opencontainers/runc/runc"
|
||||
dest: /usr/bin/runc
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
- name: pull latest buildah source from github
|
||||
git:
|
||||
repo: https://github.com/projectatomic/buildah
|
||||
dest: "{{ ansible_env.HOME }}/go/src/github.com/projectatomic/buildah"
|
||||
|
||||
- name: make binary for buildah
|
||||
command: make
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/go/src/github.com/projectatomic/buildah"
|
||||
|
||||
- name: install buildah to /usr/local/bin
|
||||
command: make install
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/go/src/github.com/projectatomic/buildah"
|
||||
|
||||
- name: copy buildah to /usr/bin
|
||||
copy:
|
||||
remote_src: True
|
||||
src: "{{ ansible_env.HOME }}/go/src/github.com/projectatomic/buildah/buildah"
|
||||
dest: /usr/bin/buildah
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
- import_tasks: runc.yml
|
||||
tags:
|
||||
- runc
|
||||
|
||||
- import_tasks: buildah.yml
|
||||
tags:
|
||||
- buildah
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
- name: pull latest runc source from github
|
||||
git:
|
||||
repo: https://github.com/opencontainers/runc
|
||||
dest: "{{ ansible_env.HOME }}/go/src/github.com/opencontainers/runc"
|
||||
|
||||
- name: building runc for buildah runtime
|
||||
command: make
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/go/src/github.com/opencontainers/runc"
|
||||
|
||||
- name: copy runc to /usr/bin
|
||||
copy:
|
||||
remote_src: True
|
||||
src: "{{ ansible_env.HOME }}/go/src/github.com/opencontainers/runc/runc"
|
||||
dest: /usr/bin/runc
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
---
|
||||
- name: install required packages for testings
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
with_items:
|
||||
- docker
|
||||
- python-docker-py
|
||||
- buildah
|
||||
- docker-distribution
|
||||
- ostree
|
||||
- httpd
|
||||
- libselinux-python
|
||||
- golang
|
||||
- make
|
||||
- libseccomp-devel
|
||||
|
||||
- name: start docker daemon
|
||||
systemd: state=started name=docker
|
||||
|
||||
- name: create /ostree/repo
|
||||
file: path=/ostree/repo state=directory
|
||||
|
||||
- name: ensure docker-distribution service is running
|
||||
systemd: state=started name=docker-distribution
|
||||
|
||||
- name: create tmp directory for buildah testing
|
||||
file: path=/tmp/buildah/bud state=directory
|
||||
|
||||
- name: download Dockerfile for hello-world from github
|
||||
get_url:
|
||||
url: https://raw.githubusercontent.com/docker-library/hello-world/master/amd64/hello-world/Dockerfile
|
||||
dest: /tmp/buildah/bud/Dockerfile
|
||||
force: yes
|
||||
|
||||
- name: download hello for the Dockerfile
|
||||
get_url:
|
||||
url: https://github.com/docker-library/hello-world/raw/master/amd64/hello-world/hello
|
||||
dest: /tmp/buildah/bud/hello
|
||||
force: yes
|
||||
mode: 0755
|
||||
|
||||
- name: create a bud directory in /var/www/html
|
||||
file: path=/var/www/html/bud state=directory
|
||||
|
||||
- name: archive dockerfile into httpd directory
|
||||
command: tar zcvf /var/www/html/bud/Dockerfile.tar.gz Dockerfile hello
|
||||
args:
|
||||
chdir: /tmp/buildah/bud
|
||||
# Disables the following warning:
|
||||
# Consider using unarchive module rather than running tar
|
||||
warn: no
|
||||
|
||||
- name: start httpd service
|
||||
systemd: state=started name=httpd
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
- name: stop docker-distribution service
|
||||
systemd: state=stopped name=docker-distribution
|
||||
|
||||
- name: stop httpd service
|
||||
systemd: state=stopped name=httpd
|
||||
|
||||
- name: remove /tmp/buildah
|
||||
file: path=/tmp/buildah state=absent
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
# test buildah
|
||||
- hosts: all
|
||||
become: true
|
||||
tags:
|
||||
- classic
|
||||
roles:
|
||||
- prepare-env
|
||||
- cli
|
||||
|
|
@ -1 +0,0 @@
|
|||
ansible-playbook -i inventory tests.yml "$@"
|
||||
|
|
@ -1 +0,0 @@
|
|||
ansible-playbook -i inventory binary.yml "$@"
|
||||
64
tests/test_buildah.sh
Executable file
64
tests/test_buildah.sh
Executable file
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# Log program and kernel versions
|
||||
echo "Important package versions:"
|
||||
(
|
||||
uname -r
|
||||
rpm -qa | egrep 'buildah|podman|conmon|crun|runc|iptable|slirp|systemd' | sort
|
||||
) | sed -e 's/^/ /'
|
||||
|
||||
# Log environment; or at least the useful bits
|
||||
echo "Environment:"
|
||||
env | grep -v LS_COLORS= | sort | sed -e 's/^/ /'
|
||||
|
||||
export BUILDAH_BINARY=/usr/bin/buildah
|
||||
export IMGTYPE_BINARY=/usr/bin/buildah-imgtype
|
||||
|
||||
###############################################################################
|
||||
# BEGIN setup/teardown
|
||||
|
||||
# Start a registry
|
||||
pre_bats_setup() {
|
||||
AUTHDIR=/tmp/buildah-tests-auth.$$
|
||||
mkdir -p $AUTHDIR
|
||||
|
||||
CERT=$AUTHDIR/domain.crt
|
||||
if [ ! -e $CERT ]; then
|
||||
openssl req -newkey rsa:4096 -nodes -sha256 \
|
||||
-keyout $AUTHDIR/domain.key -x509 -days 2 \
|
||||
-out $AUTHDIR/domain.crt \
|
||||
-subj "/C=US/ST=Foo/L=Bar/O=Red Hat, Inc./CN=registry host certificate" \
|
||||
-addext subjectAltName=DNS:localhost
|
||||
fi
|
||||
|
||||
if [ ! -e $AUTHDIR/htpasswd ]; then
|
||||
podman run --rm --entrypoint htpasswd registry:2 \
|
||||
-Bbn testuser testpassword > $AUTHDIR/htpasswd
|
||||
fi
|
||||
|
||||
podman rm -f registry || true
|
||||
podman run -d -p 5000:5000 \
|
||||
--name registry \
|
||||
-v $AUTHDIR:/auth:Z \
|
||||
-e "REGISTRY_AUTH=htpasswd" \
|
||||
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
|
||||
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
|
||||
-e REGISTRY_HTTP_TLS_CERTIFICATE=/auth/domain.crt \
|
||||
-e REGISTRY_HTTP_TLS_KEY=/auth/domain.key \
|
||||
registry:2
|
||||
}
|
||||
|
||||
post_bats_teardown() {
|
||||
podman rm -f registry
|
||||
}
|
||||
|
||||
# END setup/teardown
|
||||
###############################################################################
|
||||
# BEGIN actual test
|
||||
|
||||
pre_bats_setup
|
||||
bats /usr/share/buildah/test/system
|
||||
rc=$?
|
||||
post_bats_teardown
|
||||
|
||||
exit $rc
|
||||
17
tests/test_buildah.yml
Normal file
17
tests/test_buildah.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
environment:
|
||||
TMPDIR: /var/tmp
|
||||
roles:
|
||||
- role: standard-test-basic
|
||||
tags:
|
||||
- classic
|
||||
- container
|
||||
required_packages:
|
||||
- buildah
|
||||
- buildah-tests
|
||||
tests:
|
||||
- root-test:
|
||||
dir: ./
|
||||
run: ./test_buildah.sh
|
||||
timeout: 60m
|
||||
|
|
@ -1 +0,0 @@
|
|||
ansible-playbook -i inventory buildah_rpm.yml "$@"
|
||||
|
|
@ -1,16 +1 @@
|
|||
---
|
||||
# test buildah
|
||||
- hosts: localhost
|
||||
become: true
|
||||
tags:
|
||||
- classic
|
||||
roles:
|
||||
- role: prepare-env
|
||||
tags:
|
||||
- env
|
||||
- role: github-runc
|
||||
tags:
|
||||
- github-runc
|
||||
- role: cli
|
||||
tags:
|
||||
- cli
|
||||
- import_playbook: test_buildah.yml
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue