Merge branch 'master' into f26

This commit is contained in:
Bruno Goncalves 2017-05-31 11:26:34 +02:00
commit 519dc2c072
6 changed files with 79 additions and 16 deletions

View file

@ -75,3 +75,28 @@ def get_docker_image_name(self):
self.log.info("base runtime image name: %s" % image_name)
return image_name
def get_docker_labels(self):
"""
From config file get the labels that should be added to the image
"""
config = module_framework.get_correct_config()
if not config:
self.error("Could not get config file")
if 'module' not in config.keys():
self.error("Config file does not have module section")
if 'docker' not in config['module'].keys():
self.error("Config file does not have docker module section")
docker_cfg = config['module']['docker']
if 'labels' not in docker_cfg.keys():
return None
return docker_cfg['labels']
def get_test_profile(self):
"""
From config file get the labels that should be added to the image
"""
return "container"

View file

@ -11,10 +11,19 @@ packages:
default_module: docker
module:
docker:
setup: docker inspect base-runtime-smoke || python ./setup.py
start:
labels:
description: "I dont know"
io.k8s.description: "I dont know too"
#Short-term solution as there is no bugzilla component yet
com.redhat.component: "https://github.com/fedora-modularity/base-runtime"
name: "base-runtime"
version: "0"
release: "1"
architecture: "x86_64"
usage: "docker run --rm -it base-runtime/base-runtime bash"
summary: "Minimal application runtime environment other modules can build upon."
url: "https://github.com/fedora-modularity/base-runtime"
FGC: "f26-boltron"
source: http://pkgs.fedoraproject.org/cgit/modules/base-runtime.git
container: docker=base-runtime-smoke
rpm:
@ -22,7 +31,7 @@ module:
stop:
status:
repos:
- https://kojipkgs.stg.fedoraproject.org/compose/branched/jkaluza/latest-Boltron-26/compose/base-runtime/x86_64/os/
- https://kojipkgs.fedoraproject.org/compose/latest-Fedora-Modular-26/compose/Server/x86_64/os/
test:
processrunnig:
- 'ls / | grep bin'

View file

@ -2,11 +2,12 @@
config_opts['root'] = 'base-runtime-docker'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = 'install --setopt=tsflags=nodocs bash coreutils-single filesystem glibc-minimal-langpack libcrypt microdnf rpm shadow-utils util-linux'
config_opts['chroot_setup_cmd'] = 'install --setopt=tsflags=nodocs bash coreutils-single filesystem glibc-minimal-langpack libcrypt microdnf rpm shadow-utils sssd-client util-linux'
config_opts['dist'] = ''
config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
config_opts['releasever'] = ''
config_opts['package_manager'] = 'dnf'
config_opts['use_bootstrap_container'] = False
config_opts['yum.conf'] = """
[main]
@ -28,7 +29,8 @@ mdpolicy=group:primary
[buildrepo]
name=base-runtime
baseurl=https://kojipkgs.stg.fedoraproject.org/compose/branched/jkaluza/latest-Boltron-26/compose/base-runtime/x86_64/os/
baseurl=https://kojipkgs.fedoraproject.org/compose/latest-Fedora-Modular-26/compose/Server/x86_64/os/
enabled=1
gpgcheck=0
"""

View file

@ -62,6 +62,8 @@ libsigsegv
libsmartcols
libsolv
libssh2
libsss_idmap
libsss_nss_idmap
libtasn1
libunistring
libutempter
@ -103,6 +105,7 @@ sed
setup
shadow-utils
sqlite-libs
sssd-client
systemd-libs
tzdata
ustr

View file

