blob: 1f50ff91a9fe5cff66282e7d922808436085291f [file] [log] [blame]
Fatih Degirmenci24eaec52020-07-10 19:47:40 +00001#!/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
21set -o nounset
22set -o errexit
23set -o pipefail
24
Fatih Degirmencidaf09652020-07-12 13:25:49 +000025# NOTE (Fdegir): stacks use different tools so we need to record tool versions
26# depending on which stack we are releasing
27function record_component_versions() {
28 case "${STACK_TYPE}" in
29 ironic)
30 echo "NORDIX_BIFROST_VERSION=$NORDIX_BIFROST_VERSION" >> $RELEASE_METADATA_FILE
31 ;;
32 kubernetes)
33 echo "NORDIX_BIFROST_VERSION=$NORDIX_BIFROST_VERSION" >> $RELEASE_METADATA_FILE
34 echo "NORDIX_HEAT_VERSION=$NORDIX_HEAT_VERSION" >> $RELEASE_METADATA_FILE
35 echo "NORDIX_KUBESPRAY_VERSION=$NORDIX_KUBESPRAY_VERSION" >> $RELEASE_METADATA_FILE
36 ;;
37 onap)
Fatih Degirmencidaf09652020-07-12 13:25:49 +000038 echo "NORDIX_OOM_VERSION=$NORDIX_OOM_VERSION" >> $RELEASE_METADATA_FILE
39 ;;
40 openstack)
41 echo "NORDIX_BIFROST_VERSION=$NORDIX_BIFROST_VERSION" >> $RELEASE_METADATA_FILE
42 echo "NORDIX_KOLLA_VERSION=$NORDIX_KOLLA_VERSION" >> $RELEASE_METADATA_FILE
43 ;;
44 *) echo "ERROR : Invalid stack $STACK_TYPE"; exit 1;;
45 esac
46}
47
Fatih Degirmenci24eaec52020-07-10 19:47:40 +000048# file to record release metadata
49export RELEASE_METADATA_FILE="$WORKSPACE/release.properties"
50/bin/rm -f "$RELEASE_METADATA_FILE" /tmp/release.properties
51
52echo "Info : Generating release metadata"
53
54# global vars
55export NORDIX_ARM_HTTPS_URL="https://artifactory.nordix.org/artifactory"
56export ARTIFACT_ARM_FOLDER="release/${BRANCH}/stack"
57export BUILD_IDENTIFIER="$(date '+%Y%m%d%H%M')"
58export OFFLINE_INSTALLER_FILE="/tmp/${STACK_TYPE}-${BRANCH}-${DISTRO}.bsx"
Prasad Mukhedkar6d918772021-03-18 04:42:28 +010059export OFFLINE_XTESTING_FILE="/tmp/${STACK_TYPE}-test-${BRANCH}.bsx"
Fatih Degirmenci24eaec52020-07-10 19:47:40 +000060export BUILD_ARTIFACTS="/tmp/${STACK_TYPE}-${BRANCH}-${DISTRO}.bsx /tmp/offline-package.tgz $WORKSPACE/release.properties"
61export NORDIX_ARM_REPO="nordix-${STACK_TYPE}"
62export NORDIX_ARTIFACT_URL="$NORDIX_ARM_HTTPS_URL/$NORDIX_ARM_REPO/oss/$ARTIFACT_ARM_FOLDER/$BUILD_IDENTIFIER"
63
64cat << EOF >> "$RELEASE_METADATA_FILE"
65BUILD_IDENTIFIER=$BUILD_IDENTIFIER
66BUILD_DATE=$BUILD_IDENTIFIER
67BRANCH=$BRANCH
68RELEASE_JOB=$BUILD_URL
69DISTRO=$DISTRO
70DEPLOY_SCENARIO=$DEPLOY_SCENARIO
71CI_LOOP=$CI_LOOP
72STACK_TYPE=$STACK_TYPE
73STACK_VERSION=$STACK_VERSION
74PROMOTE_STACK=$PROMOTE_STACK
Fatih Degirmenci24eaec52020-07-10 19:47:40 +000075OFFLINE_INSTALLER_FILE=$OFFLINE_INSTALLER_FILE
Prasad Mukhedkar4ed61662021-03-22 10:02:09 +010076OFFLINE_XTESTING_FILE=$OFFLINE_XTESTING_FILE
Fatih Degirmenci24eaec52020-07-10 19:47:40 +000077BUILD_ARTIFACTS=$BUILD_ARTIFACTS
78NORDIX_ARM_REPO=nordix-${STACK_TYPE}
79NORDIX_ARTIFACT_URL=$NORDIX_ARTIFACT_URL
Fatih Degirmencidaf09652020-07-12 13:25:49 +000080NORDIX_ENGINE_VERSION=$NORDIX_ENGINE_VERSION
Fatih Degirmenci24eaec52020-07-10 19:47:40 +000081EOF
82
Fatih Degirmencidaf09652020-07-12 13:25:49 +000083record_component_versions
84
Fatih Degirmenci24eaec52020-07-10 19:47:40 +000085echo "Info : Release metadata"
86echo "-------------------------------------------------------------------------"
87cat "$RELEASE_METADATA_FILE"
88echo "-------------------------------------------------------------------------"
89
90# NOTE (fdegir): release.properties file will be included in the tarball if the packaging
91# is run for release purposes
92/bin/cp -f $RELEASE_METADATA_FILE /tmp/release.properties
93
94# vim: set ts=2 sw=2 expandtab: