diff options
Diffstat (limited to 'mcp/patches/docker')
6 files changed, 433 insertions, 0 deletions
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 new file mode 100644 index 000000000..9abbfb0b2 --- /dev/null +++ b/mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch @@ -0,0 +1,59 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: 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 <Alexandru.Avadanii@enea.com> +Date: Sun, 9 Sep 2018 23:18:39 +0200 +Subject: [PATCH] tasks.py: Allow passing extra --build-arg + +E.g. A, B with values "a", respectively "b c": +$ invoke build saltmaster-reclass --build-arg-extra='A="a" B="b c"' +will be passed down as: +--build-arg A="a" --build-arg B="b c" + +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +--- + tasks.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/tasks.py b/tasks.py +index d6bf3bc..59e217d 100644 +--- a/tasks.py ++++ b/tasks.py +@@ -3,6 +3,7 @@ + + + from invoke import Collection, task ++from shlex import split + from string import Template + import re + import ast +@@ -25,7 +26,7 @@ def all(ctx, dry=False, push=False, dry_targets=False, filter=None, **kwargs): + dry=dry, push=push, dry_targets=dry_targets, filter=filter, **kwargs) + + @task +-def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, formula_rev=None, push=False, dry=False, dry_targets=False, **kwargs): ++def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, formula_rev=None, push=False, dry=False, dry_targets=False, build_arg_extra='', **kwargs): + + kwargs['dist'] = dist + kwargs['dist_rel'] = dist_rel +@@ -35,6 +36,7 @@ def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, + kwargs['require'] = require + kwargs['salt'] = salt + kwargs['target'] = target ++ kwargs['build_arg_extra'] = ' --build-arg '.join([''] + split(build_arg_extra.replace('"', '"\\"'))) + # command formating + update + fmt = {'tag': ''} + fmt.update(ctx.dockermake) +@@ -60,6 +62,7 @@ def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, + \t--requires ${requires} \ + \t--build-arg SALT_VERSION="${salt}" \ + \t--build-arg SALT_FORMULA_VERSION="${formula_rev}" \ ++ \t${build_arg_extra} \ + \t${push} ${options} \ + ${fin}""").safe_substitute(fmt) + ctx.run(cmd.replace(' ', '')) diff --git a/mcp/patches/docker/0002-OPNFV-tag-convention-alignment.patch b/mcp/patches/docker/0002-OPNFV-tag-convention-alignment.patch new file mode 100644 index 000000000..683dc4600 --- /dev/null +++ b/mcp/patches/docker/0002-OPNFV-tag-convention-alignment.patch @@ -0,0 +1,78 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: 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 <Alexandru.Avadanii@enea.com> +Date: Tue, 21 Aug 2018 02:42:35 +0200 +Subject: [PATCH] OPNFV tag convention alignment + +* (arch)- prefix Docker tags + Hacky implementation that only detects 'arm64', otherwise it will + default to 'amd64'. + Note that Docker arch notation uses 'arm64' instead of 'aarch64'. +* Override Docker tag to align with OPNFV format +* use Docker repository: opnfv/fuel + +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +--- + invoke.yml | 2 +- + tasks.py | 7 +++++-- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/invoke.yml b/invoke.yml +index 0bd793e..291f4c7 100644 +--- a/invoke.yml ++++ b/invoke.yml +@@ -65,7 +65,7 @@ target: + + dockermake: + destination: 'images' +- repository: 'docker.io/epcim/salt' ++ repository: 'docker.io/opnfv/fuel' + # options: '--no-cache' + # options: '--bust-cache reclass' + # options: '--registry-user epcim' +diff --git a/tasks.py b/tasks.py +index 59e217d..8afbde9 100644 +--- a/tasks.py ++++ b/tasks.py +@@ -7,6 +7,7 @@ from shlex import split + from string import Template + import re + import ast ++import platform + + # TODOs: + # - WIP - use namespace to expose images/targets as inoke tasks # image = Collection('image') +@@ -26,8 +27,9 @@ def all(ctx, dry=False, push=False, dry_targets=False, filter=None, **kwargs): + dry=dry, push=push, dry_targets=dry_targets, filter=filter, **kwargs) + + @task +-def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, formula_rev=None, push=False, dry=False, dry_targets=False, build_arg_extra='', **kwargs): ++def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, formula_rev=None, opnfv_tag='latest', push=False, dry=False, dry_targets=False, build_arg_extra='', **kwargs): + ++ kwargs['arch'] = 'arm64' if platform.machine() == 'aarch64' else 'amd64' + kwargs['dist'] = dist + kwargs['dist_rel'] = dist_rel + kwargs['dry'] = True if dry_targets or dry else False +@@ -37,6 +39,7 @@ def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, + kwargs['salt'] = salt + kwargs['target'] = target + kwargs['build_arg_extra'] = ' --build-arg '.join([''] + split(build_arg_extra.replace('"', '"\\"'))) ++ kwargs['opnfv_tag'] = opnfv_tag + # command formating + update + fmt = {'tag': ''} + fmt.update(ctx.dockermake) +@@ -58,7 +61,7 @@ def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, + # execute + cmd = Template(""" + ${dry}docker-make -f DockerMake.${dist}.yml -u ${repository}: --name ${target} \ +- \t-t ${dist}-${dist_rel}${tag} \ ++ \t-t ${arch}-${opnfv_tag} \ + \t--requires ${requires} \ + \t--build-arg SALT_VERSION="${salt}" \ + \t--build-arg SALT_FORMULA_VERSION="${formula_rev}" \ diff --git a/mcp/patches/docker/0003-OPNFV-package-installation-Ubuntu-user.patch b/mcp/patches/docker/0003-OPNFV-package-installation-Ubuntu-user.patch new file mode 100644 index 000000000..27df86e8d --- /dev/null +++ b/mcp/patches/docker/0003-OPNFV-package-installation-Ubuntu-user.patch @@ -0,0 +1,112 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: 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 <Alexandru.Avadanii@enea.com> +Date: Wed, 22 Aug 2018 01:35:06 +0200 +Subject: [PATCH] OPNFV package installation, Ubuntu user + +* Install OpenSSH server (and client), so other OPNFV projects can + easily connect to the Salt master node; +* Install 'salt-formula-gnocchi' distro package (empty git formula + workaround); +* While at it, create 'ubuntu' user so other OPNFV projects don't + have to switch to 'root' login; +* Preinstall `salt_minion_dependency_packages` and + `salt_minion_reclass_dependencies`; +* Pin dockermake to v0.8 to allow using python3.5 for virtualenv, + since python 3.6 is not easily available for Ubuntu Xenial + jump/build hosts. +* Pin jinja2 to 2.11.0 to bypass [1]. + +[1] https://github.com/saltstack/salt/issues/46594 + +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +--- + DockerMake.yml | 39 ++++++++++++++++++++++++++++++++++++++- + Pipfile | 4 ++-- + 2 files changed, 40 insertions(+), 3 deletions(-) + +diff --git a/DockerMake.yml b/DockerMake.yml +index 2c75586..f30024c 100644 +--- a/DockerMake.yml ++++ b/DockerMake.yml +@@ -29,6 +29,7 @@ common-cleanup: + + common: + build: | ++ ARG CACHE_INVALIDATE="0" + RUN echo "Layer with common packages" \ + && eval ${LAYER_PKGUPDT} \ + && apt-get upgrade -qy \ +@@ -94,7 +95,7 @@ salt-formulas: + build: | + ARG SALT_FORMULA_VERSION="master" + ENV SALT_FORMULA_VERSION $SALT_FORMULA_VERSION +- ARG SALT_FORMULA_SOURCES="https://github.com/salt-formulas https://github.com/saltstack-formulas" ++ ARG SALT_FORMULA_SOURCES="https://github.com/salt-formulas" + ENV SALT_FORMULA_SOURCES $SALT_FORMULA_SOURCES + ARG SALT_FORMULAS_BASE="/srv/salt/formula" + ENV SALT_FORMULAS_BASE $SALT_FORMULAS_BASE +@@ -108,6 +109,42 @@ salt-formulas: + && bash -c 'source /srv/salt/formula-fetch.sh && setupPyEnv && fetchAll' \ + && eval ${LAYER_CLEANUP} + ++opnfv: ++ build: | ++ # Some formulas have empty git repos, use the package version ++ ARG SALT_FORMULA_VERSION="nightly" ++ ENV SALT_FORMULA_VERSION $SALT_FORMULA_VERSION ++ ARG SALT_FORMULA_LIST="salt-formula-gnocchi" ++ ENV SALT_FORMULA_LIST $SALT_FORMULA_LIST ++ ENV APT_REPOSITORY "deb [arch=amd64] http://apt.mirantis.com/xenial ${SALT_FORMULA_VERSION} salt" ++ ENV APT_REPOSITORY_GPG "http://apt.mirantis.com/public.gpg" ++ RUN echo "Layer extra salt-formulas packages" \ ++ && echo "$APT_REPOSITORY" | tee /etc/apt/sources.list.d/salt-formulas.list >/dev/null \ ++ && curl -sL $APT_REPOSITORY_GPG | $SUDO apt-key add - \ ++ && eval ${LAYER_PKGUPDT} \ ++ && ${LAYER_INSTALL} ${SALT_FORMULA_LIST} -y --fix-missing -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \ ++ && eval ${LAYER_CLEANUP} ++ RUN echo "Layer with OPNFV packages" \ ++ && eval ${LAYER_PKGUPDT} \ ++ && ${LAYER_INSTALL} \ ++ gawk \ ++ inetutils-ping \ ++ kmod \ ++ net-tools \ ++ openssh-server \ ++ python-futures \ ++ python-m2crypto \ ++ python-msgpack \ ++ python-netaddr \ ++ python-oauth \ ++ python-psutil \ ++ python-yaml \ ++ && useradd -m ubuntu \ ++ && echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/ubuntu \ ++ && python -m pip install -U jinja2==2.11.0 \ ++ && eval ${LAYER_CLEANUP} ++ ++ + wheel: + requires: + - base +diff --git a/Pipfile b/Pipfile +index d3e8d66..340e125 100644 +--- a/Pipfile ++++ b/Pipfile +@@ -7,8 +7,8 @@ name = "pypi" + + [packages] + pygithub = "*" +-docker-make = {git = "https://github.com/avirshup/DockerMake"} +-dockermake = {git = "https://github.com/avirshup/DockerMake"} ++docker-make = {git = "https://github.com/avirshup/DockerMake", ref = "aeac230fd5ab468d806bf42b120aa97f91eb40a2"} ++dockermake = {git = "https://github.com/avirshup/DockerMake", ref = "aeac230fd5ab468d806bf42b120aa97f91eb40a2"} + + [requires] + python_version = "3.6" 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 new file mode 100644 index 000000000..0af1e6967 --- /dev/null +++ b/mcp/patches/docker/0004-reclass-Set-ignore_overwritten_missing_references.patch @@ -0,0 +1,34 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: 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 <Alexandru.Avadanii@enea.com> +Date: Tue, 20 Nov 2018 23:16:44 +0200 +Subject: [PATCH] reclass: Set ignore_overwritten_missing_references + +The recent changes in `reclass` 1.6.x allow configuring this new +option; however the default for it is broken - see [1]. + +[1] https://github.com/salt-formulas/reclass/issues/77 + +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +--- + files/reclass/reclass-config.yml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/files/reclass/reclass-config.yml b/files/reclass/reclass-config.yml +index 00aba49..f4da04c 100644 +--- a/files/reclass/reclass-config.yml ++++ b/files/reclass/reclass-config.yml +@@ -3,6 +3,7 @@ inventory_base_uri: /srv/salt/reclass + pretty_print: True + output: yaml + ++ignore_overwritten_missing_references: True + ignore_class_notfound: True + ignore_class_regexp: + - 'service.*' 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..889fdcd43 --- /dev/null +++ b/mcp/patches/docker/0005-Add-saltminion-maas-build-target.patch @@ -0,0 +1,108 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: 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 <Alexandru.Avadanii@enea.com> +Date: Wed, 30 Jan 2019 17:21:03 +0100 +Subject: [PATCH] Add saltminion-maas build target + +--- + DockerMake.yml | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ + invoke.yml | 5 ++++ + 2 files changed, 69 insertions(+) + +diff --git a/DockerMake.yml b/DockerMake.yml +index f30024c..a23541c 100644 +--- a/DockerMake.yml ++++ b/DockerMake.yml +@@ -50,6 +50,70 @@ 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" \ ++ && eval ${LAYER_PKGUPDT} \ ++ && apt-get upgrade -qy \ ++ && ${LAYER_INSTALL} maas-common systemd \ ++ && 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 \ ++ && ${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-pip \ ++ python-psutil \ ++ python-setuptools \ ++ 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/ \ ++ && python -m pip install -U jinja2==2.11.0 \ ++ && curl -qL https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | $SUDO sh -s -- -A cfg01 ${SALT_BOOTSTRAP_OPTS} \ ++ && eval ${LAYER_CLEANUP} ++ ENTRYPOINT ["/bin/bash", "-c", "/entrypoint.sh && exec /lib/systemd/systemd"] ++ ++ + 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' diff --git a/mcp/patches/docker/0006-Use-archive.repo.saltstack.com-repos.patch b/mcp/patches/docker/0006-Use-archive.repo.saltstack.com-repos.patch new file mode 100644 index 000000000..1889e3a9b --- /dev/null +++ b/mcp/patches/docker/0006-Use-archive.repo.saltstack.com-repos.patch @@ -0,0 +1,42 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: 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 <Alexandru.Avadanii@enea.com> +Date: Thu, 18 Jun 2020 16:33:35 +0200 +Subject: [PATCH] Use archive.repo.saltstack.com repos + +Saltstack packages for 2017.7 have been archives, use the appropiate +repository URL. + +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +--- + DockerMake.yml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/DockerMake.yml b/DockerMake.yml +index a23541c..5910613 100644 +--- a/DockerMake.yml ++++ b/DockerMake.yml +@@ -109,7 +109,7 @@ maas: + && mv /etc/maas /etc/ssh /var/lib/opnfv/etc/ \ + && mv /var/lib/opnfv/maas-region-controller.postinst /var/lib/dpkg/info/ \ + && python -m pip install -U jinja2==2.11.0 \ +- && curl -qL https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | $SUDO sh -s -- -A cfg01 ${SALT_BOOTSTRAP_OPTS} \ ++ && curl -qL https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | $SUDO sh -s -- -A cfg01 -R archive.repo.saltstack.com ${SALT_BOOTSTRAP_OPTS} \ + && eval ${LAYER_CLEANUP} + ENTRYPOINT ["/bin/bash", "-c", "/entrypoint.sh && exec /lib/systemd/systemd"] + +@@ -127,7 +127,7 @@ salt: + RUN echo "Layer salt" \ + && eval ${LAYER_PKGUPDT} \ + && mkdir -p /var/run/salt /var/cache/salt /var/log/salt /etc/salt/pki/master/minions /srv/salt/formula /srv/salt/env \ +- && curl -qL https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | $SUDO sh -s -- ${SALT_BOOTSTRAP_PKGS} -M -A localhost ${SALT_BOOTSTRAP_OPTS} \ ++ && curl -qL https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | $SUDO sh -s -- ${SALT_BOOTSTRAP_PKGS} -R archive.repo.saltstack.com -M -A localhost ${SALT_BOOTSTRAP_OPTS} \ + && if ! getent passwd salt > /dev/null;then useradd --system salt; fi \ + && chown -R salt:salt /etc/salt /var/cache/salt /var/log/salt /var/run/salt \ + && eval ${LAYER_CLEANUP} |