QA & test update
This commit is contained in:
parent
c817784eab
commit
4f405a8709
@ -51,7 +51,10 @@ async def build(service=None, **kwargs):
|
||||
loop=loop,
|
||||
)
|
||||
|
||||
prefix = '' if os.getenv('BUILDAH_ISOLATION') == 'chroot' else 'buildah unshare '
|
||||
if os.getenv('BUILDAH_ISOLATION') == 'chroot':
|
||||
prefix = ''
|
||||
else:
|
||||
prefix = 'buildah unshare '
|
||||
transport, protocol = await loop.subprocess_shell(
|
||||
protocol_factory,
|
||||
prefix + f'bash -eux {script}',
|
||||
|
||||
@ -10,7 +10,7 @@ class Packages:
|
||||
),
|
||||
dnf=dict(
|
||||
update='sudo dnf update',
|
||||
upgrade='sudo dnf upgrade --exclude container-selinux --best --assumeyes',
|
||||
upgrade='sudo dnf upgrade --exclude container-selinux --best --assumeyes', # noqa
|
||||
install='sudo dnf install --exclude container-selinux --setopt=install_weak_deps=False --best --assumeyes', # noqa
|
||||
),
|
||||
yum=dict(
|
||||
@ -22,7 +22,7 @@ class Packages:
|
||||
|
||||
def __init__(self, *packages, **kwargs):
|
||||
self.packages = list(packages)
|
||||
self.mgr = kwargs.pop('mgr')
|
||||
self.mgr = kwargs.pop('mgr') if 'mgr' in kwargs else None
|
||||
|
||||
def pre_build(self, script):
|
||||
base = script.container.variable('base')
|
||||
|
||||
@ -13,3 +13,5 @@ umounts() {
|
||||
trap umounts 0
|
||||
ctr=$(buildah from $base)
|
||||
mnt=$(buildah mount $ctr)
|
||||
echo "Copy.init_build"
|
||||
echo "Copy.build"
|
||||
@ -13,9 +13,12 @@ umounts() {
|
||||
trap umounts 0
|
||||
ctr=$(buildah from $base)
|
||||
mnt=$(buildah mount $ctr)
|
||||
echo "Packages.pre_build"
|
||||
echo "Packages.build"
|
||||
buildah run --user root $ctr -- mkdir -p /var/cache/apk
|
||||
mkdir -p $(pwd)/.cache/apk
|
||||
mount -o bind $(pwd)/.cache/apk $mnt/var/cache/apk
|
||||
mounts=("$mnt/var/cache/apk" "${mounts[@]}")
|
||||
buildah run $ctr -- ln -s /var/cache/apk /etc/apk/cache
|
||||
old="$(find .cache/apk/ -name APKINDEX.* -mtime +3)"
|
||||
if [ -n "$old" ] || ! ls .cache/apk/APKINDEX.*; then
|
||||
|
||||
@ -13,9 +13,15 @@ umounts() {
|
||||
trap umounts 0
|
||||
ctr=$(buildah from $base)
|
||||
mnt=$(buildah mount $ctr)
|
||||
echo "User.init_build"
|
||||
echo "User.init_build"
|
||||
echo "Packages.pre_build"
|
||||
echo "User.pre_build"
|
||||
echo "Packages.build"
|
||||
buildah run --user root $ctr -- mkdir -p /var/cache/apk
|
||||
mkdir -p $(pwd)/.cache/apk
|
||||
mount -o bind $(pwd)/.cache/apk $mnt/var/cache/apk
|
||||
mounts=("$mnt/var/cache/apk" "${mounts[@]}")
|
||||
buildah run $ctr -- ln -s /var/cache/apk /etc/apk/cache
|
||||
old="$(find .cache/apk/ -name APKINDEX.* -mtime +3)"
|
||||
if [ -n "$old" ] || ! ls .cache/apk/APKINDEX.*; then
|
||||
@ -25,10 +31,12 @@ else
|
||||
fi
|
||||
buildah run --user root $ctr -- apk upgrade
|
||||
buildah run --user root $ctr -- apk add shadow
|
||||
echo "User.build"
|
||||
if buildah run $ctr -- id 1000; then
|
||||
i=$(buildah run $ctr -- id -n 1000)
|
||||
buildah run $ctr -- usermod --home-dir /app --no-log-init 1000 $i
|
||||
else
|
||||
buildah run $ctr -- useradd --home-dir /app --uid 1000 app
|
||||
fi
|
||||
echo "User.post_build"
|
||||
buildah config --user app $ctr
|
||||
Loading…
x
Reference in New Issue
Block a user