Solvedupload artifact Try out v2-preview

The v2-preview of upload-artifact is out and we need your help!

You can try it out by using actions/upload-artifact@v2-preview
Any associated code and documentation can be found here: https://github.com/actions/upload-artifact/tree/v2-preview

This issue is for general feedback and to report an bugs/issues during the preview

There is also a v2-preview for download-artifact πŸ˜€ see: actions/download-artifact#23

Warning: At any time during the preview, there may be unannounced changes that can cause things to break. It is recommended not to use the preview of this action in critical workflows


Historical Context around v2-preview and v1

The v1 versions of upload-artifact (and download-artifact ) are plugins that are executed by the runner. The code for v1 can be found here: https://github.com/actions/runner/tree/master/src/Runner.Plugins/Artifact

The v1 code is written in C# and is tightly coupled to the runner, it also uses special APIs that only the runner can use to interact with artifacts. If any changes or updates had to be made related to artifacts, they had to done on the runner and a new release had to roll out that would take a significant amount of time. With v2, there is no dependency on the runner so it will be much easier and faster to make changes and accept community contributions (right now it was pretty much impossible).

The v2-preview of upload-artifact has been rewritten from scratch using Typescript with a new set of APIs that allow it interact with artifacts (previously only the runner could do this). There is a new NPM package called @actions/artifact that contains the core functionality to interact with artifacts (which this action uses for the most part). This NPM package is hosted in the actions/toolkit repo so anyone can use this to interact with artifacts when developing actions. You can find the package here (lots of documentation and extra info):
https://www.npmjs.com/package/@actions/artifact
https://github.com/actions/toolkit/tree/master/packages/artifact

Further work

Since v2-preview is effectively a total rewrite from v1, There is a huge potential for bugs so it needs to be tested thoroughly before creating an actual v2 release. We need help testing the core functionality which includes:

  • Uploading an individual file
  • Uploading a directory
  • Uploading using wildcards

There will be no new features added as part of the v2-preview, we need to test the core functionality first and once a v2 release is out, then we can start chipping away at issues/features that we have been unable to address with v1πŸ™‚ For the moment, please don't submit PRs for any new features to the v2-preview branch.

Some initial observations from some internal testing show that v2-preview is slightly slower than v1 (around 10-15%). A large part of this discrepancy can be attributed to porting over from C# to Node. In C#, the runner would upload artifacts with Async Tasks and true multi-threading. With Node, the HTTP pipeline is not as efficient (we would love some help over in the toolkit repo for @actions/artifact if anyone is really good with TS, Aysnc/Await and HTTP pipelining to hopefully make this better)

30 Answers

βœ”οΈAccepted Answer

Hi, is it possible to upload multiple files w/ their original name - w/o being zipped?

something like this:

- name: UPLOAD TEST RESULTS
      uses: actions/upload-artifact@master
      if: always()
      with:
        paths: |
          tests/results/output.xml
          tests/results/log.html
          tests/results/report.html

The reason is I would like to access log.html and report.html directly in the browser w/o having to download .zip archive + unzip it locally + open it in browser to view it

Similar to how these guys do (you know who I mean πŸ˜‰ )
image

Other Answers:

Hey @konradpabjan is there any chance that we could get the URL of the artifact so that we can use it to drop a comment in the PR for example? I think that would be amazingly useful.

@gengjiawen See my earlier comment regarding zipping. It's a limitation with our UI currently so they will still appear compressed: #62 (comment)

@holytshirt if the provided path has a wildcard, everything past the first wildcard character will be used in the path for the artifact (I should probably document this behavior). Basically if you have something like this:

- uses: actions/upload-artifact@v2-preview
  with:
    name: my-artifact
    path: path/to/*/directory/something??-complex[abc].txt

and there are 3 files found, the upload structure would look like this

    path/to/*/directory/something??-complex[abc].txt =>
        ∟ path/to/some/directory/something12-complexa.txt
        ∟ path/to/some/directory/something12-complexb.txt
        ∟ path/to/other/directory/something12-complexa.txt

    would be flattened to =>
        ∟ some/directory/something12-complexa.txt
        ∟ some/directory/something12-complexb.txt
        ∟ other/directory/something12-complexa.txt

Throwing everything into a single folder with an optional flag could be an enhancement/addition post v2-preview.

v2 upload-artifact has been merged into master! Thanks everyone for the feedback and testing!
https://github.blog/changelog/2020-04-28-github-actions-v2-artifact-actions/

You can now use it by doing actions/upload-artifact@v2. I'll be deleting the v2-preview branch soon (probably in a week or so), so please switch over so your builds don't break.

Moving forward it should be a lot easier now to accept contributions and add features since this effectively decouples artifact upload from the runner