blob: 901fd8b3a4ea2e4836b8ebbbebb9e912c257ec8d [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)
38 echo "NORDIX_HEAT_VERSION=$NORDIX_HEAT_VERSION" >> $RELEASE_METADATA_FILE
39 echo "NORDIX_OOM_VERSION=$NORDIX_OOM_VERSION" >> $RELEASE_METADATA_FILE
40 ;;
41 openstack)
42 echo "NORDIX_BIFROST_VERSION=$NORDIX_BIFROST_VERSION" >> $RELEASE_METADATA_FILE
43 echo "NORDIX_KOLLA_VERSION=$NORDIX_KOLLA_VERSION" >> $RELEASE_METADATA_FILE
44 ;;
45 *) echo "ERROR : Invalid stack $STACK_TYPE"; exit 1;;
46 esac
47}
48
Fatih Degirmenci24eaec52020-07-10 19:47:40 +000049# file to record release metadata
50export RELEASE_METADATA_FILE="$WORKSPACE/release.properties"
51/bin/rm -f "$RELEASE_METADATA_FILE" /tmp/release.properties
52
53echo "Info : Generating release metadata"
54
55# global vars
56export NORDIX_ARM_HTTPS_URL="https://artifactory.nordix.org/artifactory"
57export ARTIFACT_ARM_FOLDER="release/${BRANCH}/stack"
58export BUILD_IDENTIFIER="$(date '+%Y%m%d%H%M')"
59export OFFLINE_INSTALLER_FILE="/tmp/${STACK_TYPE}-${BRANCH}-${DISTRO}.bsx"
60export 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
76BUILD_ARTIFACTS=$BUILD_ARTIFACTS
77NORDIX_ARM_REPO=nordix-${STACK_TYPE}
78NORDIX_ARTIFACT_URL=$NORDIX_ARTIFACT_URL
Fatih Degirmencidaf09652020-07-12 13:25:49 +000079NORDIX_ENGINE_VERSION=$NORDIX_ENGINE_VERSION
Fatih Degirmenci24eaec52020-07-10 19:47:40 +000080EOF
81
Fatih Degirmencidaf09652020-07-12 13:25:49 +000082record_component_versions
83
Fatih Degirmenci24eaec52020-07-10 19:47:40 +000084echo "Info : Release metadata"
85echo "-------------------------------------------------------------------------"
86cat "$RELEASE_METADATA_FILE"
87echo "-------------------------------------------------------------------------"
88
89# NOTE (fdegir): release.properties file will be included in the tarball if the packaging
90# is run for release purposes
91/bin/cp -f $RELEASE_METADATA_FILE /tmp/release.properties
92
93# vim: set ts=2 sw=2 expandtab: