Skip to content

Commit 03f470f

Browse files
committed
Launcher -> use custom path over local.
Signed-off-by: agoins <[email protected]>
1 parent 4ecbc5c commit 03f470f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

backend/src/v2/component/launcher_v2.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,19 +545,25 @@ func uploadOutputArtifacts(ctx context.Context, executorInput *pipelinespec.Exec
545545
mergeRuntimeArtifacts(list.Artifacts[0], outputArtifact)
546546
}
547547

548-
// Upload artifacts from local path to remote storages.
549-
localDir, err := LocalPathForURI(outputArtifact.Uri)
548+
// If artifact customPath is set, upload to remote storages from this path. Otherwise, upload from local path.
549+
var artifactDir string
550+
var err error
551+
if *outputArtifact.CustomPath != "" {
552+
artifactDir = *outputArtifact.CustomPath
553+
} else {
554+
artifactDir, err = LocalPathForURI(outputArtifact.Uri)
555+
}
550556
if err != nil {
551557
glog.Warningf("Output Artifact %q does not have a recognized storage URI %q. Skipping uploading to remote storage.", name, outputArtifact.Uri)
552558
} else if !strings.HasPrefix(outputArtifact.Uri, "oci://") {
553559
blobKey, err := opts.bucketConfig.KeyFromURI(outputArtifact.Uri)
554560
if err != nil {
555561
return nil, fmt.Errorf("failed to upload output artifact %q: %w", name, err)
556562
}
557-
if err := objectstore.UploadBlob(ctx, opts.bucket, localDir, blobKey); err != nil {
563+
if err := objectstore.UploadBlob(ctx, opts.bucket, artifactDir, blobKey); err != nil {
558564
// We allow components to not produce output files
559565
if errors.Is(err, os.ErrNotExist) {
560-
glog.Warningf("Local filepath %q does not exist", localDir)
566+
glog.Warningf("Local filepath %q does not exist", artifactDir)
561567
} else {
562568
return nil, fmt.Errorf("failed to upload output artifact %q to remote storage URI %q: %w", name, outputArtifact.Uri, err)
563569
}

0 commit comments

Comments
 (0)