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

Add a way to bypass the toolcache for kotlin and swift #1394

Merged
merged 5 commits into from
Nov 25, 2022

Conversation

aeisenberg
Copy link
Contributor

@aeisenberg aeisenberg commented Nov 23, 2022

This works by moving the logic to check for toolcache bypass out of
creating the codeql instance. The logic now may perform an API request
in order to check what languages are in the repository. This check is
redundant because the same call is being made later in the action when
the actual list of languages is calculated.

Commit-by-commit review is suggested.

Even though it is inefficient to add this extra API call, I am leaning towards leaving it in because refactoring to perform only one API call would make the code messier, I ensure that the extra API call is made only if necessary, and we expect that this workaround will be temporary.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@aeisenberg aeisenberg requested a review from a team as a code owner November 23, 2022 23:00
@aeisenberg
Copy link
Contributor Author

I don't think this requires a change note.

This works by moving the logic to check for toolcache bypass out of
creating the codeql instance. The logic now _may_ perform an API request
in order to check what languages are in the repository. This check is
redundant because the same call is being made later in the action when
the actual list of languages is calculated.
@aeisenberg aeisenberg force-pushed the aeisenberg/bypass-toolcache-kotlin-swift branch from 476358e to f79028a Compare November 23, 2022 23:11
src/config-utils.ts Outdated Show resolved Hide resolved
src/feature-flags.ts Outdated Show resolved Hide resolved
src/feature-flags.ts Outdated Show resolved Hide resolved
src/util.ts Outdated Show resolved Hide resolved
src/languages.ts Show resolved Hide resolved
src/languages.ts Outdated Show resolved Hide resolved
@aeisenberg
Copy link
Contributor Author

I'm going to add a few more tests here since this logic is getting tricky.

src/testing-utils.ts Outdated Show resolved Hide resolved
@aeisenberg
Copy link
Contributor Author

I think I addressed all comments, added more tests, and fixed the bug I found. Hopefully, all tests will pass.

src/config-utils.ts Fixed Show fixed Hide fixed
Copy link
Contributor

@adityasharad adityasharad left a comment

Choose a reason for hiding this comment

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

One more suggestion, otherwise looks reasonable. I will let Henry or Angela do a more detailed review however.

@aeisenberg aeisenberg force-pushed the aeisenberg/bypass-toolcache-kotlin-swift branch from b36411b to 99d2473 Compare November 24, 2022 06:14
@aeisenberg aeisenberg force-pushed the aeisenberg/bypass-toolcache-kotlin-swift branch from 99d2473 to ad7ca9b Compare November 24, 2022 06:18
Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

This generally looks great.

Some questions:

  1. Should we revert this change once the next release is fully rolled out and we no longer need to bypass the toolcache for Kotlin / Swift? It does look like there's some complexity here that we wouldn't want to keep around.
  2. Do we want to add a PR check that runs some integration tests, or are we happy with the unit tests here? Personally I'd be ok with unit tests here plus some manual testing.

src/config-utils.test.ts Outdated Show resolved Hide resolved
src/config-utils.test.ts Show resolved Hide resolved
src/config-utils.ts Show resolved Hide resolved
src/feature-flags.ts Show resolved Hide resolved
src/feature-flags.ts Show resolved Hide resolved
src/util.test.ts Show resolved Hide resolved
src/util.test.ts Outdated Show resolved Hide resolved
src/util.ts Outdated Show resolved Hide resolved
If a user explicitly includes java in their language inputs, always
make an api call to check for kotlin in the repo.

Also, add some suggestions from code reviews.
@aeisenberg aeisenberg force-pushed the aeisenberg/bypass-toolcache-kotlin-swift branch from fede016 to 102e01d Compare November 24, 2022 20:33
@henrymercer henrymercer merged commit 7e73ded into main Nov 25, 2022
@henrymercer henrymercer deleted the aeisenberg/bypass-toolcache-kotlin-swift branch November 25, 2022 09:30
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.

4 participants