Fatih Degirmenci | 24eaec5 | 2020-07-10 19:47:40 +0000 | [diff] [blame] | 1 | #!/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 | set -o nounset |
| 22 | set -o errexit |
| 23 | set -o pipefail |
| 24 | |
Fatih Degirmenci | daf0965 | 2020-07-12 13:25:49 +0000 | [diff] [blame] | 25 | # NOTE (Fdegir): stacks use different tools so we need to record tool versions |
| 26 | # depending on which stack we are releasing |
| 27 | function 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 Degirmenci | daf0965 | 2020-07-12 13:25:49 +0000 | [diff] [blame] | 38 | 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 Degirmenci | 24eaec5 | 2020-07-10 19:47:40 +0000 | [diff] [blame] | 48 | # file to record release metadata |
| 49 | export RELEASE_METADATA_FILE="$WORKSPACE/release.properties" |
| 50 | /bin/rm -f "$RELEASE_METADATA_FILE" /tmp/release.properties |
| 51 | |
| 52 | echo "Info : Generating release metadata" |
| 53 | |
| 54 | # global vars |
| 55 | export NORDIX_ARM_HTTPS_URL="https://artifactory.nordix.org/artifactory" |
| 56 | export ARTIFACT_ARM_FOLDER="release/${BRANCH}/stack" |
| 57 | export BUILD_IDENTIFIER="$(date '+%Y%m%d%H%M')" |
| 58 | export OFFLINE_INSTALLER_FILE="/tmp/${STACK_TYPE}-${BRANCH}-${DISTRO}.bsx" |
Prasad Mukhedkar | 6d91877 | 2021-03-18 04:42:28 +0100 | [diff] [blame] | 59 | export OFFLINE_XTESTING_FILE="/tmp/${STACK_TYPE}-test-${BRANCH}.bsx" |
Fatih Degirmenci | 24eaec5 | 2020-07-10 19:47:40 +0000 | [diff] [blame] | 60 | export BUILD_ARTIFACTS="/tmp/${STACK_TYPE}-${BRANCH}-${DISTRO}.bsx /tmp/offline-package.tgz $WORKSPACE/release.properties" |
| 61 | export NORDIX_ARM_REPO="nordix-${STACK_TYPE}" |
| 62 | export NORDIX_ARTIFACT_URL="$NORDIX_ARM_HTTPS_URL/$NORDIX_ARM_REPO/oss/$ARTIFACT_ARM_FOLDER/$BUILD_IDENTIFIER" |
| 63 | |
| 64 | cat << EOF >> "$RELEASE_METADATA_FILE" |
| 65 | BUILD_IDENTIFIER=$BUILD_IDENTIFIER |
| 66 | BUILD_DATE=$BUILD_IDENTIFIER |
| 67 | BRANCH=$BRANCH |
| 68 | RELEASE_JOB=$BUILD_URL |
| 69 | DISTRO=$DISTRO |
| 70 | DEPLOY_SCENARIO=$DEPLOY_SCENARIO |
| 71 | CI_LOOP=$CI_LOOP |
| 72 | STACK_TYPE=$STACK_TYPE |
| 73 | STACK_VERSION=$STACK_VERSION |
| 74 | PROMOTE_STACK=$PROMOTE_STACK |
Fatih Degirmenci | 24eaec5 | 2020-07-10 19:47:40 +0000 | [diff] [blame] | 75 | OFFLINE_INSTALLER_FILE=$OFFLINE_INSTALLER_FILE |
Prasad Mukhedkar | 4ed6166 | 2021-03-22 10:02:09 +0100 | [diff] [blame] | 76 | OFFLINE_XTESTING_FILE=$OFFLINE_XTESTING_FILE |
Fatih Degirmenci | 24eaec5 | 2020-07-10 19:47:40 +0000 | [diff] [blame] | 77 | BUILD_ARTIFACTS=$BUILD_ARTIFACTS |
| 78 | NORDIX_ARM_REPO=nordix-${STACK_TYPE} |
| 79 | NORDIX_ARTIFACT_URL=$NORDIX_ARTIFACT_URL |
Fatih Degirmenci | daf0965 | 2020-07-12 13:25:49 +0000 | [diff] [blame] | 80 | NORDIX_ENGINE_VERSION=$NORDIX_ENGINE_VERSION |
Fatih Degirmenci | 24eaec5 | 2020-07-10 19:47:40 +0000 | [diff] [blame] | 81 | EOF |
| 82 | |
Fatih Degirmenci | daf0965 | 2020-07-12 13:25:49 +0000 | [diff] [blame] | 83 | record_component_versions |
| 84 | |
Fatih Degirmenci | 24eaec5 | 2020-07-10 19:47:40 +0000 | [diff] [blame] | 85 | echo "Info : Release metadata" |
| 86 | echo "-------------------------------------------------------------------------" |
| 87 | cat "$RELEASE_METADATA_FILE" |
| 88 | echo "-------------------------------------------------------------------------" |
| 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: |