From: Trevor Bramwell Date: Thu, 28 Jan 2021 17:53:35 +0000 (-0800) Subject: Skip Metadata Capture on unsupported Clouds X-Git-Tag: v0.61.0~5 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=86f276e966e01b037d96a1a87cb6ad1fce18f7cc;p=releng%2Fglobal-jjb.git Skip Metadata Capture on unsupported Clouds Updates the 'capture-instance-metadata.sh' script to skip attempting to capture instance metadata needed for job-cost.sh if the build is being run on an unsupported cloud or platform. Change-Id: I8bfea1416d11de1caeed2d414b90513f63de9b6f Signed-off-by: Trevor Bramwell --- diff --git a/releasenotes/notes/instance-metadata-skip-f80ccdd0a6c696e3.yaml b/releasenotes/notes/instance-metadata-skip-f80ccdd0a6c696e3.yaml new file mode 100644 index 00000000..6c0b0087 --- /dev/null +++ b/releasenotes/notes/instance-metadata-skip-f80ccdd0a6c696e3.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Updates the 'capture-instance-metadata.sh' script to skip attempting + to capture instance metadata needed for job-cost.sh if the build is + being run on an unsupported cloud or platform. diff --git a/shell/capture-instance-metadata.sh b/shell/capture-instance-metadata.sh index a5914ad9..c102d53c 100644 --- a/shell/capture-instance-metadata.sh +++ b/shell/capture-instance-metadata.sh @@ -17,6 +17,11 @@ if [ -n "${NOMAD_DC}" ]; then exit 0 fi +if [[ ! -f /run/cloud-init/result.json ]]; then + echo "INFO: Running in unsupported cloud, no metadata" + exit 0 +fi + # AWS not supported, exit cloudtype="$(jq -r .v1.datasource /run/cloud-init/result.json)" if [[ $cloudtype == "DataSourceEc2Local" ]]; then