Skip to content

Commit

Permalink
Free up storage in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Sivanantham Chinnaiyan <[email protected]>
  • Loading branch information
sivanantha321 committed Feb 5, 2024
1 parent 6f4b7a9 commit 0dcd103
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/actions/free-up-disk-space/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,44 @@ runs:
docker image prune -a -f
docker system df
df -h
# - name: Free space using action easimon/maximize-build-space@master
# uses: easimon/maximize-build-space@master
# with:
# root-reserve-mb: 4096
# remove-dotnet: 'true'
# remove-android: 'true'
# remove-haskell: 'true'
# remove-codeql: 'true'
# remove-docker-images: 'true'

- name: Free space
shell: bash
run: |
df -Th
- name: Change docker data directory
shell: bash
run: |
DOCKER_ROOT_DIR=/mnt/docker
sudo mkdir -p "$DOCKER_ROOT_DIR"
# Check if the file exists and contains JSON data
if [ -f /etc/docker/daemon.json ]; then
# Check if the file is empty
if [ -s /etc/docker/daemon.json ]; then
# Append the new configuration to existing JSON data
jq --arg docker_root_dir "$DOCKER_ROOT_DIR" '. + {"data-root": $docker_root_dir}' /etc/docker/daemon.json | sudo tee /etc/docker/daemon.json > /dev/null
else
# If the file is empty, just write the new configuration
echo "{\"data-root\": \"$DOCKER_ROOT_DIR\"}" | sudo tee /etc/docker/daemon.json > /dev/null
fi
else
# If the file doesn't exist, create it and write the new configuration
echo "{\"data-root\": \"$DOCKER_ROOT_DIR\"}" | sudo tee /etc/docker/daemon.json > /dev/null
fi
echo "Modified docker configuration:"
cat /etc/docker/daemon.json
echo "Restarting docker"
sudo systemctl restart docker
echo "Docker root dir"
docker info -f '{{ .DockerRootDir}}'
4 changes: 3 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [master, release*]
paths:
- "**"
- "!.github/**"
# - "!.github/**"
- "!docs/**"
- "!**.md"
- ".github/workflows/e2e-test.yml"
Expand Down Expand Up @@ -457,6 +457,8 @@ jobs:
needs:
[kserve-image-build, predictor-runtime-build, explainer-runtime-build]
steps:
- name: Free-up disk space
uses: ./.github/actions/free-up-disk-space
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/freeup-space.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Free up storage space

on:
pull_request:

jobs:
freeup-storage:
runs-on: ubuntu-latest
steps:
- name: Before cleanup
run: |
df -Th
- name: checkout
uses: actions/checkout@v4

- name: free up storage
uses: ./github/actions/free-up-disk-space

- name: After cleanup
run: |
sf -Th

0 comments on commit 0dcd103

Please sign in to comment.