Buildkite CLI can not download Buildkite artifact
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 378
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 74
Description
**Is your feature request related to a problem? Please describe.**
The Buildkite CLI is failing to download artifacts. [Official docs](https://badge.buildkite.com/docs/agent/v3/cli-artifact#downloading-artifacts-artifact-download-examples) describe the command:
```
Downloading a specific file into a specific directory (note the trailing slash):
buildkite-agent artifact download build.zip tmp/
```
**Describe the solution you'd like**
According to the docs to download the artifact `myapp` into `go/myapp/myapp` I would expect the following command to work (the destination is the directory with a trailing slash `go/myapp/`):
```
$ mkdir go/myapp
$ buildkite-agent artifact download myapp go/myapp/
2023-06-12 09:00:52 INFO Searching for artifacts: "myapp"
2023-06-12 09:00:52 INFO Found 1 artifacts. Starting to download to: /workdir/go/myapp
2023-06-12 09:00:52 WARN Error trying to download https://mybucket/myapp (Failed to create file /workdir/go/myapp (*fs.PathError: open /workdir/go/myapp: is a directory)) Attempt 1/5 Retrying in 5s
2023-06-12 09:00:57 WARN Error trying to download https://mybucket/myapp (Failed to create file /workdir/go/myapp (*fs.PathError: open /workdir/go/myapp: is a directory)) Attempt 2/5 Retrying in 5s
2023-06-12 09:01:02 WARN Error trying to download https://mybucket/myapp (Failed to create file /workdir/go/myapp (*fs.PathError: open /workdir/go/myapp: is a directory)) Attempt 3/5 Retrying in 5s
2023-06-12 09:01:08 WARN Error trying to download https://mybucket/myapp (Failed to create file /workdir/go/myapp (*fs.PathError: open /workdir/go/myapp: is a directory)) Attempt 4/5 Retrying in 5s
2023-06-12 09:01:13 WARN Error trying to download https://mybucket/myapp (Failed to create file /workdir/go/myapp (*fs.PathError: open /workdir/go/myapp: is a directory)) Attempt 5/5
2023-06-12 09:01:13 ERROR Failed to download artifact: Failed to create file /workdir/go/myapp (*fs.PathError: open /workdir/go/myapp: is a directory)
2023-06-12 09:01:13 FATAL Failed to download artifacts: There were errors with downloading some of the artifacts
```
It is attempting to download the artifact to `go/myapp` instead of `go/myapp/myapp`. Of course the destination is a directory, this is why I explicitly indicated this with the trailing slash.
**Describe alternatives you've considered**
I would expect that by not specifying the trailing slash, I can indicate the destination file `go/myapp/myapp` explicitly:
```
buildkite-agent artifact download myapp go/myapp/myapp
2023-06-12 08:51:29 FATAL Failed to download artifacts: Could not find information about destination: /workdir/go/myapp/myapp stat /workdir/go/myapp/myapp: no such file or directory
```
Of course the destination file does not exist yet, because I have not downloaded it yet.
**Additional context**
/
Contributor guide
Assessment
This issue has not been assessed yet.