buildkite / buildkite/agent

Artifact download doesn’t use most recent artifact when names collide

Open
#803 6 comments 0 reactions 0 assignees View on GitHub
artifacts bug
Dominant language
Go
Stars
1.1k
Forks
378
Avg merge
2d 6h
Merged PRs (30d)
74

Description

Take the following scenario
```sh
$ ls logs
logfile.txt
```

```yml
steps:
- command: exit 0
artifact_paths:
- "logs/*"
- "logs/*"
```

`logfile.txt`, is uploaded twice by the agent and It's stored twice in the backend:
Downloading with `buildkite-agent artifact download logs/logfile.txt logs/` says
```
Failed to download artifacts: GET https://agent.buildkite.com/v3/builds/xxx/artifacts/search?query=logs%2Flogfile.txtl:
400 Multiple artifacts were found for query: `logs/logfile.txt`. Try scoping by the job ID or name.
```

Is this the correct behaviour? Should't filter the agent dup files when expanding paths?

Also, **i think** (not sure) executing this in the `command` for the same job may result in 3 files with the same sha
```sh
buildkite-agent artifact upload "logs/logfile.txt"
```

Should backend dedup files with the same sha for the same job?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the duplicate-path scenario with the shown artifact_paths configuration and the artifact upload/download commands. Trace artifact path expansion, upload storage, and the search endpoint behavior; done means the project has a tested, explicit result for colliding artifacts and same-job duplicates.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.