mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
add caching
This commit is contained in:
@@ -5,42 +5,6 @@
|
||||
# debugging.
|
||||
set -ex
|
||||
|
||||
which docker 2> /dev/null 2> /dev/null
|
||||
if [ "$?" -eq "1" ]
|
||||
then
|
||||
echo 'Docker not found. Install it first.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
stat .git 2> /dev/null 2> /dev/null
|
||||
if [ "$?" -eq "1" ]
|
||||
then
|
||||
echo 'Run this inside the source directory. (.git dir not found).'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add trap to handle termination
|
||||
cleanup() {
|
||||
echo "Script received termination signal - cleaning up containers"
|
||||
# Get container ID if it exists
|
||||
if [[ -n "${CONTAINER_NAME:-}" ]]; then
|
||||
docker stop "${CONTAINER_NAME}" || echo "Failed to stop container (may not exist)"
|
||||
docker rm -f "${CONTAINER_NAME}" 2>/dev/null || echo "Failed to remove container (may not exist)"
|
||||
fi
|
||||
|
||||
# Find and stop any other build containers that might be running
|
||||
BUILD_CONTAINERS=$(docker ps -q --filter "name=xahaud_cached_builder")
|
||||
if [[ -n "$BUILD_CONTAINERS" ]]; then
|
||||
echo "Stopping other build containers: $BUILD_CONTAINERS"
|
||||
docker stop $BUILD_CONTAINERS || echo "Failed to stop some containers"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Set trap for common termination signals
|
||||
trap cleanup SIGINT SIGTERM INT TERM
|
||||
|
||||
echo "START BUILDING (HOST)"
|
||||
|
||||
echo "Cleaning previously built binary"
|
||||
@@ -66,10 +30,23 @@ echo "-- GITHUB_SHA: $GITHUB_SHA"
|
||||
echo "-- GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER"
|
||||
echo "-- CONTAINER_NAME: $CONTAINER_NAME"
|
||||
|
||||
which docker 2> /dev/null 2> /dev/null
|
||||
if [ "$?" -eq "1" ]
|
||||
then
|
||||
echo 'Docker not found. Install it first.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
stat .git 2> /dev/null 2> /dev/null
|
||||
if [ "$?" -eq "1" ]
|
||||
then
|
||||
echo 'Run this inside the source directory. (.git dir not found).'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STATIC_CONTAINER=$(docker ps -a | grep $CONTAINER_NAME |wc -l)
|
||||
|
||||
#if [[ "$STATIC_CONTAINER" -gt "0" && "$GITHUB_REPOSITORY" != "" ]]; then
|
||||
if false; then
|
||||
if [[ "$STATIC_CONTAINER" -gt "0" && "$GITHUB_REPOSITORY" != "" ]]; then
|
||||
echo "Static container, execute in static container to have max. cache"
|
||||
docker start $CONTAINER_NAME
|
||||
docker exec -i $CONTAINER_NAME /hbb_exe/activate-exec bash -x /io/build-core.sh "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$BUILD_CORES" "$GITHUB_RUN_NUMBER"
|
||||
|
||||
Reference in New Issue
Block a user