Closed DanTup closed 2 months ago
Actually, it seems this is called out here:
The contents of an Artifact are uploaded together into an immutable archive. They cannot be altered by subsequent jobs. Both of these factors help reduce the possibility of accidentally corrupting Artifact files.
It just wasn't included in the "What's changed" section of the Dependabot release notes because it just has a summary saying "Lots has changed". I should've followed the link through.
Seems like this is certainly intended though.
Well, this is a bad news for me. I find convenient to use the upload-artifact
to write different files to the same folder in a build matrix. For example to compile custom C extensions for several combinations of Python versions and operating systems, and publishing to a single folder.
like in https://github.com/Neoteroi/BlackSheep/actions/runs/7370452109/job/20056867940
Now if I want to upgrade my workflow, I need to publish to different folders and download artifacts from multiple sources - making the workflow look like a mess compared to how clean it used to look like. For now I stay with v3
and I hope this will be reconsidered in a future version of these actions.
Yeah, I rolled back to v3 too. Until I'm forced to upgrade, the old way is much more convenient for me.
I had to roll back also
Same here, I also use a matrix to build multi platform releases in the same directory, and then zipping them all together, rolling back to v3 :(
Seems like a lot of people have been bitten by this, so although it appears to have been deliberate I'm re-opening for better visibility to see if the authors want to chime in (of course, it's very possible it may just be closed as WAI).
The behaviour of several jobs saving different files, with different names, but in the same directory, to be downloaded from a single archive once all the jobs succeeded, was very desireable and didn't require the use of actions/download-artifact
.
Moving to using v4 seems a major change which, for the moment, we will avoid.
There were only 27 commits according to the v4.0.0 release notes.
Breaking changes (and this definitely is a breaking change) should absolutely be called out in major version bump releases' release notes.
It's explicitly included in the readme: https://github.com/actions/upload-artifact?tab=readme-ov-file#breaking-changes
That same text should absolutely be included in the release notes.
Conveniently GitHub lets you rewrite release notes at any time, so this can and should be fixed.
@robherley you wrote "Blog post coming soon!" in https://github.com/actions/upload-artifact/pull/466#issue-2040382024, I presume that's: https://github.blog/changelog/2023-12-14-github-actions-artifacts-v4-is-now-generally-available/
But it'd be really good if you had added a comment in the PR itself instead of forcing people to Google for it. (You could also include a link to the blog post in the release notes.)
Beyond that, most of its content, which I will excerpt below should be in the release notes, and probably in the readme. Note that the readme content does not match the blog post.
Blog post first:
- Artifacts will be scoped to a job rather than a workflow. This allows the artifact to become immediately available to download from the API after being uploaded, which was not possible before.
- Artifacts
v4
is not cross-compatible with previous versions. For example, an artifact uploaded usingv3
cannot be used withactions/download-artifact@v4
.- Using
upload-artifact@v4
ensures artifacts are immutable, improving performance and protecting objects from corruption, which would often happen with concurrent uploads. Artifacts should be uploaded separately and then downloaded into a single directory using the two new inputs,pattern
andmerge-multiple
, available indownload-artifact@v4
. These objects can then be re-uploaded as a single artifact.- A single job can upload a maximum of 10 artifacts.
Readme:
- On self hosted runners, additional firewall rules may be required.
- Uploading to the same named Artifact multiple times. Due to how Artifacts are created in this new version, it is no longer possible to upload to the same named Artifact multiple times. You must either split the uploads into multiple Artifacts with different names, or only upload once. Otherwise you will encounter an error.
- Limit of Artifacts for an individual job. Each job in a workflow run now has a limit of 10 artifacts.
My data point against v4: Generating documentations. I have a matrix of jobs (for different versions of build environments), each generates a documentation. I don't want to specify "only generate the docs on this particular version", as the matrix of versions change frequently. I don't care "which" job overwrites the docs generated by "which" other job, as the docs are mostly the same: Just give me any one of them.
The "correct" way of doing things: Name each artifact after the job matrix. But: The jobs matrix is specified by the docker images e.g. "username/repo:version", which is a bad filename. I really don't want to write a script just to compute a valid filename for the artifact.
Same here, just rolled back to v3 π
Just want to chip in that this caused a lot of issues for our company as well.
π @RobertoPrevato For your example, you don't have to make too many changes, e.g.
Change that line to:
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.python-version }}
path: dist
Then, in your publish job:
You can have it download all the artifacts matching a pattern to the same directory:
- name: Download a distribution artifact
uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist
This case is outlined in the migration document: https://github.com/actions/download-artifact/blob/main/docs/MIGRATION.md
I'm happy to help any others with their workflow scenarios, thanks all for the feedback!
@robherley Thank You! I appreciate your help very much, I try that as soon as I get the time.
@robherley
Uploads and downloads must use the same actions versions.
It isn't obvious that you mean "the same major action version." -- If that's what's intended.
@robherley saved my life to not downgrading to v3! Thanks!
I rolled back to v3, too.
Solution provided in the comment, work just fine for v4 actions
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: dist
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist
I rolled back to v3, too. Anyone knows any alternative repo for that - maybe a fork based on v3 ???? (update) . I started thinking about my own v4 fork and removing that "feature" .Checking now how hard will be to keep my fork synchronised with this repo
@robherley in https://github.com/actions/upload-artifact/issues/478#issuecomment-1885470013 you pointed to: https://github.com/actions/download-artifact/blob/main/docs/MIGRATION.md
I believe I've made a faithful reproduction of your workflow (v3 and v4), and it is not a drop-in replacement. https://github.com/check-spelling-sandbox/artifact-merge-hell/actions/runs/7729203589/job/21071843037
-Run ls -R my-v3-artifact
-my-v3-artifact:
-my-v3-artifact
-
-my-v3-artifact/my-v3-artifact:
+Run ls -R my-v4-artifact
+my-v4-artifact:
file-macos-latest.txt
file-ubuntu-latest.txt
file-windows-latest.txt
Since paths are how people find files, the fact that the paths do not match would break anyone trying to use it.
I'm not sure that's precisely why I gave up, but I can assure you it is one of the problems I encountered.
π @jsoref apologies, I had a typo in the migration docs.
The reason why you have an extra my-v3-artifact/my-v3-artifact
in the v3 download is the behavior outlined here in the v3 docs.
If the name input parameter is not provided, all artifacts will be downloaded. To differentiate between downloaded artifacts, a directory denoted by the artifacts name will be created for each individual artifact.
These lines should be:
with:
name: my-artifact
path: my-artifact
In v4, this behavior is now toggleable with the merge-multiple
parameter.
I'll update the migration docs to include the name
parameter.
Thanks, with that change, the results now do look compatible: https://github.com/check-spelling-sandbox/artifact-merge-hell/actions/runs/7730117258
Looks like a https://github.com/actions/upload-artifact/tree/main/merge should be solution for this problem. PR https://github.com/actions/upload-artifact/pull/505
Take a look at https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md#overwriting-an-artifact
- name: New override option
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: ./example
overwrite: true
Solution provided in the comment, work just fine for v4 actions
- name: Upload artifacts uses: actions/upload-artifact@v4 with: name: dist-${{ matrix.os }} path: dist - name: Download artifacts uses: actions/download-artifact@v4 with: pattern: dist-* merge-multiple: true path: dist
It works like a charm, thank you!
Here is an example how it could be solved for BigBlueButton: https://github.com/bigbluebutton/bigbluebutton/pull/19777/commits/0f726d53d6e2795e31ff1500b2e02705ed3d4f8f.
Rolling back to v3 as well :( actions/upload-artifact@v4 broke the entire pipeline, and none of the mentioned solutions solved our problem. In our workflow, we run parallel jobs in matrix strategy that generate loads of files that were uploaded into a single results folder in v3. With v4, in our parallel job, we upload a large number of folders with unique names and use one more job action/upload-artifact/merge@v4 to merge these folders into a single one that is downloadable through the UI. The solution technically works but is unsuitable for us because we are getting all the artifact folders from parallel jobs uploadable through the UI, which we don't need, and it makes a big mess in our artifacts.
Also had to revert to v3 here https://github.com/microsoft/cppwinrt/pull/1409
@kryshenp, @kennykerr, it's not necessary (and also not a good idea) to revert to v3 (which will stop working in the future). Read my comment above how to fix your code to make v4 working.
Hi,
At first I was also surprise from this breakage, yes it creates an effort of migration and unexpected, I also immediately reverted, but while thinking of it realized why it was done and migrated our usage.
The previous implementation was probably a mistake, the new implementation is more consistent.
The advantages of the new stateless implementation:
I hope the above helps to understand the WHY, it is easier to perform migration when we understand the WHY.
Thanks, Alon
It was just announced that v3 will be disabled on 2024-11-30.
https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/
It is disappointing that the disabling of v3 was announced before v4 reaching feature-completeness.
We are having the same issue
Then update your code. The description how to do that can be found above.
Take a look at
main
/docs/MIGRATION.md#overwriting-an-artifact- name: New override option uses: actions/upload-artifact@v4 with: name: build-artifact path: ./example overwrite: true
Thanks for the notice! Seems like #501 has fixed the issue here.
If your old configuration merged the artifacts, then overwrite: true
would be the wrong choice. Use merge-multiple: true
.
I worked around this problem by appending ${{ github.run_number }}-${{ github.run_attempt }}
to the artifact name. This guarantees a clean, traceable, unique name on every (re)run.
I'm setting overwrite: true
and still getting this am I missing something?
Run actions/upload-artifact@v4
with:
name: tf-module-cache-key-file
retention-days: 3
path: .terraform/modules/modules.json
overwrite: true
if-no-files-found: warn
compression-level: 6
With the provided path, there will be 1 file 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
@dreinhardt89: you shouldn't use overwrite: true
, you should give each of your artifacts a distinct name and then use the merge subaction: https://github.com/actions/upload-artifact/blob/main/merge/README.md
this migration guide should help? https://github.com/actions/download-artifact/blob/main/docs/MIGRATION.md
just an fyi to those holding onto v3
actions/upload-artifact@v3 is scheduled for deprecation on November 30, 2024
Unsure if this will stop your from staying v3 (incase something occurs github side at that date)
Yet another user here having to rollback to v3 due to this breaking matrix uploads.
Hopefully this gets addressed by Github before November...
@maks, read the instructions and the examples above. Update your code, then there is no need for a rollback.
@stweil thanks for letting me know, though it would have been easier if you had linked to the specific comment from @robherley which I somehow missed comment in the flood of comments on this issues history and yes using:
with:
name: ${{ matrix.output-name }}
that does indeed fix the issue for me too.
@maks, and almost all the flood is composed of the messages similar to your or mine ones π
Probably we should ask @DanTup to add a link to a mentioned solution in it's initial message?
See also my previous comment for a solution.
Probably we should ask @DanTup to add a link to a mentioned solution in it's initial message?
I added an edit to the top of the issue to the two comments mentioned directly above.
Closing this as I believe the issue is solved (I've since migrated to v4 and have the artifacts merged as I had previously with v3).
@DanTup I feel this migration so ugly.
Why it "just work" before, and now you need to do this strange shitty coding -_-
@tvorogme I don't disagree, but this ship has sailed and I don't have any ability to improve it (I'm not a contributor here, I'm just a user that was affected by this change).
So, what is the actual fix ? We must update to @v4 until 30 Nov.
Is this going to fix the issue ? And for download @v4.1.7 ?
(Edit: There are solutions posted in this thread such as at https://github.com/actions/upload-artifact/issues/478#issuecomment-1885470013, https://github.com/actions/upload-artifact/issues/478#issuecomment-2016557414, https://github.com/actions/upload-artifact/issues/478#issuecomment-2314875085)
What happened?
The PR from dependabot to upgrade to v4 is failing on my project with this error:
It seems like this is a breaking change that wasn't mentioned in the changelog and I'm not sure if it was deliberate.
There's some discussion about this behaviour in https://github.com/actions/upload-artifact/issues/279 and it suggests that it was fine to do this and there wouldn't be issues as long as the filenames within the artifact are unique. This was convenient to bundle the logs from several shards together into a single artifact rather than having lots of individual zip files to download.
What did you expect to happen?
I expected everything to work the same as in v3 unless it was noted as a deliberate breaking change.
How can we reproduce it?
Create multiple jobs that upload artifacts with the same name (but the files from each job are uniquely named).
Anything else we need to know?
No response
What version of the action are you using?
v4.0.0
What are your runner environments?
linux, window, macos
Are you on GitHub Enterprise Server? If so, what version?
No response