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

ci: Implement cleanup for jobs #1048

Merged
merged 1 commit into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
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
40 changes: 16 additions & 24 deletions .github/build.yaml.gomplate
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,34 @@
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
{{{- if not $config.local_runner }}}
- name: Release space from worker
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
{{{- end }}}
{{{ tmpl.Exec "runner_cleanup" }}}
- name: Install CI plugins
run: |
sudo cp -rfv .github/plugins/* /usr/bin/
{{{ end }}}

{{{define "prepare_build" }}}
{{{define "runner_cleanup" }}}
{{{ $config := (datasource "config") }}}
- name: Release space from worker ♻
if: always()
run: |
{{{- if $config.local_runner }}}
- run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
{{{- else }}}
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
{{{- end }}}
{{{ end }}}

{{{define "prepare_build" }}}
{{{ $config := (datasource "config") }}}
{{{ tmpl.Exec "runner_cleanup" }}}

{{{- if $config.local_runner }}}
{{{ $arch := $config.arch }}}
Expand Down Expand Up @@ -107,11 +113,6 @@
FLAVOR: {{{ $flavor }}}
ARCH: {{{ $config.arch }}}
steps:
{{{- if $config.local_runner }}}
- run: |
sudo rm -rf build || true
sudo rm -rf bin || true
{{{- end }}}
{{{ tmpl.Exec "prepare_worker" }}}
- name: Build 🔧
shell: 'script -q -e -c "bash {0}"'
Expand Down Expand Up @@ -186,6 +187,7 @@
name: build-{{{ $flavor }}}-{{{ $config.arch }}}
path: build
if-no-files-found: error
{{{ tmpl.Exec "runner_cleanup" }}}
{{{end}}}

{{{define "build_iso"}}}
Expand Down Expand Up @@ -702,12 +704,7 @@
{{{- end }}}

steps:
{{{- if $config.local_runner }}}
- name: Cleanup
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
{{{- end }}}
{{{ tmpl.Exec "runner_cleanup" }}}
- name: Install OS deps
run: |
sudo apt-get update
Expand Down Expand Up @@ -908,11 +905,6 @@
{{{ tmpl.Exec "runner" }}}
{{{tmpl.Exec "if_with_labels" }}}
steps:
{{{- if $config.local_runner }}}
- run: |
sudo rm -rf build || true
sudo rm -rf bin || true
{{{- end }}}
{{{ tmpl.Exec "prepare_worker" }}}
{{{ tmpl.Exec "prepare_build" }}}
{{{ tmpl.Exec "make" "deps" }}}
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/build-examples-green-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ jobs:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Release space from worker
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- name: Install CI plugins
run: |
sudo cp -rfv .github/plugins/* /usr/bin/
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- name: Install Go
uses: actions/setup-go@v2
with:
Expand Down Expand Up @@ -56,13 +62,19 @@ jobs:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Release space from worker
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- name: Install CI plugins
run: |
sudo cp -rfv .github/plugins/* /usr/bin/
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- name: Install Go
uses: actions/setup-go@v2
with:
Expand Down Expand Up @@ -90,13 +102,19 @@ jobs:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Release space from worker
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- name: Install CI plugins
run: |
sudo cp -rfv .github/plugins/* /usr/bin/
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- name: Install Go
uses: actions/setup-go@v2
with:
Expand Down
40 changes: 38 additions & 2 deletions .github/workflows/build-master-blue-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ jobs:
# For non x86_64 archs, skip the *-fips build as there are no golang releases in other arches
SKIP_PACKAGES: "build/golang-fips toolchain-fips/yip toolchain-fips/luet-makeiso toolchain-fips/luet live/syslinux live/systemd-boot live/boot"
steps:
- run: |
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
- name: Install Go
run: |
curl -L https://golang.org/dl/go1.17.5.linux-arm64.tar.gz -o go1.17.5.linux-arm64.tar.gz
Expand All @@ -39,6 +42,16 @@ jobs:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
- name: Install CI plugins
run: |
sudo cp -rfv .github/plugins/* /usr/bin/
Expand Down Expand Up @@ -82,6 +95,16 @@ jobs:
name: build-blue-arm64
path: build
if-no-files-found: error
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
image-link-blue:
runs-on: ubuntu-latest
needs: publish-blue
Expand Down Expand Up @@ -119,13 +142,16 @@ jobs:
PUBLISH_ARGS: "--plugin luet-cosign"
COSIGN_FULCIO_URL: "https://v1.fulcio.sigstore.dev"
steps:
- run: |
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
- name: Install Go
run: |
curl -L https://golang.org/dl/go1.17.5.linux-arm64.tar.gz -o go1.17.5.linux-arm64.tar.gz
Expand All @@ -137,6 +163,16 @@ jobs:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
- name: Install CI plugins
run: |
sudo cp -rfv .github/plugins/* /usr/bin/
Expand Down
40 changes: 38 additions & 2 deletions .github/workflows/build-master-blue-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ jobs:
PUSH_CACHE: true
REPO_CACHE: quay.io/costoolkit/build-blue-cache
steps:
- run: |
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
- name: Install Go
run: |
curl -L https://golang.org/dl/go1.17.5.linux-amd64.tar.gz -o go1.17.5.linux-amd64.tar.gz
Expand All @@ -37,6 +40,16 @@ jobs:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
- name: Install CI plugins
run: |
sudo cp -rfv .github/plugins/* /usr/bin/
Expand Down Expand Up @@ -80,6 +93,16 @@ jobs:
name: build-blue-x86_64
path: build
if-no-files-found: error
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
image-link-blue:
runs-on: ubuntu-latest
needs: publish-blue
Expand Down Expand Up @@ -117,13 +140,16 @@ jobs:
PUBLISH_ARGS: "--plugin luet-cosign"
COSIGN_FULCIO_URL: "https://v1.fulcio.sigstore.dev"
steps:
- run: |
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
- name: Install Go
run: |
curl -L https://golang.org/dl/go1.17.5.linux-amd64.tar.gz -o go1.17.5.linux-amd64.tar.gz
Expand All @@ -135,6 +161,16 @@ jobs:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Release space from worker ♻
if: always()
run: |
sudo rm -rf build || true
sudo rm -rf bin || true
sudo rm /usr/bin/luet || true
sudo rm -Rf /etc/luet/ || true
sudo rm -Rf /var/tmp/luet || true
sudo rm -Rf /var/luet || true
docker system prune -f -a --volumes || true
- name: Install CI plugins
run: |
sudo cp -rfv .github/plugins/* /usr/bin/
Expand Down
Loading