summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-08-23 15:34:36 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-08-23 15:34:36 +0000
commit0908d946b32e5b134fab4eb0e119d8bf9661c902 (patch)
tree6e38d7fed392992b548c43b6e2473ccfe3a84eba /ci
parent81b3142363d36b5328906e084262a723dcdf2fda (diff)
parent10a751f1e43a1c719ad4f313fb8059847de6190a (diff)
Merge changes from topic 'docker-build'
* changes: [docker build] Install OpenSSH server [submodule] Add docker-salt-formulas, ci/build.sh [deploy.sh] Install Docker if not present [jump req] Add build/deploy specific requirements
Diffstat (limited to 'ci')
-rwxr-xr-xci/build.sh79
-rwxr-xr-xci/deploy.sh3
2 files changed, 81 insertions, 1 deletions
diff --git a/ci/build.sh b/ci/build.sh
new file mode 100755
index 000000000..313edaed4
--- /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 opnfv 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
+##############################################################################
diff --git a/ci/deploy.sh b/ci/deploy.sh
index ea8524a85..47662f796 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -240,7 +240,8 @@ 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'
+ docker_install
fi
if ! virsh list >/dev/null 2>&1; then