Skip to content

Commit 41405ff

Browse files
committed
Attempt to resolve CI issue
Signed-off-by: Daniel Raper <daniel.raper@kaleido.io>
1 parent 61fef2f commit 41405ff

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

internal/stacks/stack_manager.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,22 @@ func (s *StackManager) peerIPFSNodes() error {
620620
continue
621621
}
622622
addr := fmt.Sprintf("/dns4/ipfs_%s/tcp/4001/p2p/%s", other.ID, peerIDs[other.ID])
623-
url := fmt.Sprintf("http://127.0.0.1:%d/api/v0/swarm/peering/add?arg=%s", member.ExposedIPFSApiPort, addr)
624-
if err := core.RequestWithRetry(s.ctx, http.MethodPost, url, nil, nil); err != nil {
623+
624+
// swarm/peering/add only registers the peer with Kubo's background
625+
// reconnect service - it returns success even when the peer is
626+
// unreachable, so it does not confirm a connection was made.
627+
peeringURL := fmt.Sprintf("http://127.0.0.1:%d/api/v0/swarm/peering/add?arg=%s", member.ExposedIPFSApiPort, addr)
628+
if err := core.RequestWithRetry(s.ctx, http.MethodPost, peeringURL, nil, nil); err != nil {
625629
return fmt.Errorf("failed to peer IPFS node %s with %s: %w", member.ID, other.ID, err)
626630
}
631+
632+
// swarm/connect dials synchronously and errors if the connection
633+
// fails, so retrying it confirms the nodes are actually connected
634+
// rather than just registered to reconnect in the background.
635+
connectURL := fmt.Sprintf("http://127.0.0.1:%d/api/v0/swarm/connect?arg=%s", member.ExposedIPFSApiPort, addr)
636+
if err := core.RequestWithRetry(s.ctx, http.MethodPost, connectURL, nil, nil); err != nil {
637+
return fmt.Errorf("failed to connect IPFS node %s to %s: %w", member.ID, other.ID, err)
638+
}
627639
}
628640
}
629641
return nil

0 commit comments

Comments
 (0)