Skip to content

Conversation

ailzhang
Copy link
Contributor

@ailzhang ailzhang commented Apr 18, 2020

This PR tries to rebase on top of origin/master before building xla job.
I also saw a TODO in existing code which does a very similar thing (rebase on master for gcc5 jobs), so I just fixed the TODO by moving the logic into a separate step.
Currently the logic is:
For these gcc5 and xla jobs, we rebase on top of "target" branch before building.

  • This only happens on PRs.
  • "Target" branch is "origin/master" by default, but if it's trying to merge into a release branch, target branch will be the release branch.
  • I made the "target" branch a param mainly it's allow us to rebase on viable/strict if we want. But after a second thought, how quickly viable/strict moves forward is not controlled only by xla job, and it's hard to predict how long the breakage will last if it's not moving. But we do have control over how long a xla breakage lasts on origin/master (which should be short since we monitor it closely). So I currently want to keep origin/master and move to viable/strict when it's super stable.
  • There're jobs like pytorch_paralleltbb_linux_xenial_py3_6_gcc5_4_build which would fall into the rebase logic as well, but since those jobs doesn't run on PRs(so the old logic was essentially no-op), I didn't enabled the new logic on those jobs.

@dr-ci
Copy link

dr-ci bot commented Apr 18, 2020

💊 Build failures summary and remediations

As of commit 0b7fe74 (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

See how this bot performed.

This comment has been revised 18 times.

@ailzhang ailzhang force-pushed the xla_rebase_master branch 7 times, most recently from 086231c to a99ffd8 Compare April 18, 2020 03:00
@ailzhang ailzhang force-pushed the xla_rebase_master branch from a99ffd8 to 4988bf2 Compare April 18, 2020 04:03
@ailzhang ailzhang requested review from ezyang and houseroad April 20, 2020 15:22
@ailzhang ailzhang changed the title [TEST]Rebase xla job on top master before running CI build. Rebase xla job on top master before running CI build. Apr 20, 2020
@ailzhang ailzhang requested a review from seemethere April 20, 2020 15:49
PR_NUM=$(basename $CIRCLE_PULL_REQUEST)
CIRCLE_PR_BASE_BRANCH=$(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$PR_NUM | jq -r '.base.ref')
echo "Rebase on top of $CIRCLE_PR_BASE_BRANCH branch before building in environment $BUILD_ENVIRONMENT"
if [[ "${CIRCLE_PR_BASE_BRANCH}" == "master" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

Why we would like to have separate handling for master based PR?

Copy link
Contributor Author

@ailzhang ailzhang Apr 20, 2020

Choose a reason for hiding this comment

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

Hmmm so I was thinking about whether to make xla job rebase on top viable/strict as suggested by @albanD or origin/master so I opened a special case here that we could pass a param in.
I can indeed simplify the logic if we agree origin/master is a better option. cc: @ezyang @albanD wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

master is not broken too often but we don't want chain failure where all CI fails as soon as master break I think.

Copy link
Member

Choose a reason for hiding this comment

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

It should be based off of the base branch that the PR is basing its changes off of.

Hardcoding origin/master should never be an option because that immediately breaks as soon as we do a release branch.

if [[ "${CIRCLE_PR_BASE_BRANCH}" == "master" ]]; then
git rebase "${REBASE_TARGET}"
else
git rebase "origin/${CIRCLE_PR_BASE_BRANCH}"
Copy link
Contributor

Choose a reason for hiding this comment

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

You should just merge with master here, there's no reason to actually do a rebase. The rebase is more likely to fail as each individual commit in the PR must merge cleanly.

We already have some existing logic for merging with master:

          # TODO We may want to move the rebase logic to a separate step after checkout
          # Rebase to master only if in xenial_py3_6_gcc5_4 case
          if [[ "${CIRCLE_BRANCH}" != "master" && "${BUILD_ENVIRONMENT}" == *"gcc5"* ]]; then

is there any reason this couldn't have been reused in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm no particular reason, I just thought rebase would be cleaner and easier than a merge :P
Yea I can revert it back to merging :D

Copy link
Member

Choose a reason for hiding this comment

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

Like I commented before, you should merge with whatever the base branch is for the PR.

If a base branch isn't available then it's a no-op.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seemethere What do you mean by base branch for the PR? Do you mean CIRCLE_PR_BASE_BRANCH? It's indeed origin/master if you are merging into master, and it'll be release/1.5 if you want to merge into release/1.5. This is totally fine for release branches right?
Note this code block is also guarded by CIRCLE_PULL_REQUEST that it only runs on PRs not branches.

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

Don't actually rebase?

Copy link
Member

@seemethere seemethere left a comment

Choose a reason for hiding this comment

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

I'd highly recommend against hardcoding any merge / rebase logic against origin/master as it's likely to break whenever we do release branches.

We've already experienced this with 1.5.0 and we wouldn't like to repeat the exercise again for future releases.

PR_NUM=$(basename $CIRCLE_PULL_REQUEST)
CIRCLE_PR_BASE_BRANCH=$(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$PR_NUM | jq -r '.base.ref')
echo "Rebase on top of $CIRCLE_PR_BASE_BRANCH branch before building in environment $BUILD_ENVIRONMENT"
if [[ "${CIRCLE_PR_BASE_BRANCH}" == "master" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

It should be based off of the base branch that the PR is basing its changes off of.

Hardcoding origin/master should never be an option because that immediately breaks as soon as we do a release branch.

if [[ "${CIRCLE_PR_BASE_BRANCH}" == "master" ]]; then
git rebase "${REBASE_TARGET}"
else
git rebase "origin/${CIRCLE_PR_BASE_BRANCH}"
Copy link
Member

Choose a reason for hiding this comment

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

Like I commented before, you should merge with whatever the base branch is for the PR.

If a base branch isn't available then it's a no-op.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@ailzhang merged this pull request in 191fa52.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@ailzhang merged this pull request in 191fa52.

facebook-github-bot pushed a commit that referenced this pull request Apr 23, 2020
)

Summary:
Resubmit of #36852
Pull Request resolved: #37085

Differential Revision: D21180010

Pulled By: ailzhang

fbshipit-source-id: c448b836e4c13b15860e0b69da76082bd644badd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants