Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame^] | 1 | #!/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. |
| 17 | set_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 | } |
| 25 | if [ -f "$WORKSPACE/env" ]; then |
| 26 | source "$WORKSPACE/env" 2>/dev/null || true |
| 27 | fi |
| 28 | |
| 29 | if [ -z "$CI_ROOT" ] && [ -d "$WORKSPACE/platform-ci" ]; then |
| 30 | set_ci_root |
| 31 | CI_ROOT=$ci_root |
| 32 | fi |
| 33 | |
| 34 | if [ -z "$CI_ROOT" ]; then |
| 35 | echo "warning: couldn't not determine value for \$CI_ROOT" |
| 36 | fi |