blob: 88a89f54cc13907b03d5cd0e574f64fd75b22e82 [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
cd $WORKSPACE
# need to generate the identifier before writing it
if [[ "$CI_LOOP" == "verify" ]]; then
BUILD_IDENTIFIER=$GERRIT_CHANGE_NUMBER
ARTIFACT_ARM_FOLDER=gerrit
elif [[ "$CI_LOOP" == "periodic" ]]; then
BUILD_IDENTIFIER="$(date '+%Y%m%d%H%M')"
ARTIFACT_ARM_FOLDER=release
else
echo "Error : Unrecognized CI Loop $CI_LOOP"
exit 1
fi
echo "Info : Generating build metadata"
cat << EOF > "$WORKSPACE/build.properties"
BUILD_DATE=$(date '+%Y%m%d%H%M')
BUILT_BY=$BUILD_URL
BUILD_IDENTIFIER=$BUILD_IDENTIFIER
CI_LOOP=$CI_LOOP
ENGINE_SHA=$(git rev-parse HEAD)
NORDIX_ARTIFACT_URL=$NORDIX_ARM_HTTPS_URL/$NORDIX_ARM_REPO/installer/oss/$ARTIFACT_ARM_FOLDER/$BUILD_IDENTIFIER
EOF
echo "Info : Build metadata"
echo "-------------------------------------------------------------------------"
cat "$WORKSPACE/build.properties"
echo "-------------------------------------------------------------------------"