TLDR: Two jobs in the same workflow call the latest artifacts endpoint. The first gets the correct artifacts, the second gets an empty array.
I’m experiencing a similar issue, however in my case the trouble is that the api call to fetch the latest artifacts sometimes returns the expected data, and other times it is empty.
create job generates some dynamic text and stores it in a file, which is artifacted
list job calls the /api/v1.1/project/github/user/project/latest/artifacts endpoint and outputs the result
show job calls the same endpoint as list, but it stores the result in a file for later parsing
While the api call in list routinely outputs the expected response with a single artifact, the show job has always (thus far) received an empty array of artifacts.
We’re running into this issue as well. It seems to have started when we split our workflow into jobs and the job that produces the artifacts finishes before the others.
We’re looking at a workaround using https://circleci.com/api/v1.1/recent-builds but it would be nice to know if this can be solved another way, for example with an api argument to specify which job to get the artifacts from?
I opened up a new thread over here and filed a support ticket.
Support confirmed the behavior that I was seeing w/ artifacts: for an active branch this isn’t a great way to get artifacts because each new build appears to clear out the artifacts (it’s almost like the completed filter doesn’t work at all)
I posted a potential workaround w/ the v1 API in my thread. There may also be a way to retrieve this data w/ the graphql API or the v2 API (if you can figure out the best way to get a list of jobs) but I haven’t figured it out yet (love if someone else finds a better way)