Sheriffing/How To/Merges: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
(add instructions to request missing tasks to get merge candidate if no merge since last Nightly builds)
 
(28 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Merges:'''  
{{Sheriffing How To|Merges}}
= Goal =
'''Autoland''' is a repository opened for developers who work on bug fixes, improvements and other. Merging means that clean code is transferred from Autoland to Central, and back if there are any changes Central might hold, but Autoland not. <br />
<span style="color:#14866d">'''''No sync is performed, only differences are transferred.'''''</span>


''Merging around twice a day to/from m-i, fx-team and b2g inbound to m-c''
= Choosing a changeset to merge =
For merges from the integration trees to mozilla-central, you should choose a changeset with a green Shippable run to avoid bustages on nightly builds that also run on Shippable. You need to also make sure that are *NOT* any backouts *after* that changeset.


'''Merges from the integration trees to m-c are done on green PGO runs to avoid bustages on PGO which could affect as example Nightly Builds'''''Italic text''
'''A more in depth view of the conditions a merge candidate must fulfill:'''
#Candidate revision must be <span style="color:#14866d">'''100% completed'''</span> or <span style="color:#14866d">'''at least 98-99%'''</span>, with <span style="color:#14866d">'''maximum 15 jobs running'''</span>. The candidate revision will have the Windows 10 Shippable opt suite and the complete Windows 10 opt suite.
#<span style="color:#FF0000">'''No jobs classified as fixed by commit'''</span>
#'''Few''' or '''no unclassified''' jobs
#Windows 10 '''Shippable''' platform and Windows 10 '''opt''' must have <span style="color:#14866d">'''all jobs finished'''</span> (see screenshot as an example)
[[File:Win10.png|center|windows 10]]
#No backouts after merge candidate
#If a merge candidate has more than 15 jobs running but they are autophone jobs, the candidate is good to use


If the planned merge is scheduled directly before Nightly builds will run on mozilla-central and there is no merge candidate and there hasn't been a merge to mozilla-central since the last Nightly builds ran, check if requesting all missing tasks for an autoland push has a good chance to turn it into a merge candidate. If that applies, request the missing tasks from the push's menu.


= Step 1=
Onboarding code sheriffs shall let the merge candidate they identified get checked by another sheriff.
Merging from m-i,fx-team and b2g-inbound to m-c


-> cd into your mc directory
= Order of operations =
-> hg pull ssh://hg.mozilla.org/integration/mozilla-inbound -r (the green with PGO runs inbound revision changeset) - also make sure there are no backouts  after that etc
Integration branches should be merged to mozilla-central first, then mozilla-central should be merged back to the integration branches. These merge instructions were copied from [[Sheriffing/How:To:SheriffingFromUnifiedRepos#Merges|Sheriffing From Unified Repos]] document.
-> hg merge && hg commit -m "merge inbound to mc"
-> push


'''don't forget to use mc-merge tool after that!'''
'''Merge pattern:'''
# autoland > central
# central > autoland <span style="color:#14866d">(if Central has changes Autoland might not)</span>


= Step 2 =
== Merging from autoland to mozilla-central ==
Steps on how to do the <span style="color:#14866d">'''autoland to mozilla-central'''</span> merge:


Merging back from m-c to fx-team,m-i and b2g-inbound
# Have your revision ids ready
# In the console switch to Mozilla-unified directory: <code>cd mozilla-unified</code>
# Download the Central repo: <code>hg pull central</code>
# Switch and update to it: <code>hg update central</code>
# Autoland to central merge command: <code>hg merge -r <span style="color:#14866d"><autoland_revision_id></span></code>
# Add a commit message: <code>hg commit -m "Merge autoland to mozilla-central.  a=merge"</code>
# Transfer the files to Central repo: <code>hg push -r . central</code>


Example mc to inbound merge
After the merge is in Central, <span style="color:#FF0000">'''bugs need to be marked with Bugherder'''</span>: go to Central and in the top right side of each of your pushes to Central, click on '''Action Menu''' (arrow button next to the pin button) and choose '''Mark With Bugherder'''.
-> go to your m-i tree directory
[[File:Bugherder tool.png|frame|center]]
-> hg pull && hg update to make sure its the latest
Navigate through all the pages, check for any security bugs that can’t be updated by Bugherder and mention them to someone who can, check that Resolve and Fixed checkboxes are ticked and the correct version is set. At the last step click '''Submit''' and use your '''API key''' to finish the process. Leave the tab opened until the loadbar is not displayed anymore.
-> hg pull ssh://hg.mozilla.org/mozilla-central/
-> hg merge
-> hg commit -m "merge bla to bla"
-> hg push
since this above might result in race conditions on the tree (when its busy there) this works better -> hg pull && hg update  && hg merge && hg commit -m  "Merge m-c to [TREENAME]" && hg push


Aliases for the various repositories make the above easier to type!
Announce in the sheriffing chat if there are bugs shown as restricted by Bugherder because the tool cannot access it and they need to be updated manually. Some of these bugs are also not accessible to code sheriffs.
 
<span style="color:#14866d">'''Monitor the pushes and check that the Gecko Decision Task opt job is running. If it fails, rerun it, if it fails again the tree should be closed and the issue escalated.'''</span>
 
== Merging back from mozilla-central to autoland ==
Steps on how to do the <span style="color:#14866d">'''mozilla-central to autoland'''</span> merge:
 
# Close autoland from [https://mozilla-releng.net/treestatus Treestatus]
# In the console switch to Mozilla-unified directory: <code>cd mozilla-unified</code>
# Download the repos: <code>hg pull fxtrees</code>
# Update autoland: <code>hg update autoland</code>
# Merge from central to autoland: <code>hg merge central</code>
# Add a commit message: <code>hg commit -m "Merge mozilla-central to autoland. CLOSED TREE"</code>
# Transfer the files to Autoland: <code>hg push -r . autoland</code>
 
 
These commands *might* result in race conditions on the tree when it is busy. Under those circumstances, this commands avoid delays between steps:
cd mozilla-unified
hg pull && hg update autoland && hg merge central && hg commit -m "Merge mozilla-central to autoland" && hg push -r . autoland
 
<span style="color:#FF0000">'''Note'''</span>: For correcting a commit message, use <code>hg commit --amend</code>
 
=== When there is nothing to merge ===
You run <code>hg update</code> to get a working copy information, but there are no changes on mozilla-central and so nothing to merge. The workflow for this case is:
 
# Run <code>hg update</code>
#* You can run <code>hg out</code> to list all the changesets to merged to mozilla-central.
# Because there's been no merge, you won't have a commit containing a approval message, e.g. "merge a to b a=me." This means you will run afoul of the hg hook telling you that the m-c repo is set to approval-only. You need to temporarily set the mozilla-central tree to "open" via [https://mozilla-releng.net/treestatus Treestatus] to be able to push.
# Push your changes from Step 1.
# Set the m-c tree back to "approval-required" in Treestatus. This is important because if we miss this, we risk unexpected pushes to mozilla-central since some people might think the open tree is intentional.
# Use Bugherder to mark and failures as usual for your push. If all bugs failed to get marked, entered Bugzilla API might be wrong. Close the tab and try with a new one. If only some failed, open Bugherder for that push again and append <code>&resume=1</code> to the url.
# Now when you merge from autoland you get the note that you need to merge.
 
= Issues =
== Push rejected: DOM peer review needed ==
(fix still needs to be verified in production)
 
If the server rejects the push with the merge and complains that a changeset needs review by a DOM peer, you can disable this check. The issue should only affect merges with changesets which initially landed on autoland. Temporarily add this to the <code>hgrc</code> file in the <code>.hg</code> folder of the repository:
 
<code>mozilla.check.webidl_check = false</code>
 
= Merges from central to beta etc. =
These merges are done per release cycle to update the repository containing the code closer to the release repository with the code from the more development oriented repository. This merge is performed by the Release Engineering team.

Latest revision as of 10:13, 23 November 2021

Goal

Autoland is a repository opened for developers who work on bug fixes, improvements and other. Merging means that clean code is transferred from Autoland to Central, and back if there are any changes Central might hold, but Autoland not.
No sync is performed, only differences are transferred.

Choosing a changeset to merge

For merges from the integration trees to mozilla-central, you should choose a changeset with a green Shippable run to avoid bustages on nightly builds that also run on Shippable. You need to also make sure that are *NOT* any backouts *after* that changeset.

A more in depth view of the conditions a merge candidate must fulfill:

  1. Candidate revision must be 100% completed or at least 98-99%, with maximum 15 jobs running. The candidate revision will have the Windows 10 Shippable opt suite and the complete Windows 10 opt suite.
  2. No jobs classified as fixed by commit
  3. Few or no unclassified jobs
  4. Windows 10 Shippable platform and Windows 10 opt must have all jobs finished (see screenshot as an example)
windows 10
  1. No backouts after merge candidate
  2. If a merge candidate has more than 15 jobs running but they are autophone jobs, the candidate is good to use

If the planned merge is scheduled directly before Nightly builds will run on mozilla-central and there is no merge candidate and there hasn't been a merge to mozilla-central since the last Nightly builds ran, check if requesting all missing tasks for an autoland push has a good chance to turn it into a merge candidate. If that applies, request the missing tasks from the push's menu.

Onboarding code sheriffs shall let the merge candidate they identified get checked by another sheriff.

Order of operations

Integration branches should be merged to mozilla-central first, then mozilla-central should be merged back to the integration branches. These merge instructions were copied from Sheriffing From Unified Repos document.

Merge pattern:

  1. autoland > central
  2. central > autoland (if Central has changes Autoland might not)

Merging from autoland to mozilla-central

Steps on how to do the autoland to mozilla-central merge:

  1. Have your revision ids ready
  2. In the console switch to Mozilla-unified directory: cd mozilla-unified
  3. Download the Central repo: hg pull central
  4. Switch and update to it: hg update central
  5. Autoland to central merge command: hg merge -r <autoland_revision_id>
  6. Add a commit message: hg commit -m "Merge autoland to mozilla-central. a=merge"
  7. Transfer the files to Central repo: hg push -r . central

After the merge is in Central, bugs need to be marked with Bugherder: go to Central and in the top right side of each of your pushes to Central, click on Action Menu (arrow button next to the pin button) and choose Mark With Bugherder.

Bugherder tool.png

Navigate through all the pages, check for any security bugs that can’t be updated by Bugherder and mention them to someone who can, check that Resolve and Fixed checkboxes are ticked and the correct version is set. At the last step click Submit and use your API key to finish the process. Leave the tab opened until the loadbar is not displayed anymore.

Announce in the sheriffing chat if there are bugs shown as restricted by Bugherder because the tool cannot access it and they need to be updated manually. Some of these bugs are also not accessible to code sheriffs.

Monitor the pushes and check that the Gecko Decision Task opt job is running. If it fails, rerun it, if it fails again the tree should be closed and the issue escalated.

Merging back from mozilla-central to autoland

Steps on how to do the mozilla-central to autoland merge:

  1. Close autoland from Treestatus
  2. In the console switch to Mozilla-unified directory: cd mozilla-unified
  3. Download the repos: hg pull fxtrees
  4. Update autoland: hg update autoland
  5. Merge from central to autoland: hg merge central
  6. Add a commit message: hg commit -m "Merge mozilla-central to autoland. CLOSED TREE"
  7. Transfer the files to Autoland: hg push -r . autoland


These commands *might* result in race conditions on the tree when it is busy. Under those circumstances, this commands avoid delays between steps:

cd mozilla-unified
hg pull && hg update autoland && hg merge central && hg commit -m "Merge mozilla-central to autoland" && hg push -r . autoland

Note: For correcting a commit message, use hg commit --amend

When there is nothing to merge

You run hg update to get a working copy information, but there are no changes on mozilla-central and so nothing to merge. The workflow for this case is:

  1. Run hg update
    • You can run hg out to list all the changesets to merged to mozilla-central.
  2. Because there's been no merge, you won't have a commit containing a approval message, e.g. "merge a to b a=me." This means you will run afoul of the hg hook telling you that the m-c repo is set to approval-only. You need to temporarily set the mozilla-central tree to "open" via Treestatus to be able to push.
  3. Push your changes from Step 1.
  4. Set the m-c tree back to "approval-required" in Treestatus. This is important because if we miss this, we risk unexpected pushes to mozilla-central since some people might think the open tree is intentional.
  5. Use Bugherder to mark and failures as usual for your push. If all bugs failed to get marked, entered Bugzilla API might be wrong. Close the tab and try with a new one. If only some failed, open Bugherder for that push again and append &resume=1 to the url.
  6. Now when you merge from autoland you get the note that you need to merge.

Issues

Push rejected: DOM peer review needed

(fix still needs to be verified in production)

If the server rejects the push with the merge and complains that a changeset needs review by a DOM peer, you can disable this check. The issue should only affect merges with changesets which initially landed on autoland. Temporarily add this to the hgrc file in the .hg folder of the repository:

mozilla.check.webidl_check = false

Merges from central to beta etc.

These merges are done per release cycle to update the repository containing the code closer to the release repository with the code from the more development oriented repository. This merge is performed by the Release Engineering team.