Read publication inventory without execution snapshots
This commit is contained in:
@@ -19,7 +19,7 @@ const (
|
||||
MaxRemoteSessionManifestBytes int64 = 8 << 20
|
||||
)
|
||||
|
||||
func loadCommittedCurrentState(
|
||||
func loadCommittedInventory(
|
||||
ctx context.Context,
|
||||
store storage.ObjectStore,
|
||||
sessionPrefix string,
|
||||
@@ -52,8 +52,20 @@ func loadCommittedCurrentState(
|
||||
if err := validatePointerCommitIdentity(pointer, commit); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if strings.TrimSpace(validation.ExpectedCampaign) != "" && commit.Campaign != strings.TrimSpace(validation.ExpectedCampaign) {
|
||||
return nil, fmt.Errorf("remote commit campaign %q does not match expected campaign %q", commit.Campaign, validation.ExpectedCampaign)
|
||||
}
|
||||
if strings.TrimSpace(validation.ExpectedSessionID) != "" && commit.SessionID != strings.TrimSpace(validation.ExpectedSessionID) {
|
||||
return nil, fmt.Errorf("remote commit session_id %q does not match expected session_id %q", commit.SessionID, validation.ExpectedSessionID)
|
||||
}
|
||||
if strings.TrimSpace(validation.ExpectedRunID) != "" && commit.RunID != strings.TrimSpace(validation.ExpectedRunID) {
|
||||
return nil, fmt.Errorf("remote commit run_id %q does not match expected run_id %q", commit.RunID, validation.ExpectedRunID)
|
||||
}
|
||||
return &CurrentState{SessionPrefix: sessionPrefix, CurrentPointerKey: pointerKey, RunID: commit.RunID, Commit: commit, Pointer: pointer}, nil
|
||||
}
|
||||
|
||||
sessionManifest, ok := commit.Artifact(RemoteArtifactTypeSessionManifest)
|
||||
func loadCommittedCurrentState(ctx context.Context, store storage.ObjectStore, state *CurrentState, validation CurrentStateValidation) (*CurrentState, error) {
|
||||
sessionManifest, ok := state.Commit.Artifact(RemoteArtifactTypeSessionManifest)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("remote commit must declare exactly one session manifest artifact")
|
||||
}
|
||||
@@ -65,20 +77,13 @@ func loadCommittedCurrentState(
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := validateCommitManifestIdentity(commit, m); err != nil {
|
||||
if err := validateCommitManifestIdentity(state.Commit, m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
state := &CurrentState{
|
||||
SessionPrefix: sessionPrefix,
|
||||
CurrentPointerKey: pointerKey,
|
||||
CurrentManifestKey: sessionManifest.DestinationKey,
|
||||
RunID: commit.RunID,
|
||||
Manifest: m,
|
||||
ManifestData: append([]byte(nil), manifestData...),
|
||||
Commit: commit,
|
||||
Pointer: pointer,
|
||||
}
|
||||
state.CurrentManifestKey = sessionManifest.DestinationKey
|
||||
state.Manifest = m
|
||||
state.ManifestData = append([]byte(nil), manifestData...)
|
||||
if err := ValidateCurrentStateIdentity(state, validation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user