Extract publication recovery observation
This commit is contained in:
@@ -179,22 +179,23 @@ func reconcilePush(endpoint git.Endpoint, captured candidate.Candidate, tagObjec
|
||||
recoveryCtx, cancel := context.WithTimeout(context.Background(), recoveryTimeout)
|
||||
defer cancel()
|
||||
remoteTag, queryErr := endpoint.QueryTag(recoveryCtx, captured.RepositoryDir, captured.Tag)
|
||||
if queryErr != nil || remoteTag.State == git.RefUnreadable || remoteTag.State == git.RefConflict {
|
||||
observation, classifyErr := classify(Evidence{RepositoryDir: captured.RepositoryDir, Tag: captured.Tag, CandidateCommit: captured.Commit, TagObject: tagObject, Endpoint: endpoint.PushURL}, remoteTag)
|
||||
if queryErr != nil || classifyErr != nil {
|
||||
result.State = Unknown
|
||||
if queryErr == nil {
|
||||
if remoteTag.State == git.RefConflict {
|
||||
queryErr = errors.New("authoritative tag query returned inconsistent exact ref records")
|
||||
} else {
|
||||
queryErr = git.ErrRemoteStateUnreadable
|
||||
queryErr = classifyErr
|
||||
}
|
||||
}
|
||||
return result, fmt.Errorf("push annotated tag %s to %s failed; authoritative reconciliation failed (%w): %w", captured.Tag, git.DisplayURL(endpoint.PushURL), queryErr, pushErr)
|
||||
}
|
||||
if remoteTag.State == git.RefAbsent {
|
||||
if observation.State == NotPublished {
|
||||
result.State = NotPublished
|
||||
return result, fmt.Errorf("push annotated tag %s failed and the authoritative tag is absent at %s: %w", captured.Tag, git.DisplayURL(endpoint.PushURL), pushErr)
|
||||
}
|
||||
if remoteTag.State == git.RefPresent && remoteTag.Object == tagObject && (remoteTag.Peeled == "" || remoteTag.Peeled == captured.Commit) {
|
||||
if observation.State == Published {
|
||||
result.Phase = Complete
|
||||
result.State = Published
|
||||
return result, nil
|
||||
|
||||
Reference in New Issue
Block a user