Thanks for the feedback! Not sure if it’s something that we can work on but it sound very interesting. Would you mind creating this feature request in the agent repo?
I would like to bring this idea back to the table. We are currently looking for this to download some snapshots on main and the amount of extra code needed to achieve this feels suboptimal.
Hi @Valkum I totally understand you and I wanted to check if you explored using the bk cli as an alternative as I believe this should be a bit easier
I tested with this
It finds the last passed build for the given pipeline and branch, then downloads the artifacts into a folder called artifacts-build-{number} in your current directory. I tested this and it picks up the latest passed build each time it runs.
This also does not look like an improvement over talking to the API endpoints using curl to get the artifact URL from builds. It still requires a subshell to extract a build number.
The docs of bk artifacts download already say
```
BuildNumber string `help:"Build number containing the artifact. If omitted, the most recent build on the current branch will be used." short:"b" name:"build"`
So, if that command could get a branch argument, this would be enough to power this feature request.
The last wish would be a way to avoid the requirement to hand in an API token. The job token should be enough. Though this comes with security implications, I believe.