• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""Module for dealing with docker."""
15import os
16import sys
17
18# pylint: disable=wrong-import-position,import-error
19sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
20
21import utils
22
23BASE_BUILDER_TAG = 'gcr.io/oss-fuzz-base/base-builder'
24BASE_RUNNER_TAG = 'gcr.io/oss-fuzz-base/base-runner'
25MSAN_LIBS_BUILDER_TAG = 'gcr.io/oss-fuzz-base/msan-libs-builder'
26PROJECT_TAG_PREFIX = 'gcr.io/oss-fuzz/'
27
28
29def get_project_image_name(project):
30  """Returns the name of the project builder image for |project_name|."""
31  return PROJECT_TAG_PREFIX + project
32
33
34def delete_images(images):
35  """Deletes |images|."""
36  command = ['docker', 'rmi', '-f'] + images
37  utils.execute(command)
38  utils.execute(['docker', 'builder', 'prune', '-f'])
39