I am running into a bug after upgrading from v4 to v7 because of the change in v5 by @GrantBirki
|
Now both methods are consistent: |
|
|
|
- **By name**: `name: my-artifact` → extracted to `path/` (unchanged) |
|
- **By ID**: `artifact-ids: 12345` → extracted to `path/` (updated - now direct) |
|
|
|
Note: This change also applies to patterns that only match a single artifact. |
However there was also an unmentioned change when downloading all artifacts i.e. not specifying a given name or id. The documentation says that in this case a directory will be created for each artifact:
|
### Download All Artifacts |
|
|
|
If the `name` input parameter is not provided, all artifacts will be downloaded. To differentiate between downloaded artifacts, by default a directory denoted by the artifacts name will be created for each individual artifact. This behavior can be changed with the `merge-multiple` input parameter. |
|
|
|
Example, if there are two artifacts `Artifact-A` and `Artifact-B`, and the directory is `etc/usr/artifacts/`, the directory structure will look like this: |
|
|
|
``` |
|
etc/usr/artifacts/ |
|
Artifact-A/ |
|
... contents of Artifact-A |
|
Artifact-B/ |
|
... contents of Artifact-B |
|
``` |
And the log says the same:
No input name, artifact-ids or pattern filtered specified, downloading all artifacts
An extra directory with the artifact name will be created for each download
Preparing to download the following artifacts:
...
However this is not what is happening! If we download all artifacts, but there happens to be only one, it does not create the subdirectories anymore and all files are extracted into the root dir.
This is a bug: when we need all artifacts and we do not give a specific a name or id, and we use the default merge-multiple: false then the correct behavior is creating a subdirectory per artifact, regardless of how many there are.
Problem
My workflow generates a variable number of artifacts. Usually it is quite a few, but sometimes just a single. We don't know in advance.
The deploy step downloads all of the artifacts into their own directory, and iterates over them to deploy each of them. However as of download-artifact@v7 the behavior became inconsistent for the case when there was just a single artifact, because download-artifact no longer creates a directory but instead extracts all the files from the single artifact into the working dir.
This is unfortunate in my case because I don't know in advance how many artifacts we will have. Is there a way to mimic the old v4 behavior: download all artifacts, each into it's own dir. Even when there is only one?
Why is this needed?
In case of a dynamic number of artifacts, the download-artifact@v7 special behavior for the n=1 case is inconsistent and causes programming errors.
I am running into a bug after upgrading from v4 to v7 because of the change in v5 by @GrantBirki
download-artifact/README.md
Lines 42 to 47 in 37930b1
However there was also an unmentioned change when downloading all artifacts i.e. not specifying a given name or id. The documentation says that in this case a directory will be created for each artifact:
download-artifact/README.md
Lines 213 to 225 in 37930b1
And the log says the same:
However this is not what is happening! If we download all artifacts, but there happens to be only one, it does not create the subdirectories anymore and all files are extracted into the root dir.
This is a bug: when we need all artifacts and we do not give a specific a name or id, and we use the default
merge-multiple: falsethen the correct behavior is creating a subdirectory per artifact, regardless of how many there are.Problem
My workflow generates a variable number of artifacts. Usually it is quite a few, but sometimes just a single. We don't know in advance.
The deploy step downloads all of the artifacts into their own directory, and iterates over them to deploy each of them. However as of
download-artifact@v7the behavior became inconsistent for the case when there was just a single artifact, becausedownload-artifactno longer creates a directory but instead extracts all the files from the single artifact into the working dir.This is unfortunate in my case because I don't know in advance how many artifacts we will have. Is there a way to mimic the old v4 behavior: download all artifacts, each into it's own dir. Even when there is only one?
Why is this needed?
In case of a dynamic number of artifacts, the
download-artifact@v7special behavior for the n=1 case is inconsistent and causes programming errors.