Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions agent/lib/src/commands/ci.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class ContinuousIntegrationCommand extends Command {
results['able-to-perform-health-check'] = new HealthCheckResult.error(e, s);
}

results['ssh-connectivity'] = await _scrapeRemoteAccessInfo();

return results;
}

Expand Down Expand Up @@ -197,3 +199,22 @@ Future<Null> getFlutterAt(String revision) async {

await getFlutter(revision);
}

/// Returns the IP address for remote (SSH) access to this agent.
///
/// Uses `ipconfig getifaddr en0`.
///
/// Always returns [new HealthCheckResult.success] regardless of whether an IP
/// is available or not. Having remote access to an agent is not a prerequisite
/// for being able to perform Cocoon tasks. It's only there to make maintenance
/// convenient. The goal is only to report available IPs as part of the health
/// check.
Future<HealthCheckResult> _scrapeRemoteAccessInfo() async {
String ip = (await eval('ipconfig', ['getifaddr', 'en0'], canFail: true)).trim();

return new HealthCheckResult.success(ip.isEmpty
? 'No IP found for remote (SSH) access to this client. '
'Did you forget to plug the Ethernet cable?'
: 'Possible remote access IP: $ip'
);
}
2 changes: 1 addition & 1 deletion app/lib/components/status_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import 'package:http/http.dart' as http;
{{agentHealthCheckAge(displayedAgentStatus.healthCheckTimestamp)}}
</div>
<div>Details:</div>
<div>{{displayedAgentStatus.healthDetails}}</div>
<pre>{{displayedAgentStatus.healthDetails}}</pre>
</div>

<table class="status-table"
Expand Down