blob: 1f50ff91a9fe5cff66282e7d922808436085291f [file] [log] [blame]
#!/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 nounset
set -o errexit
set -o pipefail
# NOTE (Fdegir): stacks use different tools so we need to record tool versions
# depending on which stack we are releasing
function record_component_versions() {
case "${STACK_TYPE}" in
ironic)
echo "NORDIX_BIFROST_VERSION=$NORDIX_BIFROST_VERSION" >> $RELEASE_METADATA_FILE
;;
kubernetes)
echo "NORDIX_BIFROST_VERSION=$NORDIX_BIFROST_VERSION" >> $RELEASE_METADATA_FILE
echo "NORDIX_HEAT_VERSION=$NORDIX_HEAT_VERSION" >> $RELEASE_METADATA_FILE
echo "NORDIX_KUBESPRAY_VERSION=$NORDIX_KUBESPRAY_VERSION" >> $RELEASE_METADATA_FILE
;;
onap)
echo "NORDIX_OOM_VERSION=$NORDIX_OOM_VERSION" >> $RELEASE_METADATA_FILE
;;
openstack)
echo "NORDIX_BIFROST_VERSION=$NORDIX_BIFROST_VERSION" >> $RELEASE_METADATA_FILE
echo "NORDIX_KOLLA_VERSION=$NORDIX_KOLLA_VERSION" >> $RELEASE_METADATA_FILE
;;
*) echo "ERROR : Invalid stack $STACK_TYPE"; exit 1;;
esac
}
# file to record release metadata
export RELEASE_METADATA_FILE="$WORKSPACE/release.properties"
/bin/rm -f "$RELEASE_METADATA_FILE" /tmp/release.properties
echo "Info : Generating release metadata"
# global vars
export NORDIX_ARM_HTTPS_URL="https://artifactory.nordix.org/artifactory"
export ARTIFACT_ARM_FOLDER="release/${BRANCH}/stack"
export BUILD_IDENTIFIER="$(date '+%Y%m%d%H%M')"
export OFFLINE_INSTALLER_FILE="/tmp/${STACK_TYPE}-${BRANCH}-${DISTRO}.bsx"
export OFFLINE_XTESTING_FILE="/tmp/${STACK_TYPE}-test-${BRANCH}.bsx"
export BUILD_ARTIFACTS="/tmp/${STACK_TYPE}-${BRANCH}-${DISTRO}.bsx /tmp/offline-package.tgz $WORKSPACE/release.properties"
export NORDIX_ARM_REPO="nordix-${STACK_TYPE}"
export NORDIX_ARTIFACT_URL="$NORDIX_ARM_HTTPS_URL/$NORDIX_ARM_REPO/oss/$ARTIFACT_ARM_FOLDER/$BUILD_IDENTIFIER"
cat << EOF >> "$RELEASE_METADATA_FILE"
BUILD_IDENTIFIER=$BUILD_IDENTIFIER
BUILD_DATE=$BUILD_IDENTIFIER
BRANCH=$BRANCH
RELEASE_JOB=$BUILD_URL
DISTRO=$DISTRO
DEPLOY_SCENARIO=$DEPLOY_SCENARIO
CI_LOOP=$CI_LOOP
STACK_TYPE=$STACK_TYPE
STACK_VERSION=$STACK_VERSION
PROMOTE_STACK=$PROMOTE_STACK
OFFLINE_INSTALLER_FILE=$OFFLINE_INSTALLER_FILE
OFFLINE_XTESTING_FILE=$OFFLINE_XTESTING_FILE
BUILD_ARTIFACTS=$BUILD_ARTIFACTS
NORDIX_ARM_REPO=nordix-${STACK_TYPE}
NORDIX_ARTIFACT_URL=$NORDIX_ARTIFACT_URL
NORDIX_ENGINE_VERSION=$NORDIX_ENGINE_VERSION
EOF
record_component_versions
echo "Info : Release metadata"
echo "-------------------------------------------------------------------------"
cat "$RELEASE_METADATA_FILE"
echo "-------------------------------------------------------------------------"
# NOTE (fdegir): release.properties file will be included in the tarball if the packaging
# is run for release purposes
/bin/cp -f $RELEASE_METADATA_FILE /tmp/release.properties
# vim: set ts=2 sw=2 expandtab: