Comments (5)
Closing this issue as the behavior is now implemented. Thanks folks !
from upload-artifact.
Yes ! The most important for me is that the step does not fail if the folder is empty or does not exist, that's awesome @konradpabjan thanks ! I'll try it out.
from upload-artifact.
@ax4 Thanks for this awesome [feature request]! I have benefit from this v2-preview feature to conditional upload my artifacts! Thank you so much!
But I would like to add one more question, is there any environmental variable where I could set the warning-level lower, so I don't need to see the warning shows up? Since some "no files" behavior is known to our team's workflow, maybe it's not too important to see those missing uploads. But for those important files expected, a warning of missing is still wanted? - that means a customizable warning-level setting would be nice! Thank you!
Hi, I would like to share my fix to my own problem! So people coming to this issue could read different fixes to their own specific needs.
It looks clear from @konradpabjan 's answer that after the release of v2-preview
on Mar 20, it is said:
Behind the scenes, we use glob patterns to evaluate the provided path (instead of checking for the directory) so if no files are found to upload, no artifact will be uploaded and a warning will show up. Most importantly, the upload step also won't fail.
And from the issue tracker #62 we could read @konradpabjan 's another comment there #62 (comment) on April 28, says:
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
Therefore, so far, it's very clear that upload-artifact@v2
is ready-to-use!
- BTW, in the official document of https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts the examples are still using artifact!@v1 as examples. 😉
Then back to the question of whether to use and how to use conditional uploads, with and without given the warning. I would suggest the following three steps (as a better practice):
- use
upload-artifact@v2
, which will give you a better experience of the file (artifact) upload:
i. it uses glob patterns (or called wildcard pattern to search file: wiki-glob(programming)
ii. it gives a warning if no file is found, like ⚠No files were found for the provided path. No artifacts will be uploaded.
iii. the job won't fail, so it will not bring down the workflow (at the most time) - carefully read the warnings! and don't over-use the
upload-artifact@v2
and Annotations (where gh actions will display the warnings at). After reading the warnings, please think twice about the following:
i. what reason and what behavior caused the missing artifact file.
ii. is this behavior known as normal (expected success)? or is it considered as a real error (expected error message)?
iii. do you wish to skip this empty upload byif
property? - write your conditions in the
if
part to correct a better and reduced warning logs:
i. in the README part, it only saysif: failure()
link
ii. but actually it does support morecontext and expression
defined by two official documents
iii. Context and expression syntax for GitHub Actions
iv. workflow syntax: jobs.<job_id>.steps.if
I did the above three steps, to fix my own workflow, as (Permalink here):
- name: Upload .dmg file (if any exists)
if: ${{ runner.os == 'macOS' }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}.dmg
path: build/*.dmg
So hope this long comment will help you! Enjoy!
from upload-artifact.
Thanks for the suggestion @Niceplace!
We recently released the v2-preview
, more information can be found here: #62
The behavior has changed significantly between v1
and I think your specific problem can be solved. With v2-preview
, you can use wildcards so you try something like this:
uses: actions/upload-artifact@v2-preview
with:
name: cypress-screenshots
path: cypress/screenshots/* # or maybe cypress/**/*
Behind the scenes, we use glob patterns to evaluate the provided path (instead of checking for the directory) so if no files are found to upload, no artifact will be uploaded and a warning will show up. Most importantly, the upload step also won't fail.
Would this new behavior work?
from upload-artifact.
Thanks for this awesome [feature request] ! I have benefit from this v2-preview feature to conditional upload my artifacts! Thank you so much!
But I would like to add one more question, is there any environmental variable where I could set the warning-level lower, so I don't need to see the warning shows up? Since some "no files" behavior is known to our team's workflow, maybe it's not too important to see those missing uploads. But for those important files expected, a warning of missing is still wanted? - that means a customizable warning-level setting would be nice! Thank you!
from upload-artifact.
Related Issues (20)
- @v4 breaks workflows when using unprivileged containers HOT 3
- [bug] v4.3.1: Unexpected token '<', "<!DOCTYPE "... is not valid JSON HOT 9
- [feat req] support colon in file names HOT 1
- Add option to include explicit directory entries [feat req] HOT 1
- [feat req] merging of uploads ala v3 HOT 3
- Delete Artifact Action HOT 1
- #331
- [bug] Request failures in v4 on ECONNRESET and 403 Forbidden. HOT 5
- Temporary/intermediate artifacts HOT 2
- [bug] Failed to CreateArtifact: Failed to make request after 5 attempts: Request timeout HOT 2
- Rename the files after/before uploading
- [bug] Artifact overwrite doesn't always work HOT 2
- [bug]
- [bug] v3 and v4 hang 100% uploading from macos-13 runner following CPACK_GENERATOR "DragNDrop"
- Getting Dependabot Alert HOT 2
- [bug] all artifacts are not getting uploaded.
- [ci] `.github/workflows/codeql-analysis.yml` uses a `deprecated` version of `Node.js`
- [bug] Only contents of macOS-Application (***.app) get uploaded
- [bug]
- [bug] retrying a workflow causes uploaded artifacts from the previous attempt to become inaccessible
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upload-artifact.