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

Bump artifact dependencies #2482

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

angelapwen
Copy link
Contributor

@angelapwen angelapwen commented Sep 13, 2024

We need to bump actions/upload-artifact and actions/download-artifact to v4 in our PR checks, as v3 will be deprecated in November: https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/

To do so, we also need to bump @actions/artifact to v2, but it is not yet supported on GHES: https://www.npmjs.com/package/@actions/artifact#v2---whats-new

This PR:

  • imports @actions/artifact@v1 as artifact-legacy and imports @actions/artifact@v2 as artifact
  • uses the non-legacy version of the artifact dependency when not running on GHES, and the legacy version on GHES
  • bumps our usages of upload-artifact and download-artifact to v4

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.

We can do this now that we have upgraded to `@actions/artifact@v2`; note that on GHES we are still using `@actions/artifact@v1`, but our PR checks are not running on GHES.
@angelapwen angelapwen mentioned this pull request Sep 13, 2024
3 tasks
@angelapwen angelapwen added the Update dependencies Trigger PR workflow to update dependencies label Sep 13, 2024
@github-actions github-actions bot removed the Update dependencies Trigger PR workflow to update dependencies label Sep 13, 2024
Copy link
Contributor

Pushed a commit to update the checked-in dependencies. Please mark the PR as ready for review to trigger PR checks.

@angelapwen angelapwen marked this pull request as ready for review September 13, 2024 19:22
@angelapwen angelapwen requested a review from a team as a code owner September 13, 2024 19:22
@angelapwen
Copy link
Contributor Author

💭 People who have workflows using download-artifacts@v3 will no longer be able to access the debug artifacts that way (they will need to use @v4) — I'm not sure how many users do that as usually the debug artifacts are more of a manual inspection sort of thing. If we think enough people do that we could add a changenote.

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.

Nice. Some suggestions inline.

+2,174,754 −72,459

Productive day! 🎉 😄

Comment on lines 22 to 24
if (config !== undefined) {
await debugArtifacts.uploadCombinedSarifArtifacts(config);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we warn when config === undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure actually: elsewhere when we see that config is undefined, it indicates that the init step didn't succeed successfully. Since this is the analyze-post step, the init step should have succeeded. So it seems unlikely that anyone will ever end up in this state.

That made me think of something else though.. will post a separate comment.

Comment on lines 164 to 170
sanitizeArifactName(`${artifactName}${suffix}`),
toUpload.map((file) => path.normalize(file)),
path.normalize(rootDir),
{
continueOnError: true,
// ensure we don't keep the debug artifacts around for too long since they can be large.
retentionDays: 7,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the arguments here and below are the same. If so, I'd like to make that explicit by only specifying them once. And if they aren't the same, I'd like it to be clear where the differences are. You could probably do something like:

const artifactUploader = (ghVariant === GitHubVariant.GHES 
  ? artifactLegacy.create()
  : new artifact.DefaultArtifactClient())

artifactUploader.uploadArtifact(...args...);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're almost the same, except the new client no longer accepts continueOnError as an option 😬 I might be able to use the ternary operator to append the continueOnError only for the legacy client.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, it looks like the default behavior of the legacy client is to set continueOnError to true. So we don't have to specify it and the args can be the same!

.create()
.uploadArtifact(
if (config.gitHubVersion.type === GitHubVariant.GHES) {
await artifactLegacy
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here as above.

Comment on lines 21 to 24
const config = await getConfig(getTemporaryDirectory(), logger);
if (config !== undefined) {
await debugArtifacts.uploadCombinedSarifArtifacts(config);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thinking out loud: Since config gets set in init, and this is only supposed to run in third-party analysis runs, config will always be undefined here. So I think we actually need to determine the GH variant separately here.

@angelapwen
Copy link
Contributor Author

Holding on this as I investigate internal reports that #2475 has caused some regressions

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