Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a temporary directory for pulling scripts instead of building in the repo itself #120

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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