Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix continuous integration get base branch #32690

Merged
merged 8 commits into from
Jan 21, 2020

Conversation

sureshc
Copy link
Contributor

@sureshc sureshc commented Jan 15, 2020

Description

Logic in Continuous Integration builds to get the base (target) branch of the Pull Request that triggered the build depended on a deprecated Circle environment variable.

Reviewer Checklist:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@@ -93,11 +93,7 @@ def self.pr_base_branch_or_default_no_origin
end

def self.circle_pr_branch_base_no_origin
Copy link

Choose a reason for hiding this comment

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

It looks like this function is used in other places (such as eyes_steps.rb), so I'm not sure if it's safe to change this way. I'd be ok with just limiting the change to branch_to_base, though if you want to investigate to understand the situation / clean it up a bit, that'd be great also.

Copy link
Contributor Author

@sureshc sureshc Jan 16, 2020

Choose a reason for hiding this comment

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

Sorry I didn't take time to write up my analysis on the impact to other uses of this method. Here's what I found:

This method stopped working (it always returns nil now) when we switched from CircleCI to Drone because while Drone supports many CircleCI environment variables for cross-compatibility, it does not support the CI_PULL_REQUEST environment variable that CirceCI deprecated in Circle 2.0. This proposed change will result in the method working again as it did before the switch to Drone.

The Eyes steps no-op in Continuous Integration (Circle/Drone) builds, so the call to this method in the "I open my eyes" step always returns nil both before and after this proposed change.

I'm confident that the Eyes step does not need to be updated to account for this change.

Copy link
Contributor Author

@sureshc sureshc Jan 16, 2020

Choose a reason for hiding this comment

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

The Eyes logic that uses this method is a legacy attempt to implement branching logic for Eyes Baseline images, which Eyes now officially supports in its gem. When we revive and successfully implement feature branches for Eyes baseline images, the section of Eyes steps that invoke this method will be cleaned up.

Copy link

Choose a reason for hiding this comment

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

Can you do a little cleanup based on your findings, then? It sounds like we can just delete the call to it and the branch of the if statement which uses it from eyes_steps, is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Thanks for keeping me honest. This is a good opportunity to pay off some technical debt.

@sureshc sureshc merged commit d2d8699 into staging Jan 21, 2020
@sureshc sureshc deleted the fix-continuous-integration-get-base-branch branch January 21, 2020 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants