Skip to content

Commit

Permalink
Merge pull request #120 from aiyengar2/use_temp_dir_for_pulling_scripts
Browse files Browse the repository at this point in the history
Use a temporary directory for pulling scripts instead of building in the repo itself
  • Loading branch information
rohitsakala authored Oct 20, 2023
2 parents 3dd99c1 + 3b25478 commit 4646942
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions templates/template/scripts/pull-scripts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,27 @@ if ! [[ -f bin/charts-build-scripts ]] || [[ $(cat bin/charts-build-scripts) ==

# Fall back to old process
echo "Building binary locally..."
rm -rf charts-build-scripts

# Building in a temporary directory
CURR_DIR=$(pwd)
TEMP_DIR=$(mktemp -d)
cd $TEMP_DIR
echo ${TEMP_DIR}
cleanup() {
set +e
cd ${CURR_DIR}
[[ -n "${TEMP_DIR}" ]] && [[ -d "${TEMP_DIR}" ]] && rm -rf ${TEMP_DIR}
}
trap 'cleanup' EXIT

git clone --depth 1 --branch $CHARTS_BUILD_SCRIPT_VERSION $CHARTS_BUILD_SCRIPTS_REPO 2>/dev/null

cd charts-build-scripts
VERSION_OVERRIDE=${CHARTS_BUILD_SCRIPT_VERSION} ./scripts/build
mv bin ..
cd ..
rm -rf charts-build-scripts
mv bin/charts-build-scripts ${CURR_DIR}/bin/charts-build-scripts

# Return to original directory
cd ${CURR_DIR}
else
echo "${BINARY_NAME} => ./bin/charts-build-scripts"
fi
Expand Down

0 comments on commit 4646942

Please sign in to comment.