blob: 02741b31562fb7b61926c29cac50be9466a41805 [file] [log] [blame]
Fathi Boudra422bf772019-12-02 11:10:16 +02001#!/bin/bash
2#
3# Copyright (c) 2019, Arm Limited. All rights reserved.
4#
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