diff options
author | jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> | 2021-03-12 07:27:07 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-12 07:27:07 -0800 |
commit | 3465403f3066d41641109aab7d2ab52b5b8ea603 (patch) | |
tree | b9f86191eeed5d4a9bafd389d201495c5b7308e9 /infra/cifuzz/run_fuzzers_entrypoint.py | |
parent | 5a00fd347ee44eec4737c322619a2c39c084db15 (diff) | |
download | oss-fuzz-3465403f3066d41641109aab7d2ab52b5b8ea603.tar.gz |
[CIFuzz] Add functionality to save diskspace (#5342)
* [CIFuzz] Add functionality to save diskspace.
Add a LOW_DISK_SPACE env/config var. When this is specified
(always true for Github actions) run_fuzzers will delete
base-builder and the project builder image before fuzzing.
After it finishes fuzzing with a target, it will also
delete the targets, its seed corpus and its corpus.
Related: #4879
Diffstat (limited to 'infra/cifuzz/run_fuzzers_entrypoint.py')
-rw-r--r-- | infra/cifuzz/run_fuzzers_entrypoint.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/infra/cifuzz/run_fuzzers_entrypoint.py b/infra/cifuzz/run_fuzzers_entrypoint.py index f810e38f8..46e208dc0 100644 --- a/infra/cifuzz/run_fuzzers_entrypoint.py +++ b/infra/cifuzz/run_fuzzers_entrypoint.py @@ -11,11 +11,12 @@ # 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. -"""Runs specific OSS-Fuzz project's fuzzers for CI tools.""" +"""Runs a specific OSS-Fuzz project's fuzzers for CI tools.""" import logging import sys import config_utils +import docker import run_fuzzers # pylint: disable=c-extension-no-member @@ -26,6 +27,21 @@ logging.basicConfig( level=logging.DEBUG) +def delete_unneeded_docker_images(config): + """Deletes unneeded docker images if running in an environment with low + disk space.""" + if not config.low_disk_space: + return + logging.info('Deleting builder docker images to save disk space.') + project_image = docker.get_project_image_name(config.project_name) + images = [ + project_image, + docker.BASE_RUNNER_TAG, + docker.MSAN_LIBS_BUILDER_TAG, + ] + docker.delete_images(images) + + def main(): """Runs OSS-Fuzz project's fuzzers for CI tools. This is the entrypoint for the run_fuzzers github action. @@ -62,6 +78,7 @@ def main(): logging.error('This script needs to be run within Github actions.') return returncode + delete_unneeded_docker_images(config) # Run the specified project's fuzzers from the build. result = run_fuzzers.run_fuzzers(config) if result == run_fuzzers.RunFuzzersResult.ERROR: |