
This patch improves safe_copy_dir() and related functions: * clean up & simplify implementation * path sanity checks no longer depend on $PROJECT. * safe_copy_dir(): --chown: resolve user name to UID on host * safe_copy_dir(): interpret dest_dir as in "cp" command, but src_dir as in "rsync" Story: 2010226 Task: 46386 Signed-off-by: Davlet Panech <davlet.panech@windriver.com> Change-Id: I9428d9fceb50f78840fc9fb93e8a6a132425cddc
34 lines
799 B
Bash
Executable File
34 lines
799 B
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# Copyright (c) 2022 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
set -e
|
|
source $(dirname "$0")/lib/job_utils.sh
|
|
|
|
load_build_env
|
|
|
|
#VERBOSE_ARG="--verbose"
|
|
|
|
dir_is_empty() {
|
|
if [[ -d "$1" ]] ; then
|
|
[[ $(find "$1" -mindepth 1 -maxdepth 1 -print -quit | wc -l) -le 0 ]]
|
|
else
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
if ! dir_is_empty "$BUILD_HOME/workspace/helm-charts" ; then
|
|
if [[ ! -d "$BUILD_OUTPUT_HOME/workspace/helm-charts" ]] ; then
|
|
mkdir "$BUILD_OUTPUT_HOME/workspace/helm-charts"
|
|
fi
|
|
safe_copy_dir $DRY_RUN_ARG $VERBOSE_ARG --delete --chown "$USER:" \
|
|
"$BUILD_HOME/workspace/helm-charts/" \
|
|
"$BUILD_OUTPUT_HOME/workspace/helm-charts/"
|
|
|
|
notice "Helm charts archived in $BUILD_OUTPUT_HOME/workspace/helm-charts"
|
|
fi
|