Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove toolcache decorator #1104

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

Merged
merged 2 commits into from
Jul 11, 2022
Merged

Conversation

henrymercer
Copy link
Contributor

This decorator enabled us to use the functionality of the Actions toolcache within the runner too. Now that we no longer release the runner we no longer need it.

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.

@henrymercer henrymercer force-pushed the henrymercer/remove-toolcache-decorator branch from a10c3a0 to ae0f195 Compare June 28, 2022 16:32
@henrymercer henrymercer marked this pull request as ready for review June 28, 2022 17:12
@henrymercer henrymercer requested a review from a team as a code owner June 28, 2022 17:12
@henrymercer henrymercer force-pushed the henrymercer/remove-toolcache-decorator branch 2 times, most recently from eaee63c to 41d6ac4 Compare June 28, 2022 17:22
@henrymercer henrymercer mentioned this pull request Jun 29, 2022
3 tasks
This decorator enabled us to use the functionality of the Actions
toolcache within the runner too.
Now that we've deleted the runner we no longer need it.
@henrymercer henrymercer force-pushed the henrymercer/remove-toolcache-decorator branch from 9953936 to b1742f8 Compare June 30, 2022 08:16
@henrymercer
Copy link
Contributor Author

Rebased to fix a merge conflict in one of the sourcemap files.

Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

I sometimes run the runner locally in order to test out changes before pushing them. Does this PR essentially break the runner? (Even if so, it's not a reason not to merge this change, but it's just something I'd like to be aware of.

@@ -14,8 +14,8 @@ npm run-script build
# Check that repo is still clean
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then the PR needs attention
>&2 echo "Failed: JavaScript files are not up to date. Run 'npm run-script build' to update"
>&2 echo "Failed: JavaScript files are not up to date. Run 'rm -rf lib && npm run-script build' to update"
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: We should probably just move rm -rf lib into the npm build script itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, wouldn't that break incremental compilation though?

Copy link
Contributor

Choose a reason for hiding this comment

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

Incremental compilation is done through tsc --watch. At least that's how I run it. tsc --build is always a full build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is tsc --build does some incremental stuff to speed itself up: https://www.typescriptlang.org/docs/handbook/project-references.html#build-mode-for-typescript. It's unfortunate tsc doesn't have support for deleting unneeded js/jsmap files, but I'd rather keep the distinction between a build and a clean build. Personally I chain npm run build into other commands and end up running it fairly frequently, but only delete TypeScript files rarely.

@henrymercer
Copy link
Contributor Author

Does this PR essentially break the runner?

To an extent, yes. All the PR checks that involve the runner continue to work, but the runner can no longer manage its own CodeQL bundle.

Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

This would also be a good time to uninstall any unused dependencies.

Are these still being used?

import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as io from "@actions/io";
import * as actionsToolcache from "@actions/tool-cache";
import * as safeWhich from "@chrisgavin/safe-which";
import del from "del";
import * as semver from "semver";
import { v4 as uuidV4 } from "uuid";

If not, then let's remove them from the node_modules. I guess it can be in a future PR, but let's not forget them.

@henrymercer
Copy link
Contributor Author

This would also be a good time to uninstall any unused dependencies.

Good idea. I checked and these dependencies are all still being used.

@henrymercer henrymercer requested a review from aeisenberg July 1, 2022 17:24
Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

Minor comment. This can be merged without making the change, especially if there is a reason for doing this that I'm not seeing.

Comment on lines +474 to +477
const finalHeaders = Object.assign(
{ "User-Agent": "CodeQL Action" },
headers
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this header not being set previously? Is there any reason why you are creating a new object here and not setting "User-Agent" when you initially create the headers object?

eg-

        const headers: OutgoingHttpHeaders = {
          accept: "application/octet-stream",
          "User-Agent": "CodeQL Action"
        };

Copy link
Contributor Author

@henrymercer henrymercer Jul 11, 2022

Choose a reason for hiding this comment

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

This is just existing code being moved — we can take this as an opportunity to revisit it though. Since this PR has been open for a while, I'll merge without making the change since I'd like to get a confirmation that the toolcache isn't expecting this particular user agent.

@henrymercer henrymercer merged commit ea8fb21 into main Jul 11, 2022
@henrymercer henrymercer deleted the henrymercer/remove-toolcache-decorator branch July 11, 2022 16:54
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.

2 participants