blob: d5244c9221725cb68f48f66fed6f0b90ed4fa2d7 [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Leonardo Sandoval579c7372020-10-23 15:23:32 -05003# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
Fathi Boudra422bf772019-12-02 11:10:16 +02004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8# THIS SCRIPT IS SOURCED!
9#
10# This script exists only to obtain a meaningful value for $CI_ROOT, the root
11# directory for CI scripts, from which other post-build scripts are executed.
12# Normally, $CI_ROOT *would* be available via. environment injection, but if a job
13# failed in its early stages, it wouldn't.
14
15# Although env file is meant to be sourced, RHS might have white spaces in it,
16# so sourcing will fail.
17set_ci_root() {
18 if [ -d "platform-ci/trusted-fw/new-ci" ]
19 then
20 ci_root="platform-ci/trusted-fw/new-ci"
21 else
22 ci_root="platform-ci"
23 fi
24}
25if [ -f "$WORKSPACE/env" ]; then
26 source "$WORKSPACE/env" 2>/dev/null || true
27fi
28
29if [ -z "$CI_ROOT" ] && [ -d "$WORKSPACE/platform-ci" ]; then
30 set_ci_root
31 CI_ROOT=$ci_root
32fi
33
34if [ -z "$CI_ROOT" ]; then
35 echo "warning: couldn't not determine value for \$CI_ROOT"
36fi