Skip to content

Add support for FUZZ_TARGET_BUILD_BUCKET_PATH (#663)#676

Merged
oliverchang merged 10 commits into
masterfrom
builds-draft
Jul 17, 2019
Merged

Add support for FUZZ_TARGET_BUILD_BUCKET_PATH (#663)#676
oliverchang merged 10 commits into
masterfrom
builds-draft

Conversation

@oliverchang

@oliverchang oliverchang commented Jul 12, 2019

Copy link
Copy Markdown
Collaborator
  • Add support for using FUZZ_TARGET_BUILD_BUCKET_PATH, which is of the format:
    gs://bucket/subdir/%TARGET%/([0-9]+).zip.

    • When this is specified, build_manager will pick a fuzz target first (if it hasn't been picked already), and substitute'%TARGET% with the actual target name. This is the only new behaviour, as the resulting bucket path can then be passed to RegularBuild to continue regular setup.
  • Also add build_manager.get_primary_bucket_path, so that regression/progression can list builds properly.

  • Replace calls to setup_regular_build with setup_build.

  • Also remove revision fixing in schedule_corpus_pruning_tasks. This was needed back when
    we were merging sancovs, and is no longer needed.

  • Move fuzzer_selection.get_fuzz_target_weights() out of build_manager and into fuzz_task. This removes an undesired dependency where get_fuzz_target_weights checks what the current task is, and makes it easier to prevent calling it multiple times unnecessarily.

  • Make revision_pattern_from_build_bucket_path less greedy to support zip filenames of the format ([0-9]+).zip

@googlebot googlebot added the cla: yes CLA signed. label Jul 12, 2019
@oliverchang oliverchang changed the title WIP: Add support for UZZ_TARGET_BUILD_BUCKET_PATH WIP: Add support for FUZZ_TARGET_BUILD_BUCKET_PATH Jul 12, 2019
@oliverchang oliverchang changed the title WIP: Add support for FUZZ_TARGET_BUILD_BUCKET_PATH WIP: Add support for FUZZ_TARGET_BUILD_BUCKET_PATH (#663) Jul 12, 2019
@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

2 similar comments
@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@oliverchang oliverchang changed the title WIP: Add support for FUZZ_TARGET_BUILD_BUCKET_PATH (#663) Add support for FUZZ_TARGET_BUILD_BUCKET_PATH (#663) Jul 12, 2019
@oliverchang oliverchang requested review from Dor1s and inferno-chromium and removed request for Dor1s July 12, 2019 05:23

@Dor1s Dor1s left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as it doesn't affect any production instances right now, but I guess we're going to discuss some stuff on Monday anyway


return fuzz_target_build_bucket_path.replace('%TARGET%', fuzz_target)

raise BuildManagerException('No primary bucket path defined.')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe move this to line 1105 with an inverted condition, and then carry on with the other code without an extra intent

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean like this?

  release_build_bucket_path = environment.get_value('RELEASE_BUILD_BUCKET_PATH')
  if release_build_bucket_path:
    return release_build_bucket_path

  fuzz_target_build_bucket_path = environment.get_value(
      'FUZZ_TARGET_BUILD_BUCKET_PATH')
  if not fuzz_target_build_bucket_path:
    raise BuildManagerException('No primary bucket path defined.')
    
  fuzz_target = environment.get_value('FUZZ_TARGET')
  if not fuzz_target:
    raise BuildManagerException('FUZZ_TARGET is not defined.')

  return fuzz_target_build_bucket_path.replace('%TARGET%', fuzz_target)

I feel like in this case avoiding the extra indents makes the logic a little less clear.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this looks more straightforward to me, but it's not a big deal, up to you :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with either (like current one slightly better since it give correlation for fuzz target branch). i just want BuildManagerException on more informative on RELEASE_BUILD_BUCKET_PATH and FUZZ_TARGET_BUILD_BUCKET_PATH

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you clarify where more info could be added to the exception messages?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean ". Please define RELEASE_BUILD_BUCKET_PATH or FUZZ_TARGET_BUILD_BUCKET_PATH in the job definition."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

if not bucket_paths_env_vars:
def _get_targets_list(bucket_path):
"""Get the target list for a given bucket path."""
targets_list_path = os.path.join(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path here will be gs://bucket/subdir/targets.list, right? Would we want revision separation for this, maybe like:

gs://bucket/subdir/targets_list/(0-9)+.txt

?

I can't find a good reason to keep it right away, but feel hesitant not to preserve those targets.list files either. Let me comment on the doc as well, we can discuss on Monday, if you want.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will reply on the doc/tomorrow.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add more details to this function description or comment here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

if system_binary:
return setup_system_binary()

fuzz_target_build_bucket_path = environment.get_value(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was thinking if we could reuse get_primary_bucket_path here somehow, but don't see a way given that fuzz target is not chosen yet and the order of preference here is different.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the use case is a little different here, so I don't think we can re-use it here.


return fuzz_target_build_bucket_path.replace('%TARGET%', fuzz_target)

raise BuildManagerException('No primary bucket path defined.')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this looks more straightforward to me, but it's not a big deal, up to you :)

@inferno-chromium inferno-chromium left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a ton, once this is stable, please put the env var and short deascription in main documentation.


return fuzz_target_build_bucket_path.replace('%TARGET%', fuzz_target)

raise BuildManagerException('No primary bucket path defined.')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with either (like current one slightly better since it give correlation for fuzz target branch). i just want BuildManagerException on more informative on RELEASE_BUILD_BUCKET_PATH and FUZZ_TARGET_BUILD_BUCKET_PATH

if not bucket_paths_env_vars:
def _get_targets_list(bucket_path):
"""Get the target list for a given bucket path."""
targets_list_path = os.path.join(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add more details to this function description or comment here.

"""Set up targets build."""
targets_list = _get_targets_list(bucket_path)
if not targets_list:
raise BuildManagerException('No targets found')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in targets.list file ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@oliverchang

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@oliverchang oliverchang merged commit beb3f03 into master Jul 17, 2019
@inferno-chromium inferno-chromium deleted the builds-draft branch July 17, 2019 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes CLA signed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants