2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 Ericsson and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 #----------------------------------------------------------------------
12 # This script is used by CI and executed by Jenkins jobs.
13 # You are not supposed to use this script manually if you don't know
15 #----------------------------------------------------------------------
17 # ensure GERRIT_TOPIC is set
18 GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
20 # skip the healthcheck if the patch doesn't impact the deployment
21 if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
22 echo "Skipping the healthcheck!"
26 # fail if promotion metadata file doesn't exist
27 if [ ! -f $LOCAL_PROMOTION_METADATA_FILE ]; then
28 echo "Unable to find promotion metadata file $LOCAL_PROMOTION_METADATA_FILE"
29 echo "Skipping promotion!"
33 # put additional info into the metadata file so we can use that for displaying the information
34 echo "PROMOTED_BY=$BUILD_URL" >> $LOCAL_PROMOTION_METADATA_FILE
35 echo "PROMOTED_ON=$(date -u '+%F_%H:%M'UTC)" >> $LOCAL_PROMOTION_METADATA_FILE
37 # upload promotion metadata file to OPNFV artifact repo
38 echo "Storing promotion metadata as $REMOTE_PROMOTION_METADATA_FILE"
39 gsutil cp $LOCAL_PROMOTION_METADATA_FILE $REMOTE_PROMOTION_METADATA_FILE > /dev/null 2>&1
41 # update the file metadata on gs to prevent the use of cached version of the file
42 gsutil -m setmeta -r -h "Content-Type:text/html" \
43 -h "Cache-Control:private, max-age=0, no-transform" \
44 $REMOTE_PROMOTION_METADATA_FILE > /dev/null 2>&1
46 # log the metadata to console
47 echo "Stored the metadata for $DEPLOY_SCENARIO"
48 echo "---------------------------------------------------------------------------------"
49 gsutil cat $REMOTE_PROMOTION_METADATA_FILE
50 echo "---------------------------------------------------------------------------------"
51 echo "Scenario $DEPLOY_SCENARIO has successfully been promoted!"