Skip to content
Snippets Groups Projects
Commit ee04b456 authored by garciadeblas's avatar garciadeblas
Browse files

Changes in container funcs to allow options when creating containers, in...

Changes in container funcs to allow options when creating containers, in templates to allow nested containers. Changes in RO scripts to install packages and dependencies before building

Change-Id: Ie3a631387268f5a94dec3414ff103700ae743f4b
Signed-off-by: default avatargarciadeblas <gerardo.garciadeblas@telefonica.com>
parent 0fae68d0
No related branches found
No related tags found
No related merge requests found
#
# Copyright 2016 Telefónica Investigación y Desarrollo, S.A.U.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......@@ -11,9 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Authors:
# - Gerardo Garcia - gerardo.garciadeblas@telefonica.com
#
# this variable holds the name of the container image needed to build or run this product
export OSM_BASE_IMAGE=ubuntu:14.04
export OSM_BASE_IMAGE=ubuntu:16.04
#
# this variable holds the name of the container to be used to build a package
# if this container already exists, the build process can skip the container build
......
#!/bin/bash
#
# Copyright 2016 Telefónica Investigación y Desarrollo, S.A.U.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......@@ -12,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Authors:
# - Gerardo Garcia - gerardo.garciadeblas@telefonica.com
#
HERE=$(realpath $(dirname $0))
......@@ -47,10 +51,14 @@ fi
INFO "starting build"
INFO " cleaning .pyc"
rm *.pyc
INFO " installing openmano packages and dependencies from current repo (--noclone)"
./scripts/install_openmano.sh --noclone -q
INFO " compiling *.py"
python -m py_compile *.py
RC=$?
git checkout master #Cleaning the environment. It's also done at the beginning, but it's done just in case.
#git checkout master #Cleaning the environment. It's also done at the beginning, but it's done just in case.
INFO "done, RC=$RC"
exit $RC
......
# This file is meant to be SOURCED
#
# Copyright 2016 RIFT.IO Inc
# Copyright 2016 Telefónica Investigación y Desarrollo S.A.U.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -16,6 +17,7 @@
#
# container_funcs
# 24 June 2016 -- Jeremy Mordkoff -- Genesis
# -- Gerardo García
container_exists() {
if [ $# -ne 1 ]; then
......@@ -32,21 +34,15 @@ container_exists() {
}
create_container() {
if [ $# -ne 2 ]; then
FATAL "args are image container"
if [ $# -lt 2 ]; then
FATAL "args are image container [options]"
fi
INFO "creating container $2 using image $1"
DEBUG "lxc launch $1 $2"
lxc launch "$1" "$2"
}
create_privileged_container() {
if [ $# -ne 2 ]; then
FATAL "args are image container"
fi
INFO "creating container $2 using image $1"
DEBUG "lxc launch $1 $2"
lxc launch "$1" "$2" -c security.privileged=true
image=$1
container=$2
shift 2
DEBUG "lxc launch $image $container $*"
lxc launch "$image" "$container" "$*"
}
container_exec() {
......
#!/bin/bash
# Copyright 2016 RIFT.IO Inc
# Copyright 2016 Telefónica Investigación y Desarrollo S.A.U.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -16,6 +17,7 @@
# start-build is run on a host to start a MDG build
#
# 24 June 2016 -- Jeremy Mordkoff -- Genesis
# -- Gerardo Garcia
HERE=$(realpath $(dirname $0))
......@@ -29,11 +31,10 @@ shift
OSM_load_config
if ! container_exists $OSM_BUILD_CONTAINER; then
if [[ "$OSM_BUILD_CONTAINER_PRIVILEGED" == yes ]]; then
create_privileged_container $OSM_BASE_IMAGE $OSM_BUILD_CONTAINER
else
create_container $OSM_BASE_IMAGE $OSM_BUILD_CONTAINER
fi
CONTAINER_OPTS=""
[[ "$OSM_BUILD_CONTAINER_PRIVILEGED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.privileged=true"
[[ "$OSM_BUILD_CONTAINER_ALLOW_NESTED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.nesting=true"
create_container $OSM_BASE_IMAGE $OSM_BUILD_CONTAINER $CONTAINER_OPTS
wait_container_up $OSM_BUILD_CONTAINER
RE="fedora|fc[0-9]"
if [[ $OSM_BASE_IMAGE =~ $RE ]]; then
......
# Copyright 2016 RIFT.IO Inc
# Copyright 2016 Telefónica Investigación y Desarrollo, S.A.U.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -14,7 +15,9 @@
#
# sample SETTINGS file
#
# 24 June 2016 -- Jeremy Mordkoff -- Genesis
# Authors:
# 24 June 2016 -- Jeremy Mordkoff -- Genesis
# -- Gerardo Garcia
#
# this variable holds the name of the container image needed to build or run this product
export OSM_BASE_IMAGE=ubuntu:16.04
......@@ -27,6 +30,9 @@ export OSM_BUILD_CONTAINER=container_name-build
# this variable should be removed in the future when no privileged mode is required
#export OSM_BUILD_CONTAINER_PRIVILEGED=yes
#
# this variable must be set to allow ensted containers in the build container
#export OSM_BUILD_CONTAINER_ALLOW_NESTED=yes
#
# this variable holds the name of the container to be used to run a package
# if this container already exists, the run processes can skip the container build
export OSM_RUNTIME_CONTAINER=container_name-runtime
......@@ -34,4 +40,7 @@ export OSM_RUNTIME_CONTAINER=container_name-runtime
# this variable must be set to allow creating the runtime container in privileged mode
# this variable should be removed in the future when no privileged mode is required
#export OSM_RUNTIME_CONTAINER_PRIVILEGED=yes
#
# this variable must be set to allow ensted containers in the build container
#export OSM_RUNTIME_CONTAINER_ALLOW_NESTED=yes
#
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment