diff --git a/infra/ci/build.py b/infra/ci/build.py index addeb7879..64523d132 100755 --- a/infra/ci/build.py +++ b/infra/ci/build.py @@ -239,6 +239,7 @@ def build_canary_project(): def main(): """Build modified projects or canary project.""" + os.environ['OSS_FUZZ_CI'] = '1' infra_changed = is_infra_changed() if infra_changed: print('Pulling and building base images first.') diff --git a/infra/helper.py b/infra/helper.py index 0123ee3ff..812e2d1c2 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -554,6 +554,8 @@ def build_fuzzers_impl( # pylint: disable=too-many-arguments,too-many-locals,to 'ARCHITECTURE=' + architecture, ] + _add_oss_fuzz_ci_if_needed(env) + if project_language: env.append('FUZZING_LANGUAGE=' + project_language) @@ -621,6 +623,13 @@ def build_fuzzers(args): args.source_path) +def _add_oss_fuzz_ci_if_needed(env): + """Adds value of |OSS_FUZZ_CI| environment variable to |env| if it is set.""" + oss_fuzz_ci = os.getenv('OSS_FUZZ_CI') + if oss_fuzz_ci: + env.append('OSS_FUZZ_CI=' + oss_fuzz_ci) + + def check_build(args): """Checks that fuzzers in the container execute without errors.""" if not check_project_exists(args.project_name): @@ -641,6 +650,7 @@ def check_build(args): 'ARCHITECTURE=' + args.architecture, 'FUZZING_LANGUAGE=' + fuzzing_language, ] + _add_oss_fuzz_ci_if_needed(env) if args.e: env += args.e