googleapis / google-cloud-python

Google Cloud Client Library for Python
https://googleapis.github.io/google-cloud-python/
Apache License 2.0
4.86k stars 1.53k forks source link

Switch all googleapis python repos to use a default branch of main #10579

Closed parthea closed 3 years ago

parthea commented 3 years ago

Please follow these steps to change the default branch from master to main:

  1. Before you start the migration add your Github user to the end of the list item to avoid overlapping efforts.
  2. In the majority of python repositories, @googleapis/yoshi-python is listed as the code owner in .github/CODEOWNERS. If there are additional code owners listed, please reach out to the team listed to notify them about the effort.
  3. In the “Settings” section for the Github repository, rename the default branch from master to main. If you don’t see the settings section, you will need to reach out to an admin of the repository to complete this step. Once you’re in the settings section, look for the “Default branch” section under the branches tab. For example, for python-datastream, the link to the branches tab is https://github.com/googleapis/python-datastream/settings/branches
  4. Search the github repo for the term master in the repository. Open a PR in the repo to replace the term master with main. We have automation which will revert changes made to templated files so we also need to add replacements in owlbot.py to replace master with main similar to this PR. See this bash script that I used to create the branch for the linked PR. Note: Once this synthtool PR is merged and the synthtool templates have propagated to the repo via owlbot, we can remove the replacements in owlbot.py added in this step.
  5. Make sure that replacements are not reverted by owlbot
  6. Notify a Googler to complete the remaining steps at go/python-main-branch-migration.
  7. Check the box below when the repo has been successfully migrated and verified that the continuous/nightly builds pass after the migration.
nicain commented 3 years ago

@dandhlee @plamut FYI this PR provides a one-liner to pull and run the migration script via cURL; the main-migration branch within google-cloud-python holds the scripts, so if they need to be updated or modified, you will be able to access the most recent versions via cURL.

(for example, I just pushed a PR that uses "chore:" instead of "docs:" for the commit message)

plamut commented 3 years ago

@nicain Thanks, that's useful.

One side note, the name of the remote is hardcoded and assumed to be origin, while I personally use origin for my own forks and refer to the original repo as upstream.

In addition, not all references to master are replaced. Some of them legitimately, e.g. URLs to repos that have not migrated yet, but some others files need extra manual changes (sync-repo-settings.yaml, for example).

Something to keep in mind if anybody else uses a similar setup and if a repo has its own specifics. Best to read the script source first, it's pretty short and straightforward anyway.

dandhlee commented 3 years ago

@tseaver we're not marking entries checked off until we've verified that the continuous tests run after the migration, I'll unmark the ones you've checked off for my PRs!

tseaver commented 3 years ago

Hmm, OK, sorry about that. The continuous tests tend to run against the last release -- is that going to be an issue?

dandhlee commented 3 years ago

No worries, I'll edit the snippet up top to reflect that, it was only referenced in our internal doc iirc.

I think that's fine, as long as Kokoro runs against main and not master and there's no issues on those then it should be fine.

tseaver commented 3 years ago

@dandhlee, @parthea PR needing review: https://github.com/googleapis/python-bigtable/pull/411

parthea commented 3 years ago

All task are complete