For hand deployments it could be useful feature.
buildkite-agent artifact download --pipeline myPipName --branch myBranchName --last-passed arfifactPath .
to download the given artifact from the last passed build for the given pipeline and branch name.
It will be indeed really useful in case we want to download a test report.
paula
October 24, 2022, 12:34pm
3
Hey!
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 ?
Thanks!
I will think about it.
Meanwhile, I created a script using the GraphQL API to download an artifact on the latest success build of the main branch:
#!/bin/bash
response=$(curl -s https://graphql.buildkite.com/v1 \
-H "Authorization: Bearer $BUILDKITE_API_ACCESS_TOKEN" \
-d '{"query":"{pipeline(slug:\"myorg/mypipeline\"){builds(branch:\"main\",state:PASSED,first:1){edges{node{jobs(first:1,step:{key: \"knapsack\"}){edges{node{ ... on JobTypeCommand{artifacts{edges{node{downloadURL}}}}}}}}}}}}"}')
artifact_url=$(grep -E -o "https://[^ \"]+" <<< "$response")
curl -s $artifact_url > knapsack_rspec_report.json
I will create a private plugin to wrap it.
1 Like