@ -15,7 +15,7 @@ import cleanup
import brtconfig
class BaseRuntimeSetupDocker(module_framework.CommonFunctions, Test):
class BaseRuntimeSetupDocker(Test, module_framework.CommonFunctions):
def setUp(self):
@ -24,6 +24,7 @@ class BaseRuntimeSetupDocker(module_framework.CommonFunctions, Test):
def _process_mockcfg(self):
profile_name = brtconfig.get_test_profile(self)
mockcfg = self.mockcfg
mock_root = ''
@ -64,12 +65,12 @@ class BaseRuntimeSetupDocker(module_framework.CommonFunctions, Test):
if "profiles" not in mod_yaml["data"].keys():
self.error("'profiles' key was not found in 'data' section")
if "container" not in mod_yaml["data"]["profiles"].keys():
self.error("'container' key was not found in 'profiles' section")
if profile_name not in mod_yaml["data"]["profiles"].keys():
self.error("'%s' key was not found in 'profiles' section" % profile_name)
base_profile = mod_yaml["data"]["profiles"]["container"]
base_profile = mod_yaml["data"]["profiles"][profile_name]
if "rpms" not in base_profile.keys():
self.error("'rpms' key was not found in 'container' profile")
self.error("'rpms' key was not found in '%s' profile" % profile_name)
req_pkgs = base_profile["rpms"]
if not req_pkgs:
@ -187,9 +188,27 @@ class BaseRuntimeSetupDocker(module_framework.CommonFunctions, Test):
# "sudo" works, so use it
tar_cmd = "sudo -n " + tar_cmd
img_scratch = "%s-scratch" % self.br_image_name
# Import mock chroot as a docker image
self._run_command("%s | docker import - %s" %
(tar_cmd, self.br_image_name))
(tar_cmd, img_scratch))
docker_labels = brtconfig.get_docker_labels(self)
#Dockerfile to use when building final image
dockerfile = 'EOF\n'
dockerfile += 'FROM %s\n' % img_scratch
#Set default locale to C.utf8
dockerfile += 'ENV LANG C.utf8\n'
if docker_labels:
for key in docker_labels.keys():
dockerfile += 'LABEL %s="%s"\n' % (key, docker_labels[key])
dockerfile += 'EOF\n'
# Build final image with extra information from dockerfile
self._run_command("docker build -t %s - << %s" %
(self.br_image_name, dockerfile))
#Remove temporary image
self._run_command("docker rmi %s" % img_scratch)
if __name__ == "__main__":
main()

View file

@ -68,7 +68,9 @@ class BaseRuntimeSmokeTest(module_framework.AvocadoTest):
def _get_all_installed_pkgs(self):
try:
cmd_result = self.run("rpm -qa --qf='%{name}\n'")
cmd_result = self.run("rpm -qa --qf='%{{name}}\n'")
except BaseException as details:
self.error("Could not get all installed packages (%s)" % details)
except:
self.error("Could not get all installed packages")
output_list = cmd_result.stdout.split("\n")
@ -80,6 +82,7 @@ class BaseRuntimeSmokeTest(module_framework.AvocadoTest):
Check if all required packages defined on yaml file are installed
"""
profile_name = brtconfig.get_test_profile(self)
mod_yaml = self.getModulemdYamlconfig()
if not mod_yaml:
self.error("Could not read modulemd Yaml file")
@ -90,12 +93,12 @@ class BaseRuntimeSmokeTest(module_framework.AvocadoTest):
if "profiles" not in mod_yaml["data"].keys():
self.error("'profiles' key was not found in 'data' section")
if "container" not in mod_yaml["data"]["profiles"].keys():
self.error("'container' key was not found in 'profiles' section")
if profile_name not in mod_yaml["data"]["profiles"].keys():
self.error("'%s' key was not found in 'profiles' section" % profile_name)
base_profile = mod_yaml["data"]["profiles"]["container"]
base_profile = mod_yaml["data"]["profiles"][profile_name]
if "rpms" not in base_profile.keys():
self.error("'rpms' key was not found in 'container' profile")
self.error("'rpms' key was not found in '%s' profile" % profile_name)
req_pkgs = base_profile["rpms"]
if not req_pkgs:
@ -241,6 +244,8 @@ class BaseRuntimeSmokeTest(module_framework.AvocadoTest):
"cmds" : lang_spanish
}
#Check if C.utf8 is the default locale
self.run("echo $LANG | grep 'C.utf8'")
for i18n in langs.keys():
lang = langs[i18n]