Read publication inventory without execution snapshots
This commit is contained in:
@@ -24,6 +24,25 @@ type RemoteCurrentState struct {
|
||||
Commit *artifacts.RemoteCommitManifest
|
||||
}
|
||||
|
||||
func discoverRemotePublication(ctx context.Context, cfg *config.Config, store storage.ObjectStore) (*RemoteCurrentState, error) {
|
||||
if cfg == nil || cfg.Pipeline == nil || cfg.Session == nil || store == nil {
|
||||
return nil, fmt.Errorf("resolved config and remote object store are required")
|
||||
}
|
||||
bucket := artifacts.ResolvePublishBucket(cfg, nil)
|
||||
if strings.TrimSpace(bucket) == "" {
|
||||
return nil, fmt.Errorf("publish bucket is required")
|
||||
}
|
||||
prefix, err := artifacts.ResolvePublishSessionPrefix(cfg, nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("resolve publish session prefix: %w", err)
|
||||
}
|
||||
current, err := artifacts.LoadCurrentInventory(ctx, store, prefix, artifacts.CurrentStateValidation{ExpectedSessionID: cfg.Session.SessionID, ExpectedCampaign: cfg.Session.Campaign})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("remote %w", err)
|
||||
}
|
||||
return &RemoteCurrentState{Bucket: bucket, SessionPrefix: prefix, RunID: current.Commit.RunID, SessionID: current.Commit.SessionID, Campaign: current.Commit.Campaign, Commit: current.Commit}, nil
|
||||
}
|
||||
|
||||
func discoverRemoteCurrentState(ctx context.Context, cfg *config.Config, store storage.ObjectStore) (*RemoteCurrentState, error) {
|
||||
if cfg == nil || cfg.Pipeline == nil || cfg.Session == nil {
|
||||
return nil, fmt.Errorf("resolved config with pipeline/session is required")
|
||||
|
||||
Reference in New Issue
Block a user