Skip to content

Move IREE Repository to OpenXLA GitHub Organization #12102

Closed

Description

@GMNGeoffrey

IREE -> OpenXLA

As announced, this
repository https://github.com/iree-org/iree is moving to the OpenXLA GitHub
organization as https://github.com/openxla/iree

Moving a GitHub Repository

GitHub has
built-in tooling
for moving a GitHub repository from one organization to another. This includes
transferring all issues, PRs, wikis, and various metadata. It will also forward
the old links, so users could still clone from iree-org/iree for instance and
it will
seamlessly forward them to the new location.
The same is true of GitHub API requests. The redirect remains in place
indefinitely unless there exists another repo at the old location. So we should
have no worries about forwarding as long as we don't create iree-org/iree as a
new repository in the future. I'm not aware of a way to create an explicit
tombstone repository as creating a repository with the old name breaks the
automatic url forwarding. One notable exception to the redirection is for
github.io pages, which are not forwarded (see
Docs Forwarding).

Issues

When we migrated IREE into the iree-org GitHub organization, a number of things
went somewhat wrong, but fortunately we wrote those down. We'd like to avoid a
repeat of those issues where possible.

Kokoro

We had a bunch of issues last time with Kokoro. Fortunately, we no longer use
Kokoro, so this will not be a problem 🙂

GitHub Projects

