Fail if an artifact doesn't exist on upload

#1

Is there a way to ensure artifacts exists before giving a success to the step? I’d like to avoid [[ -f ARTIFACT ]] checks in the commands area.

We’re doing a tar of a build directory and sometimes that doesn’t work properly. We’d like to avoid it proceeding on if that fails.

#2

Good question! The buildkite-agent artifact download command will through an error if there was no artifact found. Are you not finding that to be the case?

#3

That’s too late in the process for us. Need it to fail immediately on the step that attempts the upload

#4

Oh, I didn’t realize you were referring to artifact uploads. Sorry, I thought you meant downloads.

Are you using the buildkite-agent artifact upload command, or using the artifact_paths in the step’s configuration?

#5

Apologies, you’re absolutely right about that not being clear.

Currently, we’re using artifact_paths: "build.tar.gz"

#6

Thanks! That makes sense.

I don’t think we’d make a change with the currently pipeline.yml syntax to have it fail the job, because too many people rely on the current behaviour as a grab bag of glob patterns that don’t affect the job status.

But if we update the artifact upload/download syntax in a future version of the pipeline.yml format, we’ll take this into account!