blob: d45ff85cb33350eef84f775c5d5483e057d290b2 [file] [log] [blame]
afennerc20596c2020-07-31 15:15:27 +01001#!/bin/bash
2
3# ============LICENSE_START=======================================================
4# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
5# ================================================================================
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# SPDX-License-Identifier: Apache-2.0
19# ============LICENSE_END=========================================================
20
21
22set -o nounset
23set -o errexit
24set -o pipefail
25
26# file to record k8s properties
27export K8S_DEPLOYMENT_FILE="$WORKSPACE/k8s.properties"
28/bin/rm -f "$K8S_DEPLOYMENT_FILE"
29
30echo "Info : Generating k8s properties"
31
32# determine the project
33# this scripts is used by all engine repos so we need to determine what this change is for
34export ENGINE_COMPONENT="${GERRIT_PROJECT//*\//}"
35
36echo "Info : Setting STACK_TYPE and STACK_VERSION"
37
38export STACK_TYPE="kubernetes"
39export STACK_VERSION="$K8S_VERSION"
40
41# record vars to properties file
42echo "STACK_TYPE=$STACK_TYPE" >> "$K8S_DEPLOYMENT_FILE"
43echo "DEPLOY_SCENARIO=k8-calico-nofeature" >> "$K8S_DEPLOYMENT_FILE"
44echo "STACK_VERSION=$STACK_VERSION" >> "$K8S_DEPLOYMENT_FILE"
45echo "NORDIX_STACK_VERSION=$K8S_VERSION" >> "$K8S_DEPLOYMENT_FILE"
46
47# global vars
48export NORDIX_ARM_HTTPS_URL="https://artifactory.nordix.org/artifactory"
49export ARTIFACT_ARM_FOLDER="release"
afennerc2e7ec32020-08-05 08:42:56 +010050export BUILD_IDENTIFIER="${K8S_VERSION}/stack/latest"
afennerc20596c2020-07-31 15:15:27 +010051export OFFLINE_INSTALLER_FILE="/tmp/${STACK_TYPE}-${K8S_VERSION}-${DISTRO}.bsx"
52export BUILD_ARTIFACTS="/tmp/${STACK_TYPE}-${K8S_VERSION}-${DISTRO}.bsx"
53export NORDIX_ARM_REPO="nordix-${STACK_TYPE}"
afennerc2e7ec32020-08-05 08:42:56 +010054# looking to make url looking like
55# https://artifactory.nordix.org/artifactory/nordix-kubernetes/oss/release/1.15/stack/latest/kubernetes-1.15-ubuntu1804.bsx
afennerc20596c2020-07-31 15:15:27 +010056export NORDIX_ARTIFACT_URL="$NORDIX_ARM_HTTPS_URL/$NORDIX_ARM_REPO/oss/$ARTIFACT_ARM_FOLDER/$BUILD_IDENTIFIER"
57
58cat << EOF >> "$K8S_DEPLOYMENT_FILE"
59BUILD_IDENTIFIER=$BUILD_IDENTIFIER
60BUILD_DATE=$(date '+%Y%m%d%H%M')
61BUILT_BY=$BUILD_URL
62DISTRO=$DISTRO
63CI_LOOP=$CI_LOOP
64ENGINE_SHA=$(git rev-parse HEAD)
65OFFLINE_INSTALLER_FILE=$OFFLINE_INSTALLER_FILE
66BUILD_ARTIFACTS=$BUILD_ARTIFACTS
67NORDIX_ARM_REPO=nordix-${STACK_TYPE}
68NORDIX_ARTIFACT_URL=$NORDIX_ARTIFACT_URL
69EOF
70
71echo "Info : K8S properties"
72echo "-------------------------------------------------------------------------"
73cat "$K8S_DEPLOYMENT_FILE"
74echo "-------------------------------------------------------------------------"
75
76# vim: set ts=2 sw=2 expandtab: