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

Set CI_BRANCH_BASE for bundlewatch on push events #869

Merged
merged 2 commits into from
Jul 8, 2021

Conversation

tomalec
Copy link
Member

@tomalec tomalec commented Jul 8, 2021

Changes proposed in this Pull Request:

Set BRANCH_BASE for bundlewatch on push events,
workaround bundlewatch/bundlewatch#423.

Previously if no base was given, it was using hardcoded master which does not exist in our repo.
See https://app.travis-ci.com/github/woocommerce/google-listings-and-ads/jobs/522666112#L14735

[ERROR] Unable to fetch fileDetails for baseBranch=master from https://service.bundlewatch.io/store code=Request failed with status code 404
[INFO] master !== trunk, no results saved
[INFO] Saving results

Screenshots:

Detailed test instructions:

  1. Run buildwatch with those changes on push event - with our current setup, this means run them in trunk :|

Changelog entry

@tomalec tomalec added type: enhancement The issue is a request for an enhancement. priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. labels Jul 8, 2021
@tomalec tomalec changed the title WIP: Set BRANCH_BASE for bundlewatch on push events, Set BRANCH_BASE for bundlewatch on push events, Jul 8, 2021
@tomalec tomalec self-assigned this Jul 8, 2021
@tomalec tomalec requested a review from a team July 8, 2021 12:01
@ecgan ecgan changed the title Set BRANCH_BASE for bundlewatch on push events, Set CI_BRANCH_BASE for bundlewatch on push events Jul 8, 2021
@ecgan
Copy link
Member

ecgan commented Jul 8, 2021

Putting some additional notes here after discussion with @tomalec . Bundlewatch uses ci-env package. When the Travis event type is a push event, the pull_request_target_branch in ci-env will be an empty string - see https://github.com/siddharthkp/ci-env/blob/bccc71df40b351d7aa0bd4680fec566302c9bbcf/index.js#L28-L35.

pull_request_target_branch is used by bundlewatch in https://github.com/bundlewatch/bundlewatch/blob/98b7b789d40032b301351d2c0b02a1c443db2b7a/src/app/config/getCIVars.js#L10. Because of the empty string in push event, bundlewatch will use master as the repoBranchBase. See https://github.com/bundlewatch/bundlewatch/blob/98b7b789d40032b301351d2c0b02a1c443db2b7a/src/app/config/getConfig.js#L17. Our repo does not have master branch, which is why this can be a problem in push events.

Push events can happen when we merge a pull request from a feature branch into trunk branch - a commit is pushed onto trunk, triggering build.

Specifying the CI_BRANCH_BASE should work as it take precedence over pull_request_target_branch provided by ci-env. See https://github.com/bundlewatch/bundlewatch/blob/98b7b789d40032b301351d2c0b02a1c443db2b7a/src/app/config/getCIVars.js#L10.

Copy link
Member

@ecgan ecgan left a comment

Choose a reason for hiding this comment

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

LGTM. I think we can go ahead and try this out. 🚀

@tomalec tomalec merged commit d55175d into trunk Jul 8, 2021
@tomalec tomalec deleted the fix/bundlewatch-branchbase branch July 8, 2021 18:39
@tomalec
Copy link
Member Author

tomalec commented Jul 8, 2021

🎉 trunk successfully saved
https://travis-ci.com/github/woocommerce/google-listings-and-ads/jobs/522969367#L14739-L14742

[INFO] Retrieving comparison
[INFO] Saving results
Result breakdown at: https://ja2r7.app.goo.gl/djV9Xzt7VeqWDNfQA

cheeaun added a commit to cheeaun/phanpy that referenced this pull request Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants