2 # ============LICENSE_START=======================================================
3 # Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
24 export OFFLINE_PKG_FOLDER="${OFFLINE_PKG_FOLDER:-/tmp/offline-package}"
25 export OFFLINE_PKG_FILE="${OFFLINE_PKG_FILE:-/tmp/offline-package.tgz}"
27 # NOTE (fdegir): In order to package and test the change for offline deployment,
28 # we need to include the change/patch within the package since that is what should
29 # be used during the deployment phase.
30 # check if we are running as part of CI verify job
31 GERRIT_PROJECT="${GERRIT_PROJECT:-}"
32 if [[ "$GERRIT_PROJECT" == "infra/engine" ]]; then
33 REPO_GIT_URL="https://gerrit.nordix.org/infra/engine.git"
34 echo "Info : Running in CI - infra/engine patch will be packaged for testing."
35 echo " Checking out the change/patch $GERRIT_REFSPEC for $REPO_GIT_URL"
36 # navigate to the folder and checkout the patch
37 cd "$OFFLINE_PKG_FOLDER/git/engine"
38 git fetch "$REPO_GIT_URL" "$GERRIT_REFSPEC" && git checkout FETCH_HEAD
41 # compress & archive offline dependencies
42 tar -C "$OFFLINE_PKG_FOLDER" -czf "$OFFLINE_PKG_FILE" .
44 # remove intermediate offline pkg folder
45 rm -rf "$OFFLINE_PKG_FOLDER"
47 # create self extracting installer
48 cat /tmp/decompress.sh "$OFFLINE_PKG_FILE" > "$OFFLINE_INSTALLER_FILE"
49 chmod +x "$OFFLINE_INSTALLER_FILE"
51 # NOTE (fdegir): if the packaging is run by release job, that job stored release
52 # metadata in release.properties file. If this file exists, we need to keep tarball
53 # as that must be uploaded for further delivery. The reason for this is that the
54 # installer can not be scanned by XRAY
55 if [[ ! -f "/tmp/release.properties" ]]; then
56 # remove intermediate offline pkg file
57 rm -rf "$OFFLINE_PKG_FILE"
60 # vim: set ts=2 sw=2 expandtab: