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 #5407: Fix Bazel CI runs on develop #5408

Merged
merged 2 commits into from
May 23, 2024
Merged

Conversation

BenHenning
Copy link
Member

@BenHenning BenHenning commented May 22, 2024

Explanation

Fixes #5407

This introduces a proper fallback for the base branch used for computing affected tests when off-develop: origin/develop (which was the same base used prior to #4929 being merged).

This can't easily be verified without being merged, but I have high confidence it'll work since we've used the JavaScript || fallback syntax in GitHub workflow if conditionals in the past (and the environment should be the same for env variables).

Note that this is being fixed forward rather than reverted because the only verification is merging the PR, so it's actually faster and simpler to fix forward than to revert the original PR and re-submit a fix (which has the same likelihood of fixing CI as this fix forward).

Essential Checklist

  • The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

N/A -- This only affects CI infrastructure.

This can't be easily verified until it's merged, however I have high
confidence that this should fix it as we've done similar fallback syntax
for env variables in the past (e.g. '||') and 'origin/develop' was the
value previously used for the base commit when computing affected tests.
Copy link
Member Author

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Self-reviewed changes.

@BenHenning BenHenning marked this pull request as ready for review May 22, 2024 23:33
@BenHenning BenHenning requested a review from a team as a code owner May 22, 2024 23:33
@BenHenning
Copy link
Member Author

@adhiamboperes PTAL with priority as this will block all merged PRs from passing (it doesn't block PR merging or PR CI workflows since that part is still configured correctly).

@BenHenning
Copy link
Member Author

Enabling auto-merge since this seems like a straightforward fix and it'd be good to get this merged ASAP.

@BenHenning BenHenning enabled auto-merge (squash) May 22, 2024 23:34
Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@adhiamboperes
Copy link
Collaborator

Rerunning bazel tests since CI is stuck.

Copy link

oppiabot bot commented May 23, 2024

Hi @BenHenning, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks!

@BenHenning
Copy link
Member Author

Looks like the CI workflow change actually isn't valid:

[Invalid workflow file: .github/workflows/unit_tests.yml#L80](https://github.com/oppia/oppia-android/actions/runs/9199774806/workflow)
The workflow is not valid. .github/workflows/unit_tests.yml (Line: 80, Col: 29): Unexpected symbol: '"origin/develop"'. Located at position 39 within expression: github.event.pull_request.base.sha || "origin/develop"

Replace double quotes with single since single seems to be the proper one to use for strings in these contexts.
Copy link
Member Author

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Self-review quotes change.

I think switching to single quotes might fix the syntax error mentioned above.

@BenHenning
Copy link
Member Author

BenHenning commented May 23, 2024

Looks like it's passing now, and I've verified that the env looks correct:

  env:
    CACHE_DIRECTORY: ~/.bazel_cache
    compute_all_targets: false
    base_commit_hash: 24b17211a9d66447a3c9a6350aee5331eef1c1a3

Will verify again for develop once this is merged & will update the issue.

@BenHenning BenHenning merged commit a59ff53 into develop May 23, 2024
25 checks passed
@BenHenning BenHenning deleted the fix-develop-bazel-ci-runs branch May 23, 2024 17:48
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.

[BUG]: Bazel tests won't run on develop CI
2 participants