Skip to content

Commit b8785f3

Browse files
committed
oscontainer-deprecated-legacy-format: use runvm not nested containers
1 parent d9d6655 commit b8785f3

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

src/build-legacy-oscontainer.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC1091
3+
set -euo pipefail
4+
# Start VM and call buildah
5+
. /usr/lib/coreos-assembler/cmdlib.sh; prepare_build && . /usr/lib/coreos-assembler/cmdlib.sh && runvm -- /usr/lib/coreos-assembler/oscontainer-deprecated-legacy-format.py "$@"

src/cmd-upload-oscontainer-deprecated-legacy-format

+21-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# command.
77

88
import argparse
9+
import base64
910
import json
1011
import yaml
1112
import os
@@ -102,18 +103,29 @@ if args.arch_tag:
102103
# TODO: Remove --from
103104
digestfile = "tmp/oscontainer-digest"
104105
# We need to pass the auth file from the unpriv user to the root process
105-
cosa_argv = ['sudo', '--preserve-env=container,DISABLE_TLS_VERIFICATION,SSL_CERT_DIR,SSL_CERT_FILE,REGISTRY_AUTH_FILE,OSCONTAINER_CERT_DIR']
106-
authfile = os.environ.get("REGISTRY_AUTH_FILE", os.path.expanduser('~/.docker/config.json'))
107-
if not os.path.isfile(authfile):
108-
raise SystemExit(f"Missing {authfile}")
109-
os.environ['REGISTRY_AUTH_FILE'] = authfile
110-
cosa_argv.extend(['/usr/lib/coreos-assembler/oscontainer.py', '--workdir=./tmp', 'build', f"--from={args.from_image}"])
106+
#push_argv = ['sudo', '--preserve-env=container,DISABLE_TLS_VERIFICATION,SSL_CERT_DIR,SSL_CERT_FILE,REGISTRY_AUTH_FILE,OSCONTAINER_CERT_DIR']
107+
#authfile = os.environ.get("REGISTRY_AUTH_FILE", os.path.expanduser('~/.docker/config.json'))
108+
#if not os.path.isfile(authfile):
109+
# raise SystemExit(f"Missing {authfile}")
110+
#os.environ['REGISTRY_AUTH_FILE'] = authfile
111+
print("Entering vm to build oscontainer for build: {}".format(latest_build))
112+
arguments = ''
111113
for d in args.add_directory:
112-
cosa_argv.append(f"--add-directory={d}")
113-
cosa_argv.append(f"--display-name={display_name}")
114+
arguments = arguments + (f' --add-directory="{d}"')
115+
arguments = arguments + (f' --display-name="{display_name}"')
114116
if 'labeled-packages' in configyaml:
115117
pkgs = ' '.join(configyaml['labeled-packages'])
116-
cosa_argv.append(f"--labeled-packages={pkgs}")
118+
arguments = arguments + (f' --labeled-packages="{pkgs}"')
119+
if args.format is not None:
120+
arguments = arguments + (f' --format="{args.format}"')
121+
122+
cosa_argv = (['/usr/lib/coreos-assembler/build-legacy-oscontainer.sh', '--workdir=./tmp', 'build', '--from={args.from_image}'])
123+
for d in args.add_directory:
124+
cosa_argv.append(f'--add-directory="{d}"')
125+
cosa_argv.append(f'--display-name="{display_name}"')
126+
if 'labeled-packages' in configyaml:
127+
pkgs = ' '.join(configyaml['labeled-packages'])
128+
cosa_argv.append(f'--labeled-packages="{pkgs}"')
117129
if args.format is not None:
118130
cosa_argv.append(f'--format={args.format}')
119131
subprocess.check_call(cosa_argv +

src/vmdeps.txt

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ selinux-policy selinux-policy-targeted policycoreutils
2020
# coreos-assembler
2121
python3 python3-gobject-base buildah podman skopeo iptables iptables-libs
2222

23+
# legacy-oscontainer
24+
python3-pyyaml python3-botocore python3-flufl-lock python3-tenacity
25+
2326
# luks
2427
cryptsetup
2528
# filesystems/storage

0 commit comments

Comments
 (0)