|
44 | 44 | import org.kohsuke.stapler.Stapler;
|
45 | 45 |
|
46 | 46 | import java.io.IOException;
|
| 47 | +import java.util.LinkedHashMap; |
47 | 48 | import java.util.Map;
|
48 | 49 |
|
49 | 50 | /**
|
@@ -98,8 +99,7 @@ public Environment setUp(AbstractBuild build, final Launcher launcher, BuildList
|
98 | 99 | try {
|
99 | 100 | return new SSHAgentEnvironment(launcher, listener, userPrivateKey);
|
100 | 101 | } catch (Throwable e) {
|
101 |
| - listener.fatalError(Messages.SSHAgentBuildWrapper_CouldNotStartAgent()); |
102 |
| - e.printStackTrace(listener.getLogger()); |
| 102 | + e.printStackTrace(listener.fatalError(Messages.SSHAgentBuildWrapper_CouldNotStartAgent())); |
103 | 103 | return null;
|
104 | 104 | }
|
105 | 105 | }
|
@@ -179,18 +179,25 @@ public SSHAgentEnvironment(Launcher launcher, final BuildListener listener,
|
179 | 179 | final SSHUserPrivateKey sshUserPrivateKey) throws Throwable {
|
180 | 180 | RemoteAgent agent = null;
|
181 | 181 | listener.getLogger().println("[ssh-agent] Looking for ssh-agent implementation...");
|
| 182 | + Map<String,Throwable> faults = new LinkedHashMap<String, Throwable>(); |
182 | 183 | for (RemoteAgentFactory factory : Hudson.getInstance().getExtensionList(RemoteAgentFactory.class)) {
|
183 | 184 | if (factory.isSupported(launcher, listener)) {
|
184 | 185 | try {
|
185 | 186 | listener.getLogger().println("[ssh-agent] " + factory.getDisplayName());
|
186 | 187 | agent = factory.start(launcher, listener);
|
187 | 188 | break;
|
188 | 189 | } catch (Throwable t) {
|
189 |
| - // ignore |
| 190 | + faults.put(factory.getDisplayName(), t); |
190 | 191 | }
|
191 | 192 | }
|
192 | 193 | }
|
193 | 194 | if (agent == null) {
|
| 195 | + listener.getLogger().println("[ssh-agent] FATAL: Could not find a suitable ssh-agent provider"); |
| 196 | + listener.getLogger().println("[ssh-agent] Diagnostic report"); |
| 197 | + for (Map.Entry<String,Throwable> fault: faults.entrySet()) { |
| 198 | + listener.getLogger().println("[ssh-agent] * " + fault.getKey()); |
| 199 | + fault.getValue().printStackTrace(listener.getLogger()); |
| 200 | + } |
194 | 201 | throw new RuntimeException("[ssh-agent] Could not find a suitable ssh-agent provider.");
|
195 | 202 | }
|
196 | 203 | this.agent = agent;
|
|
0 commit comments