fix: consolidate matrix build passthrough artifacts before upload - #187
Merged
Merged
Conversation
A matrix build's cascade-owned <build>-upload post-job ran upload-artifact on a fresh runner that never held the matrix legs' files, so the upload found an empty path, produced no build-<name> artifact, and a downstream consumer's download failed with "Artifact not found". The post-job now collects the per-leg artifacts first when the build declares a matrix. cascade cannot inject upload steps into a reusable callback's legs, so each leg is expected to upload an artifact named <build-name>-<leg-suffix>; the post-job downloads pattern <build-name>-* with merge-multiple into the upload directory, then uploads the single consolidated build-<name>. Non-matrix builds keep uploading directly. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A matrix build that declares
artifact.uploadgot a cascade-owned<build>-uploadpost-job that ranactions/upload-artifacton a freshubuntu-latestrunner without first fetching anything. For a matrix build the callback fans out across legs that each run on their own runner, so the upload-path files only ever exist on those leg runners. The post-job runner's upload path was empty, so it reportedNo files were found with the provided path, produced nobuild-<name>artifact, and a downstream consumer's download step failed withArtifact not found for name: build-<name>. A live run of a matrixos/archimage build feeding a bundle build exposed this.Fix
writePassthroughUploadJobnow emits aCollect matrix leg artifactsstep before the upload step when the build declares a matrix. cascade cannot inject upload steps into a reusable callback's legs, so the fix defines a per-leg artifact-name convention the callback is expected to follow.Convention: matrix legs upload artifacts named
<build-name>-<leg-suffix>(for a build namedimagethe legs uploadimage-linux-amd64,image-linux-arm64, and so on). The post-job downloadspattern: <build-name>-*withmerge-multiple: trueinto the upload directory, then uploads the single consolidatedbuild-<name>artifact consumers download. The download path is the upload path with a trailing glob stripped to a directory (dist/**anddist/both becomedist; a bare**becomes.).Non-matrix builds are unchanged: their callback runs on one runner whose files already live at the upload path, so they upload directly with no collect step.
Verification
go build ./...passes.go test ./...passes (1359 tests across 23 packages).golangci-lint run ./...reports no issues.gofmt/goimportsclean;go test -race ./internal/generate/passes.TestGenerator_PassthroughArtifact_MatrixUploadCollectsLegs(failing-first, then passing) asserts the matrix upload job collects per-leg artifacts viapattern: image-*,merge-multiple: true, intodist, before uploadingbuild-image, and that the consumer download references the samebuild-imagename.TestGenerator_PassthroughArtifact_NonMatrixUploadNoCollectguards that non-matrix uploads add no spurious collect step.No e2e scenario: the e2e harness runs under act, which has no artifact server, so upload/download-artifact cannot execute there. Coverage is provided through the generator test on the emitted workflow, matching the precedent set by PR #183 for the same reason.