From 20c76da38e392570e00b3fd377218599ce4f1dd5 Mon Sep 17 00:00:00 2001 From: Liran BG Date: Mon, 26 Dec 2022 21:21:14 +0200 Subject: [PATCH] [CI] Reuse cleanup script (#2819) --- .github/workflows/build.yaml | 6 +- .github/workflows/system-tests-opensource.yml | 2 - .../scripts/github_workflow_free_space.sh | 23 ++++++-- automation/scripts/pypi_release_waiter.sh | 3 +- hack/ci/free-space.sh | 55 ------------------- 5 files changed, 24 insertions(+), 65 deletions(-) mode change 100644 => 100755 automation/scripts/github_workflow_free_space.sh delete mode 100755 hack/ci/free-space.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 58cb68b735..019b82b269 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -69,11 +69,11 @@ jobs: steps: - uses: actions/checkout@v3 - # since github-actions gives us 14G only, and fills it up with some garbage - # we will free up some space for our build process + # since github-actions gives us 14G only, and fills it up with some garbage - name: Freeing up disk space run: | - "${GITHUB_WORKSPACE}/hack/ci/free-space.sh" + "${GITHUB_WORKSPACE}/automation/scripts/github_workflow_free_space.sh" + - name: Install curl and jq run: sudo apt-get install curl jq - name: Extract git hash, ref and latest version diff --git a/.github/workflows/system-tests-opensource.yml b/.github/workflows/system-tests-opensource.yml index bc16112410..2d0276c492 100644 --- a/.github/workflows/system-tests-opensource.yml +++ b/.github/workflows/system-tests-opensource.yml @@ -77,10 +77,8 @@ jobs: -r dockerfiles/mlrun-api/requirements.txt -r extras-requirements.txt && pip install -e . # since github-actions gives us 14G only, and fills it up with some garbage - # we will free up some space for us (~2GB) - name: Freeing up disk space run: | - chmod +x "${GITHUB_WORKSPACE}/automation/scripts/github_workflow_free_space.sh" "${GITHUB_WORKSPACE}/automation/scripts/github_workflow_free_space.sh" # TODO: How can we avoid these duplicate lines from the enterprise system tests, up until line 120. diff --git a/automation/scripts/github_workflow_free_space.sh b/automation/scripts/github_workflow_free_space.sh old mode 100644 new mode 100755 index a684409ee5..d5783d8699 --- a/automation/scripts/github_workflow_free_space.sh +++ b/automation/scripts/github_workflow_free_space.sh @@ -22,16 +22,31 @@ print_free_space() { print_free_space # clean unneeded os packages and misc -sudo apt-get remove --yes '^dotnet-.*' 'php.*' azure-cli google-cloud-sdk google-chrome-stable firefox powershell +sudo apt-get remove -y '^ghc-8.*' +sudo apt-get remove -y '^dotnet-.*' +sudo apt-get remove -y '^llvm-.*' +sudo apt-get remove -y 'php.*' +sudo apt-get remove -y \ + azure-cli \ + google-cloud-sdk \ + google-chrome-stable \ + firefox \ + powershell \ + monodoc-http \ + mono-devel + sudo apt-get autoremove --yes sudo apt clean -# cleanup unneeded share dirs ~25GB +# cleanup unneeded share dirs ~30GB sudo rm --recursive --force \ /usr/local/lib/android \ /usr/share/dotnet \ - /usr/share/dotnet \ - /usr/share/swift + /usr/share/miniconda \ + /usr/share/swift \ + /opt/ghc \ + /usr/local/share/boost \ + "$AGENT_TOOLSDIRECTORY" # clean unneeded docker images docker system prune --all --force diff --git a/automation/scripts/pypi_release_waiter.sh b/automation/scripts/pypi_release_waiter.sh index ca7653d825..b3727006b5 100755 --- a/automation/scripts/pypi_release_waiter.sh +++ b/automation/scripts/pypi_release_waiter.sh @@ -1,3 +1,4 @@ +#!/bin/bash # Copyright 2018 Iguazio # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -#!/bin/bash + set -e version=$1 diff --git a/hack/ci/free-space.sh b/hack/ci/free-space.sh deleted file mode 100755 index 3c2e15c850..0000000000 --- a/hack/ci/free-space.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env sh -# Copyright 2018 Iguazio -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. - - -print_free_space() { - df --human-readable -} - -# before cleanup -print_free_space - -# clean unneeded os packages and misc -sudo apt-get remove -y '^ghc-8.*' -sudo apt-get remove -y '^dotnet-.*' -sudo apt-get remove -y '^llvm-.*' -sudo apt-get remove -y 'php.*' -sudo apt-get remove -y \ - azure-cli \ - google-cloud-sdk \ - google-chrome-stable \ - firefox \ - powershell \ - monodoc-http \ - mono-devel - -sudo apt-get autoremove --yes -sudo apt clean - -# cleanup unneeded share dirs ~30GB -sudo rm --recursive --force \ - /usr/local/lib/android \ - /usr/share/dotnet \ - /usr/share/miniconda \ - /usr/share/swift \ - /opt/ghc \ - /usr/local/share/boost \ - "$AGENT_TOOLSDIRECTORY" - -# clean unneeded docker images -docker system prune --all --force - -# post cleanup -print_free_space