Create engine kubernetes stack
This change creates kubernetes stack for engine in order to package,
deploy, and test stacks independently from engine core.
The main feature this enables is the ability to develop stacks
in their own repository with proper versioning and branching no
matter how the tools (provisioner and installer) are developed.
The stack simply selects versions of the tools (could be branches)
and the rest is done accordingly.
The role package which was previously located under
infra/installer/kubespray is moved into this repository in order to
handle what to package within the stack since some of the artifacts
we package do not belong to installer but to the stack itself.
Change-Id: I760d4d904544dad768525e999ebe53e156464111
diff --git a/playbooks/roles/package/files/build.sh b/playbooks/roles/package/files/build.sh
new file mode 100755
index 0000000..c28264d
--- /dev/null
+++ b/playbooks/roles/package/files/build.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# 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
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+export OFFLINE_PKG_FOLDER="${OFFLINE_PKG_FOLDER:-/tmp/offline-package}"
+export OFFLINE_PKG_FILE="${OFFLINE_PKG_FILE:-/tmp/offline-package.tgz}"
+
+# NOTE (fdegir): In order to package and test the change for offline deployment,
+# we need to include the change/patch within the package since that is what should
+# be used during the deployment phase.
+# check if we are running as part of CI verify job
+GERRIT_PROJECT="${GERRIT_PROJECT:-}"
+if [[ "$GERRIT_PROJECT" == "infra/engine" ]]; then
+ REPO_GIT_URL="https://gerrit.nordix.org/infra/engine.git"
+ echo "Info : Running in CI - infra/engine patch will be packaged for testing."
+ echo " Checking out the change/patch $GERRIT_REFSPEC for $REPO_GIT_URL"
+ # navigate to the folder and checkout the patch
+ cd "$OFFLINE_PKG_FOLDER/git/engine"
+ git fetch "$REPO_GIT_URL" "$GERRIT_REFSPEC" && git checkout FETCH_HEAD
+fi
+
+# compress & archive offline dependencies
+tar -C "$OFFLINE_PKG_FOLDER" -czf "$OFFLINE_PKG_FILE" .
+
+# remove intermediate offline pkg folder
+rm -rf "$OFFLINE_PKG_FOLDER"
+
+# create self extracting installer
+cat /tmp/decompress.sh "$OFFLINE_PKG_FILE" > "$OFFLINE_INSTALLER_FILE"
+chmod +x "$OFFLINE_INSTALLER_FILE"
+
+# remove intermediate offline pkg file
+rm -rf "$OFFLINE_PKG_FILE"
+
+# vim: set ts=2 sw=2 expandtab: