def __init__(self): """Get the configuration from CIFuzz from the environment. These variables are set by GitHub or the user.""" super().__init__() self.commit_sha = self._ci_env.git_sha event = os.getenv('GITHUB_EVENT_NAME') self.pr_ref = None self.git_url = None self.base_commit = None self._get_config_from_event_path(event) self.base_ref = os.getenv('GITHUB_BASE_REF') self.project_src_path = self._ci_env.project_src_path self.allowed_broken_targets_percentage = os.getenv( 'ALLOWED_BROKEN_TARGETS_PERCENTAGE') self.bad_build_check = environment.get_bool('BAD_BUILD_CHECK', True) # pylint: disable=consider-using-ternary self.keep_unaffected_fuzz_targets = ( # Not from a commit or PR. (not self.base_ref and not self.base_commit) or environment.get_bool('KEEP_UNAFFECTED_FUZZERS')) self.upload_build = environment.get_bool('UPLOAD_BUILD', False) if self.upload_build: logging.info('Keeping all fuzzers because we are uploading build.') self.keep_unaffected_fuzz_targets = True
def __init__(self): """Get the configuration from CIFuzz from the environment. These variables are set by GitHub or the user.""" super().__init__() self.git_sha = self.platform_conf.git_sha self.git_url = self.platform_conf.git_url self.allowed_broken_targets_percentage = os.getenv( 'ALLOWED_BROKEN_TARGETS_PERCENTAGE') self.bad_build_check = environment.get_bool('BAD_BUILD_CHECK', True) self.keep_unaffected_fuzz_targets = environment.get_bool( 'KEEP_UNAFFECTED_FUZZERS') self.upload_build = environment.get_bool('UPLOAD_BUILD', False) if not self.keep_unaffected_fuzz_targets: has_base_for_diff = (self.base_ref or self.base_commit) if not has_base_for_diff: logging.info( 'Keeping all fuzzers because there is nothing to diff against.' ) self.keep_unaffected_fuzz_targets = True elif self.upload_build: logging.info( 'Keeping all fuzzers because we are uploading build.') self.keep_unaffected_fuzz_targets = True elif self.sanitizer == 'coverage': logging.info( 'Keeping all fuzzers because we are doing coverage.') self.keep_unaffected_fuzz_targets = True if self.sanitizer == 'coverage': self.bad_build_check = False
def __init__(self): """Get the configuration from CIFuzz from the environment. These variables are set by GitHub or the user.""" # TODO(metzman): Some of this config is very CI-specific. Move it into the # CI class. super().__init__() self.commit_sha = os.getenv('GITHUB_SHA') event = os.getenv('GITHUB_EVENT_NAME') self.pr_ref = None self.git_url = None self.base_commit = None self._get_config_from_event_path(event) self.base_ref = os.getenv('GITHUB_BASE_REF') self.project_src_path = get_project_src_path(self.workspace, self.is_github) self.allowed_broken_targets_percentage = os.getenv( 'ALLOWED_BROKEN_TARGETS_PERCENTAGE') self.bad_build_check = environment.get_bool('BAD_BUILD_CHECK', True) # pylint: disable=consider-using-ternary self.keep_unaffected_fuzz_targets = ( # Not from a commit or PR. (not self.base_ref and not self.base_commit) or environment.get_bool('KEEP_UNAFFECTED_FUZZERS'))
def __init__(self): # Need to set these before calling self.platform. self._github_event_path = os.getenv('GITHUB_EVENT_PATH') self.is_github = bool(self._github_event_path) logging.debug('Is github: %s.', self.is_github) self.oss_fuzz_project_name = os.getenv('OSS_FUZZ_PROJECT_NAME') self._ci_env = _get_ci_environment(self.platform) self.workspace = self._ci_env.workspace self.project_repo_owner, self.project_repo_name = ( self._ci_env.project_repo_owner_and_name) # Check if failures should not be reported. self.dry_run = _is_dry_run() self.sanitizer = _get_sanitizer() self.build_integration_path = ( constants.DEFAULT_EXTERNAL_BUILD_INTEGRATION_PATH) self.language = _get_language() self.low_disk_space = environment.get_bool('LOW_DISK_SPACE', False) self.token = self._ci_env.token self.git_store_repo = os.environ.get('GIT_STORE_REPO') self.git_store_branch = os.environ.get('GIT_STORE_BRANCH') self.git_store_branch_coverage = os.environ.get('GIT_STORE_BRANCH_COVERAGE', self.git_store_branch) self.upload_build = environment.get_bool('UPLOAD_BUILD', False) # TODO(metzman): Fix tests to create valid configurations and get rid of # CIFUZZ_TEST here and in presubmit.py. if not os.getenv('CIFUZZ_TEST') and not self.validate(): raise ConfigError('Invalid Configuration.')
def __init__(self): """Get the configuration from CIFuzz from the environment. These variables are set by GitHub or the user.""" # TODO(metzman): Some of this config is very CI-specific. Move it into the # CI class. super().__init__() self.commit_sha = os.getenv('GITHUB_SHA') event = os.getenv('GITHUB_EVENT_NAME') self.pr_ref = None self.git_url = None self.base_commit = None self._get_config_from_event_path(event) self.base_ref = os.getenv('GITHUB_BASE_REF') self.project_src_path = get_project_src_path(self.workspace) self.allowed_broken_targets_percentage = os.getenv( 'ALLOWED_BROKEN_TARGETS_PERCENTAGE') self.bad_build_check = environment.get_bool('BAD_BUILD_CHECK', 'true') # TODO(metzman): Use better system for interpreting env vars. What if env # var is set to '0'? self.keep_unaffected_fuzz_targets = bool( os.getenv('KEEP_UNAFFECTED_FUZZERS'))
def __init__(self): self.workspace = os.getenv('GITHUB_WORKSPACE') self.oss_fuzz_project_name = os.getenv('OSS_FUZZ_PROJECT_NAME') self.project_repo_owner, self.project_repo_name = ( _get_project_repo_owner_and_name()) # Check if failures should not be reported. self.dry_run = _is_dry_run() self.sanitizer = _get_sanitizer() self.build_integration_path = os.getenv('BUILD_INTEGRATION_PATH') self.language = _get_language() event_path = os.getenv('GITHUB_EVENT_PATH') self.is_github = bool(event_path) logging.debug('Is github: %s.', self.is_github) self.low_disk_space = environment.get_bool('LOW_DISK_SPACE', False) self.github_token = os.environ.get('GITHUB_TOKEN') self.git_store_repo = os.environ.get('GIT_STORE_REPO') self.git_store_branch = os.environ.get('GIT_STORE_BRANCH') self.git_store_branch_coverage = os.environ.get( 'GIT_STORE_BRANCH_COVERAGE', self.git_store_branch) # TODO(metzman): Fix tests to create valid configurations and get rid of # CIFUZZ_TEST here and in presubmit.py. if not self.validate() and not os.getenv('CIFUZZ_TEST'): raise ConfigurationError('Invalid Configuration.')
def __init__(self): self.workspace = os.getenv('GITHUB_WORKSPACE') self.oss_fuzz_project_name = os.getenv('OSS_FUZZ_PROJECT_NAME') self.project_repo_owner, self.project_repo_name = ( _get_project_repo_owner_and_name()) # Check if failures should not be reported. self.dry_run = _is_dry_run() self.sanitizer = _get_sanitizer() # TODO(ochang): Error out if both oss_fuzz and build_integration_path is not # set. self.build_integration_path = os.getenv('BUILD_INTEGRATION_PATH') self.language = _get_language() event_path = os.getenv('GITHUB_EVENT_PATH') self.is_github = bool(event_path) logging.debug('Is github: %s.', self.is_github) self.low_disk_space = environment.get_bool('LOW_DISK_SPACE', False) self.github_token = os.environ.get('GITHUB_TOKEN') self.git_store_repo = os.environ.get('GIT_STORE_REPO') self.git_store_branch = os.environ.get('GIT_STORE_BRANCH') self.git_store_branch_coverage = os.environ.get( 'GIT_STORE_BRANCH_COVERAGE', self.git_store_branch)
def __init__(self): super().__init__() # TODO(metzman): Pick a better default for pruning. self.fuzz_seconds = int(os.environ.get('FUZZ_SECONDS', 600)) self.mode = os.environ.get('MODE', 'code-change').lower() if self.is_coverage: self.mode = 'coverage' self.report_unreproducible_crashes = environment.get_bool( 'REPORT_UNREPRODUCIBLE_CRASHES', False) self.report_timeouts = environment.get_bool('REPORT_TIMEOUTS', False) self.report_ooms = environment.get_bool('REPORT_OOMS', True) # TODO(metzman): Fix tests to create valid configurations and get rid of # CIFUZZ_TEST here and in presubmit.py. if not os.getenv('CIFUZZ_TEST') and not self._run_config_validate(): raise ConfigError('Invalid Run Configuration.')
def __init__(self): # Need to set these before calling self.platform. self.oss_fuzz_project_name = os.getenv('OSS_FUZZ_PROJECT_NAME') self.cfl_platform = os.getenv('CFL_PLATFORM') logging.debug('Is github: %s.', self.is_github) self.platform_conf = _get_platform_config(self.cfl_platform) self.base_commit = self.platform_conf.base_commit self.base_ref = self.platform_conf.base_ref self.pr_ref = self.platform_conf.pr_ref self.workspace = self.platform_conf.workspace self.project_src_path = self.platform_conf.project_src_path self.actor = self.platform_conf.actor self.token = self.platform_conf.token self.project_repo_owner = self.platform_conf.project_repo_owner self.project_repo_name = self.platform_conf.project_repo_name self.filestore = self.platform_conf.filestore # This determines if builds are done using docker in docker # rather than the normal method which is sibling containers. self.docker_in_docker = self.platform_conf.docker_in_docker self.dry_run = _is_dry_run( ) # Check if failures should not be reported. self.sanitizer = _get_sanitizer() self.language = _get_language() self.low_disk_space = environment.get_bool('LOW_DISK_SPACE', False) self.git_store_repo = os.environ.get('GIT_STORE_REPO') self.git_store_branch = os.environ.get('GIT_STORE_BRANCH') self.git_store_branch_coverage = os.environ.get( 'GIT_STORE_BRANCH_COVERAGE', self.git_store_branch) self.cloud_bucket = os.environ.get('CLOUD_BUCKET') self.no_clusterfuzz_deployment = environment.get_bool( 'NO_CLUSTERFUZZ_DEPLOYMENT', False) self.build_integration_path = ( constants.DEFAULT_EXTERNAL_BUILD_INTEGRATION_PATH) # TODO(metzman): Fix tests to create valid configurations and get rid of # CIFUZZ_TEST here and in presubmit.py. if not os.getenv('CIFUZZ_TEST') and not self.validate(): raise ConfigError('Invalid Configuration.')
def __init__(self): super().__init__() self.fuzz_seconds = int(os.environ.get('FUZZ_SECONDS', 600)) self.run_fuzzers_mode = os.environ.get('RUN_FUZZERS_MODE', 'ci').lower() if self.is_coverage: self.run_fuzzers_mode = 'coverage' if self.run_fuzzers_mode not in self.RUN_FUZZERS_MODES: raise Exception(( 'Invalid RUN_FUZZERS_MODE %s not one of allowed choices: %s.' % (self.run_fuzzers_mode, self.RUN_FUZZERS_MODES))) self.report_unreproducible_crashes = environment.get_bool( 'REPORT_UNREPRODUCIBLE_CRASHES', False)
def __init__(self): super().__init__() self.fuzz_seconds = int(os.environ.get('FUZZ_SECONDS', 600)) self.run_fuzzers_mode = os.environ.get('RUN_FUZZERS_MODE', 'ci').lower() if self.is_coverage: self.run_fuzzers_mode = 'coverage' self.report_unreproducible_crashes = environment.get_bool( 'REPORT_UNREPRODUCIBLE_CRASHES', False) # TODO(metzman): Fix tests to create valid configurations and get rid of # CIFUZZ_TEST here and in presubmit.py. if not os.getenv('CIFUZZ_TEST') and not self._run_config_validate(): raise ConfigError('Invalid Run Configuration.')
def _is_dry_run(): """Returns True if configured to do a dry run.""" return environment.get_bool('DRY_RUN', False)
def docker_in_docker(self): """Returns whether or not CFL is running using Docker in Docker.""" return environment.get_bool('DOCKER_IN_DOCKER', False)