<argLine>-noverify</argLine><!-- some versions of JDK7/8 causes VerifyError during mock tests: http://code.google.com/p/powermock/issues/detail?id=504 -->
@Argument(metaVar="SOURCE",required=true,usage="If this points to a local file, that file will be installed. "+
"If this is an URL, Jenkins downloads the URL and installs that as a plugin."+
"Otherwise the name is assumed to be the short name of the plugin in the existing update center (like \"findbugs\"),"+
@Argument(metaVar="SOURCE",required=true,usage="If this points to a local file (‘-remoting’ mode only), that file will be installed. "+
"If this is an URL, Jenkins downloads the URL and installs that as a plugin. "+
"If it is the string ‘=’, the file will be read from standard input of the command, and ‘-name’ must be specified. "+
"Otherwise the name is assumed to be the short name of the plugin in the existing update center (like ‘findbugs’), "+
"and the plugin will be installed from the update center.")
publicList<String>sources=newArrayList<String>();
@Option(name="-name",usage="If specified, the plugin will be installed as this short name (whereas normally the name is inferred from the source name automatically).")
publicStringname;
publicStringname;// TODO better to parse out Short-Name from the manifest and deprecate this option
@Option(name="-restart",usage="Restart Jenkins upon successful installation.")
publicbooleanrestart;
...
...
@@ -80,6 +82,19 @@ public class InstallPluginCommand extends CLICommand {
}
for(Stringsource:sources){
if(source.equals("=")){
if(name==null){
thrownewIllegalArgumentException("-name required when using -source -");
List<String>commands=Lists.newArrayList("java","-jar",jar.getAbsolutePath(),"-s",j.getURL().toString(),/* not covering SSH keys in this test */"-noKeyAuth");
while(!baos.toString().contains("000")){// cannot just search for, say, "groovy:000> " since there are ANSI escapes there (cf. StringEscapeUtils.escapeJava)
Thread.sleep(100);
}
pw.println("11 * 11");
while(!baos.toString().contains("121")){// ditto not "===> 121"
assumeNoException("Sometimes on Windows KnownHostsServerKeyVerifier.acceptIncompleteHostKeys says WARNING: Failed (FileSystemException) to reload server keys from …\\\\.ssh\\\\known_hosts: … Incorrect function.",x);
}
/* TODO impossible to do this until the bundled sshd module uses a sufficiently new version of sshd-core:
assumeThat("or on Windows DefaultKnownHostsServerKeyVerifier.reloadKnownHosts says invalid file permissions: Owner violation (Administrators)",
"java","-Duser.home="+home,"-jar",jar.getAbsolutePath(),"-s",r.getURL().toString()./* just checking */replaceFirst("/$",""),"-ssh","-user","admin","-i",privkey.getAbsolutePath(),"-strictHostKey","who-am-i"
assertThat(newCLICommandInvoker(j,"wait-node-offline").invokeWithArgs("xxx"),CLICommandInvoker.Matcher.failedWith(/* IllegalArgumentException from NodeOptionHandler */3));