sccache on linux + deployment sizes
This commit is contained in:
parent
a67cbfe6d2
commit
55177548b0
5 changed files with 42 additions and 30 deletions
|
@ -78,7 +78,7 @@ RUN echo 'install buildkite' ;\
|
||||||
COPY *.sh /usr/local/bin/
|
COPY *.sh /usr/local/bin/
|
||||||
RUN chmod og+rx /usr/local/bin/*.sh
|
RUN chmod og+rx /usr/local/bin/*.sh
|
||||||
COPY --chown=buildkite-agent:buildkite-agent pre-checkout /etc/buildkite-agent/hooks
|
COPY --chown=buildkite-agent:buildkite-agent pre-checkout /etc/buildkite-agent/hooks
|
||||||
COPY --chown=buildkite-agent:buildkite-agent post-checkout /etc/buildkite-agent/hooks
|
# COPY --chown=buildkite-agent:buildkite-agent post-checkout /etc/buildkite-agent/hooks
|
||||||
|
|
||||||
# buildkite working directory
|
# buildkite working directory
|
||||||
VOLUME /var/lib/buildkite-agent
|
VOLUME /var/lib/buildkite-agent
|
||||||
|
|
|
@ -26,6 +26,14 @@ export CCACHE_MAXSIZE=20G
|
||||||
mkdir -p "${CCACHE_DIR}"
|
mkdir -p "${CCACHE_DIR}"
|
||||||
chown -R ${USER}:${USER} "${CCACHE_DIR}"
|
chown -R ${USER}:${USER} "${CCACHE_DIR}"
|
||||||
|
|
||||||
|
export SCCACHE_DIR="$BUILDKITE_BUILD_PATH/sccache"
|
||||||
|
export SCCACHE_IDLE_TIMEOUT="0"
|
||||||
|
rm -rf "$SCCACHE_DIR"
|
||||||
|
mkdir -p "${SCCACHE_DIR}"
|
||||||
|
chown -R ${USER}:${USER} "${SCCACHE_DIR}"
|
||||||
|
chmod oug+rw "${SCCACHE_DIR}"
|
||||||
|
gosu "$USER" bash -c 'env; whoami; SCCACHE_DIR="${SCCACHE_DIR}" SCCACHE_IDLE_TIMEOUT=0 SCCACHE_CACHE_SIZE=20G sccache --start-server'
|
||||||
|
|
||||||
# /mnt/ssh should contain known_hosts, id_rsa and id_rsa.pub .
|
# /mnt/ssh should contain known_hosts, id_rsa and id_rsa.pub .
|
||||||
mkdir -p /var/lib/buildkite-agent/.ssh
|
mkdir -p /var/lib/buildkite-agent/.ssh
|
||||||
if [ -d /mnt/ssh ]; then
|
if [ -d /mnt/ssh ]; then
|
||||||
|
@ -36,4 +44,5 @@ if [ -d /mnt/ssh ]; then
|
||||||
else
|
else
|
||||||
echo "/mnt/ssh is not mounted"
|
echo "/mnt/ssh is not mounted"
|
||||||
fi
|
fi
|
||||||
|
# Run with tini to correctly pass exit codes.
|
||||||
exec /usr/bin/tini -g -- $@
|
exec /usr/bin/tini -g -- $@
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
# Copyright 2021 Google LLC
|
|
||||||
#
|
|
||||||
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://llvm.org/LICENSE.txt
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# The `post-checkout` hook runs after checkout.
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# Run prune as git will start to complain "warning: There are too many unreachable loose objects; run 'git prune' to remove them.".
|
|
||||||
# That happens as we routinely drop old branches.
|
|
||||||
git prune
|
|
||||||
if [ -f ".git/gc.log" ]; then
|
|
||||||
echo ".git/gc.log exist"
|
|
||||||
cat ./.git/gc.log
|
|
||||||
rm -f ./.git/gc.log
|
|
||||||
fi
|
|
|
@ -16,8 +16,37 @@
|
||||||
# The `pre-checkout` hook will run just before your pipelines source code is
|
# The `pre-checkout` hook will run just before your pipelines source code is
|
||||||
# checked out from your SCM provider
|
# checked out from your SCM provider
|
||||||
|
|
||||||
set -e
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
# Convert https://github.com/llvm-premerge-tests/llvm-project.git -> llvm-project
|
# Convert https://github.com/llvm-premerge-tests/llvm-project.git -> llvm-project
|
||||||
# to use the same directory for fork and origin.
|
# to use the same directory for fork and origin.
|
||||||
BUILDKITE_BUILD_CHECKOUT_PATH="${BUILDKITE_BUILD_PATH}/$(echo $BUILDKITE_REPO | sed -E "s#.*/([^/]*)#\1#" | sed "s/.git$//")"
|
BUILDKITE_BUILD_CHECKOUT_PATH="${BUILDKITE_BUILD_PATH}/$(echo $BUILDKITE_REPO | sed -E "s#.*/([^/]*)#\1#" | sed "s/.git$//")"
|
||||||
|
gc_counter="$BUILDKITE_BUILD_PATH/git_gc_counter"
|
||||||
|
echo "BUILDKITE_REPO: $BUILDKITE_REPO"
|
||||||
|
if [ -d "$BUILDKITE_BUILD_CHECKOUT_PATH" ]; then
|
||||||
|
cd "$BUILDKITE_BUILD_CHECKOUT_PATH" || exit
|
||||||
|
remoteUrl=$(git remote get-url origin)
|
||||||
|
echo "current remote URL: $remoteUrl"
|
||||||
|
if [ "$remoteUrl" != "$BUILDKITE_REPO" ]; then
|
||||||
|
echo "Remote URL does not match. Deleting and recreating the directory."
|
||||||
|
cd /c/
|
||||||
|
rm -rf "$BUILDKITE_BUILD_CHECKOUT_PATH"
|
||||||
|
rm -rf "$gc_counter"
|
||||||
|
else
|
||||||
|
# Run git gc from time to time to prevent repo from growing.
|
||||||
|
echo -n "x" >> "$gc_counter"
|
||||||
|
echo "GC counter $(wc -c < "$gc_counter")/20"
|
||||||
|
if [ "$(wc -c < "$gc_counter")" -gt 20 ]; then
|
||||||
|
echo "Running 'git gc'..."
|
||||||
|
git gc
|
||||||
|
git prune
|
||||||
|
if [ -f ".git/gc.log" ]; then
|
||||||
|
echo ".git/gc.log exist"
|
||||||
|
cat ./.git/gc.log
|
||||||
|
rm -f ./.git/gc.log
|
||||||
|
fi
|
||||||
|
rm -rf "$gc_counter"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
|
@ -17,7 +17,7 @@ kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: windows-buildkite
|
name: windows-buildkite
|
||||||
spec:
|
spec:
|
||||||
replicas: 8
|
replicas: 6
|
||||||
strategy:
|
strategy:
|
||||||
type: Recreate
|
type: Recreate
|
||||||
selector:
|
selector:
|
||||||
|
|
Loading…
Reference in a new issue