From 2f4c3eca2cc08caa3560da153cf5ba6a2268c10e Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sun, 19 Aug 2018 23:28:03 +0200 Subject: [jump req] Add build/deploy specific requirements Add support for different prerequisites depending on the current operation (docker build or cluster deploy). Leverage the new support to pre-install upcoming deps: - python-pip (build); - docker-compose (deploy); JIRA: FUEL-383 Change-Id: Ic3e6062b1943e3584f0b1f80d2e33b8812defced Signed-off-by: Alexandru Avadanii --- ci/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ci') diff --git a/ci/deploy.sh b/ci/deploy.sh index ea8524a85..d3704a1dd 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -240,7 +240,7 @@ if [ ${USE_EXISTING_PKGS} -eq 1 ]; then notify "[NOTE] Skipping distro pkg installation" 2 else notify "[NOTE] Installing required distro pkgs" 2 - jumpserver_pkg_install + jumpserver_pkg_install 'deploy' fi if ! virsh list >/dev/null 2>&1; then -- cgit From 7bdedca0da908d4b42f17457f04ea87b69c480e3 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Mon, 20 Aug 2018 00:11:02 +0200 Subject: [deploy.sh] Install Docker if not present JIRA: FUEL-383 Change-Id: I19d27ca59a3f24d1bd66e39457a6ca267bccce19 Signed-off-by: Alexandru Avadanii --- ci/deploy.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'ci') diff --git a/ci/deploy.sh b/ci/deploy.sh index d3704a1dd..47662f796 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -241,6 +241,7 @@ if [ ${USE_EXISTING_PKGS} -eq 1 ]; then else notify "[NOTE] Installing required distro pkgs" 2 jumpserver_pkg_install 'deploy' + docker_install fi if ! virsh list >/dev/null 2>&1; then -- cgit From 7d35eed8eb4b0c1047dba575f365060cebac9659 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sun, 19 Aug 2018 17:52:02 +0200 Subject: [submodule] Add docker-salt-formulas, ci/build.sh - add new git submodule pointing to upstream docker build scripts; - add patch extending Docker tags with an '-(arch)' suffix, aligning with OPNFV tagging requiremnts; - add wrapper for starting Docker builds; - install build-specific distro package requirements, as well as pip-managed packages (e.g. pipenv); JIRA: FUEL-383 Change-Id: Id4fc886206d7eaf7e6d02810380f2391609ba405 Signed-off-by: Alexandru Avadanii --- ci/build.sh | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 ci/build.sh (limited to 'ci') diff --git a/ci/build.sh b/ci/build.sh new file mode 100755 index 000000000..9bca18770 --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash -e +# shellcheck disable=SC1004,SC1090 +############################################################################## +# Copyright (c) 2018 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 +############################################################################## + +############################################################################## +# BEGIN of Exit handlers +# +do_exit () { + local RC=$? + if [ ${RC} -eq 0 ]; then + notify_n "[OK] MCP: Docker build finished succesfully!" 2 + else + notify_n "[ERROR] MCP: Docker build threw a fatal error!" + fi +} +# +# End of Exit handlers +############################################################################## + +############################################################################## +# BEGIN of variables to customize +# +CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x +MCP_REPO_ROOT_PATH=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/..") +DEPLOY_DIR=$(cd "${MCP_REPO_ROOT_PATH}/mcp/scripts"; pwd) +DOCKER_DIR=$(cd "${MCP_REPO_ROOT_PATH}/docker"; pwd) +DOCKER_TAG=${1:-latest} + +source "${DEPLOY_DIR}/globals.sh" +source "${DEPLOY_DIR}/lib.sh" + +# +# END of variables to customize +############################################################################## + +############################################################################## +# BEGIN of main +# + +# Enable the automatic exit trap +trap do_exit SIGINT SIGTERM EXIT + +# Set no restrictive umask so that Jenkins can remove any residuals +umask 0000 + +# Clone git submodules and apply our patches +make -C "${MCP_REPO_ROOT_PATH}/mcp/patches" deepclean patches-import + +pushd "${DOCKER_DIR}" > /dev/null + +# Install distro packages and pip-managed prerequisites +notify "[NOTE] Installing required build-time distro and pip pkgs" 2 +jumpserver_pkg_install 'build' +pip install pipenv --user +docker_install + +pipenv --two +pipenv install +pipenv shell \ + "invoke build saltmaster-reclass \ + --require 'salt salt-formulas reclass tini-saltmaster' \ + --dist=ubuntu \ + --dist-rel=xenial \ + --formula-rev=nightly \ + --opnfv-tag='${DOCKER_TAG}' \ + --salt='stable 2017.7'; \ + exit" + +popd > /dev/null + +# +# END of main +############################################################################## -- cgit From 10a751f1e43a1c719ad4f313fb8059847de6190a Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Wed, 22 Aug 2018 01:38:31 +0200 Subject: [docker build] Install OpenSSH server While at it, create the 'ubuntu' user with passwordless sudo and preinstall salt-formula-gnocchi (missing git repo workaround), as well as various useful packages (e.g. net-tools). JIRA: FUEL-383 Change-Id: I5902c37110331acfd3fd4fccb92104de7b5ece6b Signed-off-by: Alexandru Avadanii --- ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ci') diff --git a/ci/build.sh b/ci/build.sh index 9bca18770..313edaed4 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -64,7 +64,7 @@ pipenv --two pipenv install pipenv shell \ "invoke build saltmaster-reclass \ - --require 'salt salt-formulas reclass tini-saltmaster' \ + --require 'salt salt-formulas opnfv reclass tini-saltmaster' \ --dist=ubuntu \ --dist-rel=xenial \ --formula-rev=nightly \ -- cgit