aboutsummaryrefslogtreecommitdiff
path: root/infra/build_specified_commit.py
diff options
context:
space:
mode:
authorLeo Neat <leosneat@gmail.com>2020-01-29 11:03:43 -0800
committerGitHub <noreply@github.com>2020-01-29 11:03:43 -0800
commit8ffc6db00c83e5f75e92b3c4c63c1924597711a1 (patch)
tree7cca59f92af682000c57be2e0b8ad5e926e8701f /infra/build_specified_commit.py
parent4dc4c0240f96105f2330a0fc1f5f321a6e796ddb (diff)
downloadoss-fuzz-8ffc6db00c83e5f75e92b3c4c63c1924597711a1.tar.gz
[Infra] CIFuzz pipeline complete. (#3281)
* Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Testing action build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working build * Working fuzzers with out error surface * Working fuzzers with out error surface * Working fuzzers with out error surface * Printing std err * Adding fuzzer timeout * Adding fuzzer timeout * Changing fuzzer timeout to fuzz time * Formatting and refactoring * Spelling in fuzz_target.py * Spelling in fuzz_target.py * Spelling in fuzz_target.py * Upload artifact fix * Upload artifact fix * Upload artifact fix * Upload artifact fix * Upload artifact fix * Upload artifact fix * Upload artifact fix * Refactoring error codes. * reverting helper.py * reverting helper.py * reverting helper.py * chaning method to static * moving cifuzz file * Jonathan changes * Oliver and Jonathan comments * Oliver and Jonathan comments * Oliver and Jonathan comments * Utils unit tests * Test formatting and documentation * Build fuzzer test added * Changed repo manager errors * Unit and integration tests complete * Jonathan comments pt.1 * Jonathan comments pt.1 * Jonathan comments pt.1 * adding cifuzz_test * Build fuzzer test completed * Run fuzzers test finished. * Removed SRC dependency * Jonathan comments pt.2 * Max comments pt.1 * Max comments pt.2 * removing log specified out stream * Max comments pt.3 * Adding OSS_FUZZ_HOME env var * Jonathan comments pt.3 * Formatting * Olivers comments * Jonathan comments
Diffstat (limited to 'infra/build_specified_commit.py')
-rw-r--r--infra/build_specified_commit.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/infra/build_specified_commit.py b/infra/build_specified_commit.py
index 3861f0a1a..a4f95eb67 100644
--- a/infra/build_specified_commit.py
+++ b/infra/build_specified_commit.py
@@ -21,8 +21,10 @@ import os
import collections
import re
import subprocess
+import sys
import helper
+import utils
BuildData = collections.namedtuple(
'BuildData', ['project_name', 'engine', 'sanitizer', 'architecture'])
@@ -50,7 +52,7 @@ def build_fuzzers_from_commit(commit, build_repo_manager, build_data):
'/src', build_repo_manager.repo_name))
-def detect_main_repo(project_name, repo_name=None, commit=None, src_dir='/src'):
+def detect_main_repo(project_name, repo_name=None, commit=None):
"""Checks a docker image for the main repo of an OSS-Fuzz project.
Note: The default is to use the repo name to detect the main repo.
@@ -62,20 +64,25 @@ def detect_main_repo(project_name, repo_name=None, commit=None, src_dir='/src'):
src_dir: The location of the projects source on the docker image.
Returns:
- The repo's origin, the repo's name.
+ The repo's origin, the repo's path.
"""
- # TODO: Add infra for non hardcoded '/src'.
+
if not repo_name and not commit:
print('Error: can not detect main repo without a repo_name or a commit.')
return None, None
if repo_name and commit:
print('Both repo name and commit specific. Using repo name for detection.')
- helper.build_image_impl(project_name)
+ # Change to oss-fuzz main directory so helper.py runs correctly.
+ utils.chdir_to_root()
+ if not helper.build_image_impl(project_name):
+ print('Error: building {} image failed.'.format(project_name),
+ file=sys.stderr)
+ return None, None
docker_image_name = 'gcr.io/oss-fuzz/' + project_name
command_to_run = [
'docker', 'run', '--rm', '-t', docker_image_name, 'python3',
- os.path.join(src_dir, 'detect_repo.py'), '--src_dir', src_dir
+ os.path.join('/src', 'detect_repo.py')
]
if repo_name:
command_to_run.extend(['--repo_name', repo_name])
@@ -111,5 +118,5 @@ def execute(command, location=None, check_result=False):
raise RuntimeError('Error: %s\n Command: %s\n Return code: %s\n Out: %s' %
(err, command, process.returncode, out))
if out is not None:
- out = out.decode('ascii')
+ out = out.decode('ascii').rstrip()
return out, process.returncode