From a580cbeb402a0bb3cdcfffb41f889817b10be7c3 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Thu, 7 Feb 2019 19:50:33 +0100 Subject: [PATCH] [docker] Add MaaS container build support Change-Id: I7709c9ca9e701b656447154919eb084a710f49af Signed-off-by: Alexandru Avadanii --- ci/build.sh | 12 ++- ...01-tasks.py-Allow-passing-extra-build-arg.patch | 2 +- .../0002-OPNFV-tag-convention-alignment.patch | 2 +- ...03-OPNFV-package-installation-Ubuntu-user.patch | 2 +- ...Set-ignore_overwritten_missing_references.patch | 2 +- .../0005-Add-saltminion-maas-build-target.patch | 105 +++++++++++++++++++++ 6 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 mcp/patches/docker/0005-Add-saltminion-maas-build-target.patch diff --git a/ci/build.sh b/ci/build.sh index 108ce139a..8fab2ca01 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -33,6 +33,7 @@ DOCKER_DIR=$(cd "${MCP_REPO_ROOT_PATH}/docker"; pwd) DOCKER_TAG=${1:-latest} DOCKER_PUSH=${2---push} # pass an empty second arg to disable push CACHE_INVALIDATE=${CACHE_INVALIDATE:-0} +SALT_VERSION='stable 2017.7' source "${DEPLOY_DIR}/globals.sh" source "${DEPLOY_DIR}/lib.sh" @@ -81,11 +82,20 @@ env PIPENV_HIDE_EMOJIS=1 python -m pipenv run \ --dist-rel=xenial \ --formula-rev=nightly \ --opnfv-tag="${DOCKER_TAG}" \ - --salt='stable 2017.7' \ + --salt="${SALT_VERSION}" \ --build-arg-extra " \ CACHE_INVALIDATE=\"${CACHE_INVALIDATE}\"" \ ${DOCKER_PUSH} +env PIPENV_HIDE_EMOJIS=1 python -m pipenv run \ + invoke build saltminion-maas \ + --require 'maas' \ + --dist=ubuntu \ + --dist-rel=xenial \ + --opnfv-tag="${DOCKER_TAG}" \ + --salt="${SALT_VERSION}" \ + ${DOCKER_PUSH} + popd > /dev/null # diff --git a/mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch b/mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch index cf1c57d31..9abbfb0b2 100644 --- a/mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch +++ b/mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch @@ -1,5 +1,5 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -: Copyright (c) 2018 Mirantis Inc., Enea AB and others. +: Copyright (c) 2019 Mirantis Inc., Enea AB and others. : : All rights reserved. This program and the accompanying materials : are made available under the terms of the Apache License, Version 2.0 diff --git a/mcp/patches/docker/0002-OPNFV-tag-convention-alignment.patch b/mcp/patches/docker/0002-OPNFV-tag-convention-alignment.patch index 6ceb4873d..683dc4600 100644 --- a/mcp/patches/docker/0002-OPNFV-tag-convention-alignment.patch +++ b/mcp/patches/docker/0002-OPNFV-tag-convention-alignment.patch @@ -1,5 +1,5 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -: Copyright (c) 2018 Mirantis Inc., Enea AB and others. +: Copyright (c) 2019 Mirantis Inc., Enea AB and others. : : All rights reserved. This program and the accompanying materials : are made available under the terms of the Apache License, Version 2.0 diff --git a/mcp/patches/docker/0003-OPNFV-package-installation-Ubuntu-user.patch b/mcp/patches/docker/0003-OPNFV-package-installation-Ubuntu-user.patch index 57cf436ef..34db789a2 100644 --- a/mcp/patches/docker/0003-OPNFV-package-installation-Ubuntu-user.patch +++ b/mcp/patches/docker/0003-OPNFV-package-installation-Ubuntu-user.patch @@ -1,5 +1,5 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -: Copyright (c) 2018 Mirantis Inc., Enea AB and others. +: Copyright (c) 2019 Mirantis Inc., Enea AB and others. : : All rights reserved. This program and the accompanying materials : are made available under the terms of the Apache License, Version 2.0 diff --git a/mcp/patches/docker/0004-reclass-Set-ignore_overwritten_missing_references.patch b/mcp/patches/docker/0004-reclass-Set-ignore_overwritten_missing_references.patch index 4437ecd91..0af1e6967 100644 --- a/mcp/patches/docker/0004-reclass-Set-ignore_overwritten_missing_references.patch +++ b/mcp/patches/docker/0004-reclass-Set-ignore_overwritten_missing_references.patch @@ -1,5 +1,5 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -: Copyright (c) 2018 Mirantis Inc., Enea AB and others. +: Copyright (c) 2019 Mirantis Inc., Enea AB and others. : : All rights reserved. This program and the accompanying materials : are made available under the terms of the Apache License, Version 2.0 diff --git a/mcp/patches/docker/0005-Add-saltminion-maas-build-target.patch b/mcp/patches/docker/0005-Add-saltminion-maas-build-target.patch new file mode 100644 index 000000000..2fb4cf523 --- /dev/null +++ b/mcp/patches/docker/0005-Add-saltminion-maas-build-target.patch @@ -0,0 +1,105 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: Copyright (c) 2019 Mirantis Inc., Enea AB and others. +: +: All rights reserved. This program and the accompanying materials +: are made available under the terms of the Apache License, Version 2.0 +: which accompanies this distribution, and is available at +: http://www.apache.org/licenses/LICENSE-2.0 +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +From: Alexandru Avadanii +Date: Wed, 30 Jan 2019 17:21:03 +0100 +Subject: [PATCH] Add saltminion-maas build target + +--- + DockerMake.yml | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ + invoke.yml | 5 +++++ + 2 files changed, 66 insertions(+) + +diff --git a/DockerMake.yml b/DockerMake.yml +index 9ab7195..2c0b8ac 100644 +--- a/DockerMake.yml ++++ b/DockerMake.yml +@@ -50,6 +50,67 @@ common: + && eval ${LAYER_CLEANUP} + + ++maas: ++ requires: ++ - python ++ build: | ++ ENV container docker ++ ARG SALT_VERSION="stable" ++ ENV SALT_VERSION $SALT_VERSION ++ ARG SALT_BOOTSTRAP_OPTS="-PdX ${SALT_VERSION}" ++ ENV SALT_BOOTSTRAP_OPTS $SALT_BOOTSTRAP_OPTS ++ RUN echo "Layer with MaaS, salt-minion packages" \ ++ && find /etc/systemd/system \ ++ /lib/systemd/system \ ++ -path '*.wants/*' \ ++ -not -name '*journald*' \ ++ -not -name '*systemd-tmpfiles*' \ ++ -not -name '*systemd-user-sessions*' \ ++ -exec rm \{} \; \ ++ && systemctl set-default multi-user.target \ ++ && eval ${LAYER_PKGUPDT} \ ++ && curl -qL https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | $SUDO sh -s -- -A cfg01 ${SALT_BOOTSTRAP_OPTS} \ ++ && apt-get upgrade -qy \ ++ && ${LAYER_INSTALL} maas-common \ ++ && ${LAYER_INSTALL} \ ++ at \ ++ avahi-utils \ ++ dbconfig-pgsql \ ++ ipmitool \ ++ iptables \ ++ iptables-persistent \ ++ iputils-ping \ ++ kmod \ ++ lsb-release \ ++ maas-cli \ ++ maas-dns \ ++ maas-rack-controller \ ++ maas-region-api \ ++ postgresql \ ++ python-futures \ ++ python-m2crypto \ ++ python-msgpack \ ++ python-netaddr \ ++ python-oauth \ ++ python-psutil \ ++ python-yaml \ ++ sysfsutils \ ++ tcpdump \ ++ && apt-get download maas-region-controller \ ++ && dpkg-deb --extract maas-region-controller*.deb maas-region-controller \ ++ && dpkg-deb --control maas-region-controller*.deb maas-region-controller/DEBIAN \ ++ && mkdir -p /var/lib/opnfv/etc \ ++ && mv maas-region-controller/DEBIAN/postinst /var/lib/opnfv/maas-region-controller.postinst \ ++ && dpkg-deb --build maas-region-controller \ ++ && dpkg -i maas-region-controller.deb \ ++ && rm -rf maas* \ ++ && mv /var/lib/maas /var/lib/postgresql /var/lib/opnfv/ \ ++ && mv /etc/maas /etc/ssh /var/lib/opnfv/etc/ \ ++ && mv /var/lib/opnfv/maas-region-controller.postinst /var/lib/dpkg/info/ \ ++ && eval ${LAYER_CLEANUP} ++ ENTRYPOINT ["/bin/bash", "-c", "/entrypoint.sh && exec /sbin/init"] ++ ++ + salt: + requires: + - python +diff --git a/invoke.yml b/invoke.yml +index 291f4c7..a2f4614 100644 +--- a/invoke.yml ++++ b/invoke.yml +@@ -62,6 +62,11 @@ target: + # - salt + # require: + # - saltclass ++ saltminion-maas: ++ matrix: ++ - dist ++ require: ++ - maas + + dockermake: + destination: 'images' -- 2.16.6