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: add a go-test option to upload coverage artifacts #316

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ozym
Copy link
Contributor

@ozym ozym commented Oct 29, 2024

This is to fix a breaking change in the v4 artifact upload action. It requires unique names for uploads, but if the action is called multiple times in a run it will hit this error. Options are have a unique name per run, or simply not do the upload. I expect a future action that simply does test coverage will would be a simpler option if needed.

@ozym ozym requested a review from a team October 29, 2024 20:58
@ozym ozym self-assigned this Oct 29, 2024
@ozym ozym added the bug Something isn't working label Oct 29, 2024
@wilsonjord
Copy link
Contributor

Hey @ozym , I think I already addressed this issue with: 12c9a58 (the overwrite flag)

@jajera
Copy link

jajera commented Oct 29, 2024

i think this is good to be optional. i'm not sure what is currently using this functionality and should we need to take action?

This is to fix a breaking change in the v4 artifact upload action. It requires unique names for uploads, but if the action is called multiple times in a run it will hit this error. Options are have a unique name per run, or simply not do the upload. I expect a future action that simply does test coverage will would be a simpler option if needed.
@@ -12,6 +12,13 @@ on:
type: string
description: |
extra args to pass `go test`
upload:
required: false
default: false
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: this is a breaking change. Current behavior is true. I doubt anyone's workflow would break, but I don't know.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it's breaking change to stop the breaking change that stopped what was working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is all about the test coverage output that goes at the bottom of the actions summary page, it isn't an artifact that we store it's more of an overview. But because we have actions that call this multiple times then it hits this bug.

Copy link
Contributor

Choose a reason for hiding this comment

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

as a compromise point can @ozym make the default true and pass in false in the workflows that have impacted your work?

Copy link

Choose a reason for hiding this comment

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

as a compromise point can @ozym make the default true and pass in false in the workflows that have impacted your work?

oh yeah, i think this is better.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it's breaking change to stop the breaking change that stopped what was working.

If this feature is needed to fixed what stopped working, sure. I can spend time figuring out what broke, how I could have caught it when doing the PR, and making the overwrite flag work the way we want it to work, at a later point.
FWIW: when creating unique names, I've used ${{ github.run_id }}${{ github.run_attempt }} as the disambiguation piece of information.

Copy link
Contributor Author

@ozym ozym Oct 29, 2024

Choose a reason for hiding this comment

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

The problem for setting it to true is that it will have a much wider impact, it can be done obviously. But would need to be added to all the actions that embed this action.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ozym setting it to false by default is ok. The "copy to s3" work needs to be revisited anyway due to the maximum reusable nesting limit of 4, so we can deal with the "optional" presence of the artifact in the rework.

@ozym
Copy link
Contributor Author

ozym commented Oct 29, 2024

@wilsonjord not sure the overwrite flag is working in that case.

@wilsonjord
Copy link
Contributor

i think this is good to be optional. i'm not sure what is currently using this functionality and should we need to take action?

@jajera I believe @CallumNZ was doing work on copying this artifact to s3 automatically, but I can't remember the status of this work

@ozym
Copy link
Contributor Author

ozym commented Oct 29, 2024

This is the error that's trying to be fixed.

Multiple search paths detected. Calculating the least common ancestor of all paths
The least common ancestor is /tmp. This will be the root directory of the artifact
With the provided path, there will be 2 files uploaded
Artifact name is valid!
Root directory input is valid!
Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run

@wilsonjord
Copy link
Contributor

wilsonjord commented Oct 29, 2024

@wilsonjord not sure the overwrite flag is working in that case.

From the migration doc (https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md):

In v4, Artifacts are immutable unless deleted. To achieve this same behavior, you can use overwrite: true to delete the Artifact before a new one is created:

I'm almost certain that I tested this behavior as well; do you mind linking the workflow that produced the error?

@ozym
Copy link
Contributor Author

ozym commented Oct 29, 2024

@wilsonjord not sure the overwrite flag is working in that case.

From the migration doc (https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md):

In v4, Artifacts are immutable unless deleted. To achieve this same behavior, you can use overwrite: true to delete the Artifact before a new one is created:

I'm almost certain that I tested this behavior as well; do you mind linking the workflow that produced the error?

https://github.com/GeoNet/field/actions/runs/11563929821/job/32188174573

@ozym
Copy link
Contributor Author

ozym commented Oct 29, 2024

The problem isn't that it has been overwritten, it's because there are now two outputs with the same name being attempted (two different parts of the run, i.e. each with it's overwritten output).

@wilsonjord
Copy link
Contributor

The problem isn't that it has been overwritten, it's because there are now two outputs with the same name being attempted (two different parts of the run, i.e. each with it's overwritten output).

I've been reading here: actions/upload-artifact#506
It may be what you are hitting. I didn't not test (or think) of this particular usecase.

@wilsonjord
Copy link
Contributor

@ozym To keep behavior as close as possible to previous v3 behavior, I think simply adding continue-on-error would be justified. You end up with undetermined knowledge of what job actually produced the final artifact, but that is what we had previously with v3. The downside is that you may miss another class of errors, but I would suggest the Upload test log step is not critical enough to make that distinction.

If continue-on-error is not preferred, then your PR as is (that is, making test coverage upload opt-in), is justified considering that v4 no longer supports parallel uploads to the same artifact - once the parallel job usecase is solved, I'm sure they can be turned back on (fyi @CallumNZ )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants