
Improved the condition to handle environment variable in IF condition just to avoid failure in case environment variable is unset. Test-Plan: PASS - Run jenkins job to verify publish-log part. PASS - Check if package log file exists. Closes-bug: 2071355 Change-Id: Ic37bafd2388c448fc6633b9047f801b4305375a7 Signed-off-by: suyash <suyash.srivastava@windriver.com>
49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# Copyright (c) 2024 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
set -e
|
|
|
|
source $(dirname "$0")/lib/job_utils.sh
|
|
|
|
load_build_env
|
|
|
|
#Create Packages Directory.
|
|
mkdir -p "${PUBLISH_DIR}/logs/packages/"
|
|
|
|
# Function to copy .build and .log files from a list of directories to a target directory
|
|
copy_log_buildinfo() {
|
|
#Change to export directory.
|
|
package_type="$1"
|
|
if [ ! -d "${BUILD_OUTPUT_HOME}/workspace/$package_type" ];then
|
|
echo "Folder ${BUILD_OUTPUT_HOME}/workspace/$package_type not found"
|
|
echo "Not publishing logs for $package_type"
|
|
return
|
|
fi
|
|
#Change to workspace directory
|
|
cd "${BUILD_OUTPUT_HOME}/workspace/$package_type"
|
|
# Loop through each directory to find and copy the .buildinfo and .log files
|
|
for directory in $(find -mindepth 1 -maxdepth 1 -type d); do
|
|
target_directory="${PUBLISH_DIR}/logs/packages/$package_type/$directory"
|
|
if [ ! -d "${target_directory}" ]; then
|
|
mkdir -p "${target_directory}"
|
|
fi
|
|
find "$directory" -mindepth 1 -maxdepth 1 -type f \( -name '*.log' -o -name '*.build' \) -exec cp -a -t "$target_directory" {} +
|
|
done
|
|
}
|
|
|
|
build_types="std/"
|
|
if [ -n "$BUILD_RT" ]; then
|
|
build_types+=",rt/"
|
|
fi
|
|
|
|
IFS=',' read -r -a build_types_array <<< "$build_types"
|
|
|
|
for build_type in "${build_types_array[@]}"
|
|
do
|
|
copy_log_buildinfo "$build_type"
|
|
done |