-
Notifications
You must be signed in to change notification settings - Fork 367
fix(ci): Clean up GH environment so there is more disk space for workflows #1108
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| name: Initialize Environment | ||
|
|
||
| description: Initialization steps for kagent actions | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Cancel Previous Actions | ||
| uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1 | ||
| with: | ||
| access_token: ${{ github.token }} | ||
inFocus7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Free disk space | ||
| shell: bash | ||
| run: | | ||
| echo "Before clearing disk space:" | ||
| df -h | ||
| docker system df -v | ||
|
|
||
| # https://github.com/actions/runner-images/discussions/3242 github runners are bad at cleanup | ||
| echo "Removing large packages" | ||
| sudo apt-get remove -y '^dotnet-.*' || true | ||
| sudo apt-get remove -y '^llvm-.*' || true | ||
| sudo apt-get remove -y 'php.*' || true | ||
| sudo apt-get remove -y '^mongodb-.*' || true | ||
| sudo apt-get remove -y '^mysql-.*' || true | ||
| sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri || true | ||
| sudo apt-get autoremove -y || true | ||
| sudo apt-get clean -y || true | ||
| echo "Done removing large packages" | ||
|
|
||
| # Clean up pre-installed tools | ||
| # For some reason, GHA often takes minutes (up to 20min observed) to clean up somehow. | ||
| # Presumably this is due to a slow disk? | ||
| function clean-dir() { | ||
| echo "Cleaning $1" | ||
| time sudo rm -rf "$1" || true | ||
| } | ||
| # These two were found to take very very long. Even though its large, its not worth the cost | ||
| # clean-dir /usr/local/lib/android # 8.9gb | ||
| # clean-dir $AGENT_TOOLSDIRECTORY # 5.6gb | ||
| clean-dir /usr/share/dotnet # 3.4gb | ||
| clean-dir /usr/share/swift # 3.1gb | ||
| clean-dir /usr/local/.ghcup # 6.3gb | ||
| clean-dir /usr/local/share/powershell # 1.2gb | ||
| clean-dir /usr/local/share/chromium # 600mb | ||
inFocus7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Clean up images | ||
| docker image rm node:18 || true | ||
| docker image rm node:18-alpine || true | ||
| docker image rm node:20 || true | ||
| docker image rm node:20-alpine || true | ||
| # remove the dangling images and containers | ||
| docker images | tail -n +2 | awk '$1 == "<none>" {print $3}' | xargs --no-run-if-empty docker rmi | ||
| docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $1}' | xargs --no-run-if-empty docker rm --volumes=true | ||
inFocus7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Clean up Docker | ||
| docker system prune -f || true | ||
|
|
||
| echo "After clearing disk space:" | ||
| df -h | ||
| docker system df -v | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -8,7 +8,8 @@ WORKDIR /app | |||
| # Install system dependencies | ||||
| RUN apt-get update && apt-get install -y \ | ||||
| build-essential \ | ||||
| && rm -rf /var/lib/apt/lists/* | ||||
| && rm -rf /var/lib/apt/lists/* \ | ||||
| && apt-get clean | ||||
|
||||
| && apt-get clean |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,7 +8,8 @@ WORKDIR /app | |||||||
| # Install system dependencies | ||||||||
| RUN apt-get update && apt-get install -y \ | ||||||||
| build-essential \ | ||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||
| && rm -rf /var/lib/apt/lists/* \ | ||||||||
| && apt-get clean | ||||||||
|
|
||||||||
|
Comment on lines
+11
to
13
|
||||||||
| && rm -rf /var/lib/apt/lists/* \ | |
| && apt-get clean | |
| && rm -rf /var/lib/apt/lists/* |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,7 +8,8 @@ WORKDIR /app | |||||||
| # Install system dependencies | ||||||||
| RUN apt-get update && apt-get install -y \ | ||||||||
| build-essential \ | ||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||
| && rm -rf /var/lib/apt/lists/* \ | ||||||||
| && apt-get clean | ||||||||
|
|
||||||||
|
Comment on lines
+11
to
13
|
||||||||
| && rm -rf /var/lib/apt/lists/* \ | |
| && apt-get clean | |
| && rm -rf /var/lib/apt/lists/* |
Uh oh!
There was an error while loading. Please reload this page.