#!/bin/bash
# create_bamboo_sentinel_file.sh: Create a file to indicate all tests passed
# @copyright Highly Confidential and Proprietary Information. Copyright (c) Zoox.
#
# Date Created: July 30, 2020
# Author: agurusami
#
# This script looks at the parent directory it is in and uses that to create a unique sentinel file
# This script is necessary since the status of a job is not available in a variable
#
# Usage/Instructions:
# Copy template_create_bamboo_sentinel_file.sh to a ECU/Smoke/Feature test directory and rename
# it as create_bamboo_sentinel_file.sh (simply remove "template_")
#
# e.g. /firmware/validation/bbc_smoke/create_bamboo_sentinel_file.sh
#
# Make sure to create and enable the BBC (in this case, BBC Smoke) job within the Firmware Test
# Global plan in Bamboo

# Get name of parent directory
# First get the full path to where this script is stored
parent_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Next grab just the name of the directory
parent_dir_name=`basename $parent_path`

# Create the sentinel file with the name of the directory we're in, in it
touch $bamboo_build_working_directory/${parent_dir_name}_github.sentinel
