Honor remote session authoring updates after publication
This commit is contained in:
@@ -192,23 +192,29 @@ func loadPipelineConfigWithDependencies(pipelineFlag string, opts config.Pipelin
|
||||
}
|
||||
|
||||
func findRemoteSessionConfig(ctx context.Context, store storage.ObjectStore, sessionPrefix, remoteKey, campaign, sessionID string) (storage.ObjectInfo, string, error) {
|
||||
current, err := artifacts.LoadCurrentState(ctx, store, sessionPrefix, artifacts.CurrentStateValidation{ExpectedCampaign: campaign, ExpectedSessionID: sessionID, ValidateRunID: true})
|
||||
authored, err := store.Exists(ctx, remoteKey)
|
||||
if err != nil {
|
||||
return storage.ObjectInfo{}, "", fmt.Errorf("check authored session %q: %w", remoteKey, err)
|
||||
}
|
||||
var selected *artifacts.RemoteArtifact
|
||||
if err == nil {
|
||||
for _, item := range current.Commit.Artifacts {
|
||||
if item.Type == artifacts.RemoteArtifactTypeRunFile && item.Source == "run:prepare/inputs/session.yml" {
|
||||
identity, err := artifacts.ParseImmutableRunObjectKey(sessionPrefix, item.DestinationKey)
|
||||
if err != nil || "run:"+identity.RelativePath != item.Source {
|
||||
return storage.ObjectInfo{}, "", fmt.Errorf("committed session source does not match its object key")
|
||||
if !authored {
|
||||
current, err := artifacts.LoadCurrentState(ctx, store, sessionPrefix, artifacts.CurrentStateValidation{ExpectedCampaign: campaign, ExpectedSessionID: sessionID, ValidateRunID: true})
|
||||
if err == nil {
|
||||
for _, item := range current.Commit.Artifacts {
|
||||
if item.Type == artifacts.RemoteArtifactTypeRunFile && item.Source == "run:prepare/inputs/session.yml" {
|
||||
identity, err := artifacts.ParseImmutableRunObjectKey(sessionPrefix, item.DestinationKey)
|
||||
if err != nil || "run:"+identity.RelativePath != item.Source {
|
||||
return storage.ObjectInfo{}, "", fmt.Errorf("committed session source does not match its object key")
|
||||
}
|
||||
copy := item
|
||||
selected = ©
|
||||
remoteKey = item.DestinationKey
|
||||
break
|
||||
}
|
||||
copy := item
|
||||
selected = ©
|
||||
remoteKey = item.DestinationKey
|
||||
break
|
||||
}
|
||||
} else if !errors.Is(err, artifacts.ErrCurrentCommitPointerMissing) {
|
||||
return storage.ObjectInfo{}, "", fmt.Errorf("load remote session selection: %w", err)
|
||||
}
|
||||
} else if !errors.Is(err, artifacts.ErrCurrentCommitPointerMissing) {
|
||||
return storage.ObjectInfo{}, "", fmt.Errorf("load remote session selection: %w", err)
|
||||
}
|
||||
objects, err := store.List(ctx, sessionPrefix)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user