We use
GitHub Projects
for tracking and triaging issues. We have a single
project that contains all the
issues. Projects exist at the organization level and can contain issues from
multiple repositories, but only within the same organization. So if we migrate
only the IREE repo then the Project will not be able to contain issues from the
other repositories. Fortunately, only one open issue in the Project is from a
repo other than the main IREE repo, so this shouldn't be too big of a problem.
GitHub does not provide tooling for importing, exporting, or migrating Projects
(https://github.com/orgs/community/discussions/12908). Last time I created a
bespoke
script
to do most of the migration. At the time there was no API access to Project
Views, but those are now present in the schema. Additionally, it now provides
functionality to copy the views and custom fields of a project to a new project
in a different organization, so we should be able to do that and then populate
the issues with the scripting. Unfortunately this isn't something we can do
ahead of time, so there will necessarily be downtime for the Project, but we can
thoroughly test migration scripting ahead of time.

Tokens

There are a variety of tokens we use in various automation. We will need to do a
thorough audit of these and make sure they are all updated. Most of these are
owned by the iree-github-actions-bot account, so we should add that bot to the
OpenXLA organization ahead of time. Ideally we would make the existing tokens
also have OpenXLA permissions so that we don't have to hot-swap the tokens after
the repo is moved. We store tokens in GitHub actions secrets and GCP Secret
Manager.

GitHub's new
fine-grained tokens
only allow access to a single organization per token. These will require either
hot-swapping the tokens on the day of migration, or reverting back to the
broader access tokens with access to both old and new repo locations. To limit
the number of things that need to be done during the migration, I recommend the
latter. This is an inventory of all the GitHub tokens in use today. Note that
links to the GitHub tokens page must be opened while logged in to GitHub as
iree-github-actions-bot (IREE team members can open in incognito and then log
in as the bot). GitHub Secrets access will require admin privileges on the IREE
repository. Secret Manager metadata access will require the GCP "Secret Manager
Viewer" role.

  • GitHub token for Buildkite: GitHub iree-github-actions-bot classic personal
    access token used by the Buildkite benchmark pipeline
    • Required action: None. Access is only for public repos and gists. But also
      we should just delete this whole pipeline...
  • GitHub token for posting gists: GitHub iree-github-actions-bot fine-grained
    personal access token used by new benchmark workflows to create a detailed
    results table that can be linked to.
    • Required action: None. This is scoped at the user level and is only for
      gists.
  • GitHub token for adding to Project: GitHub iree-github-actions-bot classic
    personal access token used by the workflow that adds new issues to the IREE
    GitHub project
    • Required action: iree-github-actions-bot must be a member of the openxla
      GitHub organization
  • GitHub token for write access to repositories: GitHub iree-github-actions-bot
    fine-grained personal access token used in various GitHub actions workflows
    to update the contents of the IREE repository.
    • Required action: We must revert this back to a classic token. We need to
      create a new classic PAT with the correct permissions and update the GitHub
      secret to use that instead. Rollback procedure is to update the secret value
      back to the old value. iree-github-actions-bot needs to have write access
      to the IREE repository in the new location.
  • GitHub app for runner registration: GitHub app installed in iree-org that
    allows administering organization runners via a proxy service.
    • Required action: GitHub app must be installed in openxla org
  • Discord Webhook: URL for webhook so that workflows can post to the IREE
    discord
    • Required action: Secret must be duplicated to the OpenXLA organization

Hardcoded Organization Name

In a few places, we have the iree-org name hardcoded in a script or something.
This is especially the case in some GitHub Actions workflows where we have
historically disabled jobs when not running in our repository such that we don't
spam people's forks. There are now other mechanisms for people to disable all or
individual actions in their forks, so I question the value of these
short-circuits. In cases where we do need to keep them, we can and with the
openxla org name ahead of the migration.

Human Access

In our previous org migration, human permissions for repositories ended up in a
very strange state and we didn't have any way to see what it had been after the
repo got migrated. We should dump the pre-migrations state so that we can
reference it. As much as possible, we should set up permissions to the new
organization ahead of the repo move so that they can be validated and there's no
downtime.

The OpenXLA organization has much more organized permissions setup than
iree-org. Our permissions grew somewhat organically, partially because we didn't
have our own GitHub organization originally, so were more limited in our
options. We can incorporate IREE core team members and external collaborators
into the OpenXLA organization groups ahead of the migration.

OpenXLA has all permissions assigned at the org level rather than the repo
level. Even in cases where a person or group has access only to specific repos,
that access is still set at the org level. That is, there are groups at the org
level that are granted admin access, write access, etc to specific repositories.
This is useful for being able to easily view and edit the configuration in one
place. One limitation is that only members of the organization can be in this
team, so giving someone access to a repository requires adding them to the
organization. We have decided that having those coupled is ok. We can configure
settings so that being an organization member does not give any privileges (e.g.
creating new repositories) beyond those explicitly granted.

In IREE we make some external contributors collaborators, which allows them to
do things like run CI without approval, add labels to issues, request PR
reviews, etc. Currently repo admins of individual repos can add these external
collaborators, so they can take action without having to escalate to admins. To
enable this workflow, we will make some team members maintainers of specific
teams and they can add users to those teams. This will also allow them to
quickly remove bad actors if necessary. Adding people directly to repositories
will be discouraged and adding outside collaborators will be disabled entirely.

Colab Notebooks

After our previous migration, Colab notebooks viewed at their new URLs were
listed as "untrusted" ("not authored by Google"). We need to get on the list for
being a "trusted" repository (internal process).

Docs Forwarding

GitHub's automatic URL forwarding does not extend to github.io pages. Since our
last migration, old links to https://google.github.io/iree have 404ed and the
Google index continued to find these resources instead of the new ones for
weeks. It's unclear to me why GitHub doesn't set up this forwarding
automatically, but a user has documented a
simple process
for doing so, as it is possible to claim the root <org>.github.io site and
then set up the appropriate redirects. A
similar mechanism
is already in place for some repos in google.github.io.

Communication

Last time communication was fragmented across many different internal and
external channels. For this migration we should document clear locations for
where the following discussion should take place:

  1. Public announcements about the plan for the migration and high-level status
    updates or actions required. We will use a single thread on the iree-discuss
    mailing list.
  2. Detailed updates about the migration progress and task tracking. This GitHub
    issue in the IREE repository.
  3. Realtime reports of issues. This will be especially relevant for post-move
    issues (e.g. "I can't access the repo"). We will encourage posting on the
    GitHub issue, but also have a pinned thread in the IREE discord #general
    channel. This will only be created when the migration proper begins. No
    updates or announcements of broad interest should only be communicated here.
    Discord should be treated as ephemeral. The first post in the thread will
    direct people to the GitHub issue.
  4. Internal-only realtime conversations. I can't think of a reason for these to
    exist, but it's good to be prepared. We will encourage no internal-only
    discussion, but create a thread in the dev chat room. The first post in the
    thread will direct people to the GitHub issue.

As much communication as possible should happen on the GitHub issue. It is
almost inevitable that someone will post about this in Discord, so a dedicated
thread might be helpful in consolidating that conversation. Internal-only
communication should be rare, but might happen, and we should therefore
establish communication channels ahead of time. The mailing list thread should
be reserved for announcements from those actively conducting the migration that
require broad dissemination either because users need to take action or because
they are broadly relevant high-level planning and progress updates.

GitHub Runners

One migration problem we face today that we didn't the last time is our use of
custom GitHub runners. Those custom runners managed by GitHub can be created
ahead of time in the new organization without issue (they autoscale nicely). Our
self-hosted runners are run on GCE Managed Instance Groups (MIGs) and have a lot
more issues with autoscaling. They are also more resource constrained as we
not-infrequently hit cloud quota limits. These are likely going to be the most
work to migrate. There's going to be some auth and tokens that will need to be
extended. We're also going to need to duplicate all the runner managed instance
groups because a runner can only target a single organization. That may cause us
some quota issues although we'll luckily only have real traffic on one repo at a
time. I think we should be able to handle it within the current IREE cloud
project quota without too much disruption, but we should probably investigate
whether we can easily get additional quota (especially CPU).

We also use GitHub managed runners, both the standard ones, where we make use of
increased minutes from Google's GitHub Enterprise plan and larger custom managed
runners. Full use of runner features requires an enterprise plan. iree-org is
currently linked to Google's enterprise account, but openxla is not. We'll
need to add it.

Buildkite

We still use Buildkite for some of our benchmarking (migration to GitHub actions
in progress). Here the runners ("agents" in Buildkite terminology) are connected
to the repository. Our custom actions use a PAT for iree-github-actions-bot,
but Buildkite uses its own integration to gain access to things like publishing
commit statuses. We can install the Buildkite app in the new organization, but
it may be necessary to manually reconfigure each pipeline to point at the new
repository location. Even though GitHub would forward a request, the
installation will be different between the orgs and Buildkite might use the
wrong credentials. We can do some testing using the new repository location, but
won't be able to precisely mimic the setup. The pipelines may be temporarily
broken and we'll need to manually update each pipeline after the migration.

Ahead of Time Testing

Ideally we'd test that the new repository was working before we switched off the
old one. There isn't any way to do this with GitHub tooling though, AFAIK. You
can only move a repository, not gradually redirect traffic with dual writes
😛. We can fork (has to be a fork for PRs to work)
the repository and test almost everything there first. GitHub
doesn't let you move a repo to an org if it already has a repo of that name.
That seems reasonable in general, but is a bit annoying here. We'll need to
delete the copy before migrating the new repo, which might invalidate some
configuration. Any configuration done with the forked repo itself will be lost,
which may include things like organization runners that have been configured to
be accessible for that repo. There will necessarily be some amount of winging it
and hotfixes on the day of migration. This will need to happen at a time when
the relevant people are around.

Detailed Steps

Ahead of time testing

  • Create a GitHub issue in the IREE repository for work tracking
  • Communicate the intent to move the repository and details of the steps
    involved on iree-discuss
  • Add the OpenXLA GitHub organization to Google's enterprise account
  • Update all hardcoded organization names in code to also work with the new
    organization. Consider removing some organization hardcoding entirely.
    Remove conditionals restricting workflows to a specific repo #12012
  • Create a new iree-github-actions-bot WRITE_ACCESS_TOKEN as a classic PAT
    and update the value in the repository secrets.
  • Create a fork of the IREE repository in the OpenXLA GitHub organization
    • Add a note in the description that this is scaffolding for a
      migration, not the main repo.
    • Limit interactions to collaborators to avoid accidental PRs/issues
  • Create GitHub teams for IREE admin/write/triage with appropriate access to
    the repo copy.
  • Create an IREE GitHub team in the OpenXLA GitHub organization and add it
    to the team for write access
  • Dump all current access to the IREE repository from the API
  • Add iree-github-actions-bot to the IREE write access team
  • Duplicate GitHub self-hosted runner setup in new org:
  • Test Buildkite pipelines
  • Create a team for IREE collaborators and add it to the IREE triage team
  • Invite all current repo external collaborators to the collaborators team
  • Validate that an IREE team member can take expected actions in the repo copy:
    • Create PR
    • Access GitHub actions logs
    • Rerun GitHub actions
    • Merge PR
  • Validate that a collaborator can take the same expected actions
  • Add openxla/iree to trusted repos for Colab
  • Validate that Colab notebooks appear as trusted
  • Create github.com/iree-org/iree-org.github.io to auto-forward docs pages
  • Validate docs forwarding using a different address (to avoid conflict
    before the move)
  • Revert all GitHub tokens to non fine-grained access and extend them to the
    OpenXLA organization as well.
  • Discord Integration
    • Copy DISCORD_WEBHOOK secret to openxla organization
    • Test that posting to Discord works
  • Test GitHub Project migration
    • Create a test-repository in iree-org
    • Create a test org-level project in iree-org
    • Create a test org-level project in openxla
    • Populate the test-repository with test issues
    • Add the test issues to the project in iree-org and add project metadata
    • Move the test-repository from iree-org to openxla
    • Adapt previous script to add all issues to the project in openxla (iterate)
    • Validate project migration
    • Test that automatic addition of new issues works
  • Delete fork repository
  • Announce precise date and time for moving the IREE repository

Migration

  • Raise autoscaling limits and fixed sizes on openxla org runner groups
  • Disable workflow to automatically add new issues to the GitHub Project
  • Dump items from the old IREE GitHub Project (in case things get messed
    up)
  • Create a new GitHub Project in openxla for IREE
  • Move the IREE repository to openxla/iree
    • Add the iree-admin, iree-write, and iree-triage teams to the repository
  • Give the repository access to the org-level runner groups
  • Turn on docs forwarding with iree-org.github.io repository
  • Run project migration to copy the old GitHub project to the new
    organization
  • Turn on Project workflows matching old project
  • Validate that Buildkite can post commit statuses.
  • Scale down iree-org runner groups
  • Validate that Colab notebooks appear as trusted
  • Replace all old links in the repository (they autoforward, but still
    better to use the canonical location)
  • Replace all old links in other locations
  • Time passes. Deal with issues as they arise
  • Delete old runner MIGs
  • Set up docs forwarding for google.github.io
  • Archive old GitHub Project in iree-org (Project, not repo!)

Activity

  1. moved this to In Progress in IREEon Feb 8, 2023
  2. added
    infrastructure
    on Feb 8, 2023
  3. self-assigned this
    on Feb 8, 2023
  4. GMNGeoffrey commented on Feb 8, 2023

    @GMNGeoffrey
    MemberAuthor

    Well turns out something has to be a public fork in order to function basically at all, so we'll go with a fork after all

  5. GMNGeoffrey commented on Feb 8, 2023

    @GMNGeoffrey
    MemberAuthor

    And by deleting the copy repository, I have confirmed that this deletes its access to runner groups and teams' access to the repository

  6. GMNGeoffrey commented on Feb 8, 2023

    @GMNGeoffrey
    MemberAuthor

    Scott observed that one thing that won't get auto-updated is email filters :-) I'll include a reminder about that in the migration announcement

  7. GMNGeoffrey commented on Feb 9, 2023

    @GMNGeoffrey
    MemberAuthor

    In trying to test Buildkite, I'm running into weird issues with getting it to clone a new repo over ssh. The GitHub Buildkite installation has access to the test repository (though I believe it doesn't use the installation for this). I've configured the pipeline just like our benchmark pipeline:

    image

    vs

    image

    but ssh cloning fails. I've tried the usual "just reset things" options, like sshing into the agent and deleting the Buildkite job directory, but no luck. The only change is that it goes from fetching to cloning and still fails. It gets weird though. Looking at the logs for the benchmark pipeline, it actually isn't cloning over ssh! It's using https even though the pipeline settings say to use ssh.... wtf?

    https://buildkite.com/iree/iree-benchmark-linux/builds/2944#01863352-1815-44fc-a28b-24c9c7e60dae

    @pzread @antiagainst is there some kind of configuration on the Buildkite agents that is sneakily rewriting this as https?

  8. pzread commented on Feb 9, 2023

    @pzread
    Contributor

    Hmm, I didn't recall any related settings in the agent configuration.

  9. GMNGeoffrey commented on Feb 9, 2023

    @GMNGeoffrey
    MemberAuthor

    Ok I'm totally mystified. I'm going to set both pipelines to https at the pipeline settings level

  10. GMNGeoffrey commented on Feb 9, 2023

    @GMNGeoffrey
    MemberAuthor

    Ok, as I feared, even if Buildkite is installed in both organizations, when you move it from one to another, it stops being able to post commit statuses.

  11. GMNGeoffrey commented on Feb 9, 2023

    @GMNGeoffrey
    MemberAuthor

    Huh, or maybe not. Now it seems to be working. I'll just add a step to validate this is working after the migration

  12. GMNGeoffrey commented on Feb 14, 2023

    @GMNGeoffrey
    MemberAuthor

    I'm now testing project migration. I've copied all the views to the openxla org with (Deprecated) IREE. I'm now going copy all IREE issues to the test repo. I want to avoid side-effects though, so I'm going to leave out all assignees, comments, and body text (could have @ mentions) and just duplicate number, title, and labels

  13. GMNGeoffrey commented on Feb 15, 2023

    @GMNGeoffrey
    MemberAuthor

    Well it turns out the GitHub API really doesn't like it when you try to create 12k issues. I'm following all the guidelines, but still hitting the "secondary rate limits" intended to prevent abuse. I've got exponential backoff and such in there as well, so hopefully we'll get them all eventually. So far, I've copied ~2500 issues.

    The other fun thing I ran into is that apparently it is possible to end up with gaps in the issue numbering. One source of these is discussions, which apparently share the issue numbering pool, but don't show up in the issues API. At least one issue link says the issue was deleted (ok, I guess that makes sense). The most mysterious is #1401, which just 404s. Current theory is that the issue was transferred to another repository, but we have no way to confirm this that I can think of. Anyway, I added in placeholders for the missing issues to increment the issue number (that's also what I'm doing for PRs).

  14. 12 remaining items

  15. bhack commented on Feb 22, 2023

    @bhack

    You have crossed the event horizon... 🌃 this comment is already on the other side. 😉

  16. GMNGeoffrey commented on Feb 22, 2023

    @GMNGeoffrey
    MemberAuthor

    With #12304 and #12309, all remaining references to iree-org are for repos that haven't been moved yet except for #12318, which I've filed to be handled separately (it's not clear how it should be updated).

  17. moved this from In Progress to Done in (Deprecated) IREEon Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infrastructure

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions