mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-21 15:55:40 +00:00
Remove trailing whitespace (#6138)
This commit is contained in:
1 parent
30bde02e7c
commit
b25b45bc90
235 files changed
+2798
-2797
No files matched your search
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jean-Baptiste Quenot, Tom Huybrechts
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -121,7 +121,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
}
|
||||
|
||||
private static Manifest loadLinkedManifest(File archive) throws IOException {
|
||||
// resolve the .hpl file to the location of the manifest file
|
||||
// resolve the .hpl file to the location of the manifest file
|
||||
try {
|
||||
// Locate the manifest
|
||||
String firstLine;
|
||||
@@ -137,7 +137,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
// indirection
|
||||
archive = resolve(archive, firstLine);
|
||||
}
|
||||
|
||||
|
||||
// Read the manifest
|
||||
try (InputStream manifestInput = Files.newInputStream(archive.toPath())) {
|
||||
return new Manifest(manifestInput);
|
||||
@@ -232,7 +232,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fix(atts,optionalDependencies);
|
||||
|
||||
// Register global classpath mask. This is useful for hiding JavaEE APIs that you might see from the container,
|
||||
@@ -253,7 +253,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
|
||||
private void fix(Attributes atts, List<PluginWrapper.Dependency> optionalDependencies) {
|
||||
String pluginName = atts.getValue("Short-Name");
|
||||
|
||||
|
||||
String jenkinsVersion = atts.getValue("Jenkins-Version");
|
||||
if (jenkinsVersion==null)
|
||||
jenkinsVersion = atts.getValue("Hudson-Version");
|
||||
@@ -430,7 +430,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
if (classLoader instanceof DependencyClassLoader) {
|
||||
return (DependencyClassLoader)classLoader;
|
||||
}
|
||||
|
||||
|
||||
if (classLoader instanceof AntClassLoader) {
|
||||
// AntClassLoaders hold parents not only as AntClassLoader#getParent()
|
||||
// but also as AntClassLoader#getConfiguredParent()
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -35,7 +35,7 @@ public abstract class ExtensionListListener {
|
||||
* {@link ExtensionList} contents has changed.
|
||||
* <p>
|
||||
* This would be called when an entry gets added to or removed from the list for any reason e.g.
|
||||
* when a dynamically loaded plugin introduces a new {@link ExtensionPoint} implementation
|
||||
* when a dynamically loaded plugin introduces a new {@link ExtensionPoint} implementation
|
||||
* that adds an entry to the {@link ExtensionList} being listened to.
|
||||
*/
|
||||
public abstract void onChange();
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -51,7 +51,7 @@ public interface ExtensionPoint {
|
||||
/**
|
||||
* Used by designers of extension points (direct subtypes of {@link ExtensionPoint}) to indicate that
|
||||
* the legacy instances are scoped to {@link Jenkins} instance. By default, legacy instances are
|
||||
* static scope.
|
||||
* static scope.
|
||||
*/
|
||||
@Target(TYPE)
|
||||
@Retention(RUNTIME)
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
|
||||
* Eric Lefevre-Ardant, Erik Ramfelt, Michael B. Donohue, Alan Harder,
|
||||
* Manufacture Francaise des Pneumatiques Michelin, Romain Seguy
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -198,7 +198,7 @@ import org.kohsuke.stapler.Stapler;
|
||||
* <p>
|
||||
* When {@link FileCallable} is transferred to a remote node, it will be done so
|
||||
* by using the same Java serialization scheme that the remoting module uses.
|
||||
* See {@link Channel} for more about this.
|
||||
* See {@link Channel} for more about this.
|
||||
*
|
||||
* <p>
|
||||
* {@link FilePath} itself can be sent over to a remote node as a part of {@link Callable}
|
||||
@@ -229,7 +229,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* This is used to determine whether we are running on the controller / the built-in node, or an agent.
|
||||
*/
|
||||
private transient VirtualChannel channel;
|
||||
|
||||
|
||||
/**
|
||||
* Represent the path to the file in the controller or the agent
|
||||
* Since the platform of the agent might be different, can't use java.io.File
|
||||
@@ -369,7 +369,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
// if the path represents a local path, there' no need to guess.
|
||||
if(!isRemote())
|
||||
return File.pathSeparatorChar!=';';
|
||||
|
||||
|
||||
// note that we can't use the usual File.pathSeparator and etc., as the OS of
|
||||
// the machine where this code runs and the OS that this FilePath refers to may be different.
|
||||
|
||||
@@ -411,7 +411,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
zip(os);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a zip file from this directory by using the specified filter,
|
||||
* and sends the result to the given output stream.
|
||||
@@ -808,7 +808,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resolves symlink, if the given file is a symlink. Otherwise return null.
|
||||
* <p>
|
||||
@@ -843,7 +843,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
public int hashCode() {
|
||||
return 31 * (channel != null ? channel.hashCode() : 0) + remote.hashCode();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Supported tar file compression methods.
|
||||
*/
|
||||
@@ -1083,7 +1083,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
|
||||
/**
|
||||
* Convenience method to call {@link FilePath#copyTo(FilePath)}.
|
||||
*
|
||||
*
|
||||
* @since 1.311
|
||||
*/
|
||||
public void copyFrom(FilePath src) throws IOException, InterruptedException {
|
||||
@@ -1345,7 +1345,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
return mkdirs(f) || f.exists();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes all suffixes recursively.
|
||||
* @throws IOException if it exists but could not be successfully deleted
|
||||
@@ -1368,7 +1368,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
Util.deleteRecursive(file.toPath(), path -> path.toFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1734,7 +1734,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setLastModifiedIfPossible(final long timestamp) throws IOException, InterruptedException {
|
||||
String message = act(new SetLastModified(timestamp));
|
||||
|
||||
@@ -1776,7 +1776,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
return f.isDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the file size in bytes.
|
||||
*
|
||||
@@ -2242,18 +2242,18 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
actAsync(new OffsetPipeSecureFileCallable(p, offset));
|
||||
return new java.util.zip.GZIPInputStream(p.getIn());
|
||||
}
|
||||
|
||||
|
||||
private static class OffsetPipeSecureFileCallable extends MasterToSlaveFileCallable<Void> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private Pipe p;
|
||||
private long offset;
|
||||
|
||||
|
||||
private OffsetPipeSecureFileCallable(Pipe p, long offset) {
|
||||
this.p = p;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
||||
try (OutputStream os = p.getOut();
|
||||
@@ -2275,9 +2275,9 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
*/
|
||||
public String readToString() throws IOException, InterruptedException {
|
||||
return act(new ReadToString());
|
||||
}
|
||||
}
|
||||
private static class ReadToString extends MasterToSlaveFileCallable<String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
|
||||
return new String(Files.readAllBytes(fileToPath(f)), Charset.defaultCharset());
|
||||
@@ -2536,10 +2536,10 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
|
||||
/**
|
||||
* Copies the contents of this directory recursively into the specified target directory.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* the number of files copied.
|
||||
* @since 1.312
|
||||
* @since 1.312
|
||||
*/
|
||||
public int copyRecursiveTo(FilePath target) throws IOException, InterruptedException {
|
||||
return copyRecursiveTo("**/*",target);
|
||||
@@ -2685,8 +2685,8 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
if (exceptionEncountered) {
|
||||
Files.copy(fileToPath(f), targetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
if (!logMessageShown) {
|
||||
LOGGER.log(Level.INFO,
|
||||
"JENKINS-52325: Jenkins failed to retain attributes when copying to {0}, so proceeding without attributes.",
|
||||
LOGGER.log(Level.INFO,
|
||||
"JENKINS-52325: Jenkins failed to retain attributes when copying to {0}, so proceeding without attributes.",
|
||||
dest.getAbsolutePath());
|
||||
logMessageShown = true;
|
||||
}
|
||||
@@ -2958,7 +2958,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
final String fileMask = tokens.nextToken().trim();
|
||||
if(hasMatch(dir,fileMask,caseSensitive))
|
||||
continue; // no error on this portion
|
||||
|
||||
|
||||
// JENKINS-5253 - if we can get some match in case insensitive mode
|
||||
// and user requested case sensitive match, notify the user
|
||||
if (caseSensitive && hasMatch(dir, fileMask, false)) {
|
||||
@@ -3126,7 +3126,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
public static FormValidation validateFileMask(@CheckForNull FilePath path, String value) throws IOException {
|
||||
return FilePath.validateFileMask(path, value, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shortcut for {@link #validateFileMask(String,boolean,boolean)} with {@code errorIfNotExist} true, as the left-hand side can be null.
|
||||
*/
|
||||
@@ -3136,14 +3136,14 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
}
|
||||
|
||||
/**
|
||||
* Short for {@code validateFileMask(value, true, true)}
|
||||
* Short for {@code validateFileMask(value, true, true)}
|
||||
*/
|
||||
public FormValidation validateFileMask(String value) throws IOException {
|
||||
return validateFileMask(value, true, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Short for {@code validateFileMask(value, errorIfNotExist, true)}
|
||||
* Short for {@code validateFileMask(value, errorIfNotExist, true)}
|
||||
*/
|
||||
public FormValidation validateFileMask(String value, boolean errorIfNotExist) throws IOException {
|
||||
return validateFileMask(value, errorIfNotExist, true);
|
||||
@@ -3226,7 +3226,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
}
|
||||
}
|
||||
|
||||
String msg = expectingFile ? Messages.FilePath_validateRelativePath_noSuchFile(value) :
|
||||
String msg = expectingFile ? Messages.FilePath_validateRelativePath_noSuchFile(value) :
|
||||
Messages.FilePath_validateRelativePath_noSuchDirectory(value);
|
||||
if(errorIfNotExist) return FormValidation.error(msg);
|
||||
else return FormValidation.warning(msg);
|
||||
@@ -3266,7 +3266,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this {@link FilePath} represents a remote file.
|
||||
* Returns true if this {@link FilePath} represents a remote file.
|
||||
*/
|
||||
public boolean isRemote() {
|
||||
return channel!=null;
|
||||
@@ -3424,7 +3424,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
new NamingThreadFactory(new DaemonThreadFactory(), "FilePath.localPool"))
|
||||
));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Channel to the current instance.
|
||||
*/
|
||||
@@ -3490,7 +3490,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
if (new File(potentialChildRelativePath).isAbsolute()) {
|
||||
throw new IllegalArgumentException("Only a relative path is supported, the given path is absolute: " + potentialChildRelativePath);
|
||||
}
|
||||
|
||||
|
||||
Path parentAbsolutePath = Util.fileToPath(parentFile.getAbsoluteFile());
|
||||
Path parentRealPath;
|
||||
try {
|
||||
@@ -3538,7 +3538,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
}
|
||||
} catch (NoSuchFileException e) {
|
||||
// nonexistent file / Windows Server 2016 + MSFT docker
|
||||
// in case this folder / file will be copied somewhere else,
|
||||
// in case this folder / file will be copied somewhere else,
|
||||
// it becomes the responsibility of that system to check the isDescendant with the existing links
|
||||
// we are not taking the parentRealPath to avoid possible problem
|
||||
Path child = currentFileAbsolutePath.normalize();
|
||||
@@ -3560,7 +3560,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
private @NonNull Path windowsToRealPath(@NonNull Path path) throws IOException {
|
||||
try {
|
||||
return path.toRealPath();
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Stephen Connolly, CloudBees, Inc.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -85,7 +85,7 @@ import org.kohsuke.accmod.restrictions.NoExternalUse;
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see FilePath#createLauncher(TaskListener)
|
||||
* @see FilePath#createLauncher(TaskListener)
|
||||
*/
|
||||
public abstract class Launcher {
|
||||
|
||||
@@ -146,7 +146,7 @@ public abstract class Launcher {
|
||||
/**
|
||||
* Gets the {@link TaskListener} that this launcher uses to
|
||||
* report the commands that it's executing.
|
||||
*
|
||||
*
|
||||
* @return Task listener
|
||||
*/
|
||||
@NonNull
|
||||
@@ -289,7 +289,7 @@ public abstract class Launcher {
|
||||
|
||||
/**
|
||||
* Sets the current directory.
|
||||
*
|
||||
*
|
||||
* @param workDir Work directory to be used.
|
||||
* If {@code null}, the default/current directory will be used by the process starter
|
||||
* @return {@code this}
|
||||
@@ -314,8 +314,8 @@ public abstract class Launcher {
|
||||
|
||||
/**
|
||||
* Sets STDOUT destination.
|
||||
*
|
||||
* @param out Output stream.
|
||||
*
|
||||
* @param out Output stream.
|
||||
* Use {@code null} to send STDOUT to {@code /dev/null}.
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -327,7 +327,7 @@ public abstract class Launcher {
|
||||
|
||||
/**
|
||||
* Sends the stdout to the given {@link TaskListener}.
|
||||
*
|
||||
*
|
||||
* @param out Task listener (must be safely remotable)
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -339,7 +339,7 @@ public abstract class Launcher {
|
||||
|
||||
/**
|
||||
* Gets current STDOUT destination.
|
||||
*
|
||||
*
|
||||
* @return STDOUT output stream. {@code null} if STDOUT is suppressed or undefined.
|
||||
*/
|
||||
@CheckForNull
|
||||
@@ -358,7 +358,7 @@ public abstract class Launcher {
|
||||
|
||||
/**
|
||||
* Gets current STDERR destination.
|
||||
*
|
||||
*
|
||||
* @return STDERR output stream. {@code null} if suppressed or undefined.
|
||||
*/
|
||||
@CheckForNull
|
||||
@@ -369,7 +369,7 @@ public abstract class Launcher {
|
||||
/**
|
||||
* Controls where the stdin of the process comes from.
|
||||
* By default, {@code /dev/null}.
|
||||
*
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
@NonNull
|
||||
@@ -380,7 +380,7 @@ public abstract class Launcher {
|
||||
|
||||
/**
|
||||
* Gets current STDIN destination.
|
||||
*
|
||||
*
|
||||
* @return STDIN output stream. {@code null} if suppressed or undefined.
|
||||
*/
|
||||
@CheckForNull
|
||||
@@ -395,7 +395,7 @@ public abstract class Launcher {
|
||||
* In addition to what the current process
|
||||
* is inherited (if this is going to be launched from a agent agent, that
|
||||
* becomes the "current" process), these variables will be also set.
|
||||
*
|
||||
*
|
||||
* @param overrides Environment variables to be overridden
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -407,7 +407,7 @@ public abstract class Launcher {
|
||||
/**
|
||||
* @param overrides
|
||||
* List of "VAR=VALUE". See {@link #envs(Map)} for the semantics.
|
||||
*
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ProcStarter envs(@CheckForNull String... overrides) {
|
||||
@@ -425,7 +425,7 @@ public abstract class Launcher {
|
||||
/**
|
||||
* Gets a list of environment variables to be set.
|
||||
* Returns an empty array if envs field has not been initialized.
|
||||
*
|
||||
*
|
||||
* @return If initialized, returns a copy of internal envs array. Otherwise - a new empty array.
|
||||
*/
|
||||
@NonNull
|
||||
@@ -470,7 +470,7 @@ public abstract class Launcher {
|
||||
* Indicates that the caller will directly write to the child process {@link #stdin()} via {@link Proc#getStdin()}.
|
||||
* (Whereas by default you call {@link #stdin(InputStream)}
|
||||
* and let Jenkins pump your {@link InputStream} of choosing to stdin.)
|
||||
*
|
||||
*
|
||||
* @return {@code this}
|
||||
* @since 1.399
|
||||
*/
|
||||
@@ -518,7 +518,7 @@ public abstract class Launcher {
|
||||
// The logging around procHolderForJoin prevents the preliminary object deallocation we saw in JENKINS-23271
|
||||
final Proc procHolderForJoin = start();
|
||||
LOGGER.log(Level.FINER, "Started the process {0}", procHolderForJoin);
|
||||
|
||||
|
||||
if (procHolderForJoin instanceof ProcWithJenkins23271Patch) {
|
||||
return procHolderForJoin.join();
|
||||
} else {
|
||||
@@ -762,7 +762,7 @@ public abstract class Launcher {
|
||||
* <p>
|
||||
* When the returned channel is terminated, the process will be killed.
|
||||
*
|
||||
* @param cmd
|
||||
* @param cmd
|
||||
* The commands.
|
||||
* @param out
|
||||
* Where the stderr from the launched process will be sent.
|
||||
@@ -774,7 +774,7 @@ public abstract class Launcher {
|
||||
* is inherited (if this is going to be launched from an agent, that
|
||||
* becomes the "current" process), these variables will be also set.
|
||||
*/
|
||||
public abstract Channel launchChannel(@NonNull String[] cmd, @NonNull OutputStream out,
|
||||
public abstract Channel launchChannel(@NonNull String[] cmd, @NonNull OutputStream out,
|
||||
@CheckForNull FilePath workDir, @NonNull Map<String,String> envVars) throws IOException, InterruptedException;
|
||||
|
||||
/**
|
||||
@@ -831,7 +831,7 @@ public abstract class Launcher {
|
||||
printCommandLine(cmd.toArray(new String[0]),workDir);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
assert mask.length == cmd.size();
|
||||
final String[] masked = new String[cmd.size()];
|
||||
for (int i = 0; i < cmd.size(); i++) {
|
||||
@@ -843,14 +843,14 @@ public abstract class Launcher {
|
||||
}
|
||||
printCommandLine(masked, workDir);
|
||||
}
|
||||
|
||||
|
||||
protected final void maskedPrintCommandLine(@NonNull String[] cmd, @NonNull boolean[] mask, @CheckForNull FilePath workDir) {
|
||||
maskedPrintCommandLine(Arrays.asList(cmd),mask,workDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a decorated {@link Launcher} for the given node.
|
||||
*
|
||||
*
|
||||
* @param node Node for which this launcher is created.
|
||||
* @return Decorated instance of the Launcher.
|
||||
*/
|
||||
@@ -877,7 +877,7 @@ public abstract class Launcher {
|
||||
public boolean isUnix() {
|
||||
return outer.isUnix();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Proc launch(ProcStarter starter) throws IOException {
|
||||
starter.commands.addAll(0,Arrays.asList(prefix));
|
||||
@@ -1111,7 +1111,7 @@ public abstract class Launcher {
|
||||
final OutputStream out = ps.stdout == null || ps.stdoutListener != null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stdout));
|
||||
final OutputStream err = ps.stderr==null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stderr));
|
||||
final InputStream in = ps.stdin == null || ps.stdin == NULL_INPUT_STREAM ? null : new RemoteInputStream(ps.stdin, false);
|
||||
|
||||
|
||||
final FilePath psPwd = ps.pwd;
|
||||
final String workDir = psPwd==null ? null : psPwd.getRemote();
|
||||
|
||||
@@ -1230,14 +1230,14 @@ public abstract class Launcher {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A launcher which delegates to a provided inner launcher.
|
||||
* A launcher which delegates to a provided inner launcher.
|
||||
* Allows subclasses to only implement methods they want to override.
|
||||
* Originally, this launcher has been implemented in
|
||||
* Originally, this launcher has been implemented in
|
||||
* <a href="https://plugins.jenkins.io/custom-tools-plugin">
|
||||
* Custom Tools Plugin</a>.
|
||||
*
|
||||
*
|
||||
* @author rcampbell
|
||||
* @author Oleg Nenashev, Synopsys Inc.
|
||||
* @since 1.568
|
||||
@@ -1301,9 +1301,9 @@ public abstract class Launcher {
|
||||
|
||||
@Override
|
||||
public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException {
|
||||
return inner.launch(cmd, env, in, out, workDir);
|
||||
return inner.launch(cmd, env, in, out, workDir);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets nested launcher.
|
||||
* @return Inner launcher
|
||||
@@ -1311,7 +1311,7 @@ public abstract class Launcher {
|
||||
@NonNull
|
||||
public Launcher getInner() {
|
||||
return inner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class IOTriplet implements Serializable {
|
||||
@@ -1328,7 +1328,7 @@ public abstract class Launcher {
|
||||
int join() throws InterruptedException, IOException;
|
||||
void kill() throws IOException, InterruptedException;
|
||||
boolean isAlive() throws IOException, InterruptedException;
|
||||
|
||||
|
||||
@NonNull
|
||||
IOTriplet getIOtriplet();
|
||||
}
|
||||
@@ -1350,8 +1350,8 @@ public abstract class Launcher {
|
||||
|
||||
RemoteLaunchCallable(@NonNull List<String> cmd, @CheckForNull boolean[] masks, @CheckForNull String[] env,
|
||||
@CheckForNull InputStream in, boolean reverseStdin,
|
||||
@CheckForNull OutputStream out, boolean reverseStdout,
|
||||
@CheckForNull OutputStream err, boolean reverseStderr,
|
||||
@CheckForNull OutputStream out, boolean reverseStdout,
|
||||
@CheckForNull OutputStream err, boolean reverseStderr,
|
||||
boolean quiet, @CheckForNull String workDir, @NonNull TaskListener listener, @CheckForNull TaskListener stdoutListener) {
|
||||
this.cmd = new ArrayList<>(cmd);
|
||||
this.masks = masks;
|
||||
@@ -1448,7 +1448,7 @@ public abstract class Launcher {
|
||||
@NonNull
|
||||
private final Map<String,String> envOverrides;
|
||||
|
||||
RemoteChannelLaunchCallable(@NonNull String[] cmd, @NonNull Pipe out, @NonNull OutputStream err,
|
||||
RemoteChannelLaunchCallable(@NonNull String[] cmd, @NonNull Pipe out, @NonNull OutputStream err,
|
||||
@CheckForNull String workDir, @NonNull Map<String,String> envOverrides) {
|
||||
this.cmd = cmd;
|
||||
this.out = out;
|
||||
@@ -1501,7 +1501,7 @@ public abstract class Launcher {
|
||||
m.overrideExpandingAll(overrides);
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Debug option to display full current path instead of just the last token.
|
||||
*/
|
||||
|
||||
@@ -219,7 +219,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
private enum PMConstructor {
|
||||
JENKINS {
|
||||
@Override
|
||||
@NonNull
|
||||
@NonNull
|
||||
PluginManager doCreate(@NonNull Class<? extends PluginManager> klass,
|
||||
@NonNull Jenkins jenkins) throws ReflectiveOperationException {
|
||||
return klass.getConstructor(Jenkins.class).newInstance(jenkins);
|
||||
@@ -1090,7 +1090,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves input stream for the Manifest url.
|
||||
* The method intelligently handles the case of {@link JarURLConnection} pointing to files within JAR.
|
||||
@@ -1103,11 +1103,11 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
URLConnection uc = url.openConnection();
|
||||
InputStream in = null;
|
||||
// Magic, which allows to avoid using stream generated for JarURLConnection.
|
||||
// It prevents getting into JENKINS-37332 due to the file descriptor leak
|
||||
// It prevents getting into JENKINS-37332 due to the file descriptor leak
|
||||
if (uc instanceof JarURLConnection) {
|
||||
final JarURLConnection jarURLConnection = (JarURLConnection) uc;
|
||||
final String entryName = jarURLConnection.getEntryName();
|
||||
|
||||
|
||||
try(JarFile jarFile = jarURLConnection.getJarFile()) {
|
||||
final JarEntry entry = entryName != null && jarFile != null ? jarFile.getJarEntry(entryName) : null;
|
||||
if (entry != null) {
|
||||
@@ -1121,16 +1121,16 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If input stream is undefined, use the default implementation
|
||||
if (in == null) {
|
||||
in = url.openStream();
|
||||
}
|
||||
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves modification date of the specified file.
|
||||
* The method intelligently handles the case of {@link JarURLConnection} pointing to files within JAR.
|
||||
@@ -1141,7 +1141,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
@NonNull
|
||||
/*package*/ static long getModificationDate(@NonNull URL url) throws IOException {
|
||||
URLConnection uc = url.openConnection();
|
||||
|
||||
|
||||
// It prevents file descriptor leak if the URL references a file within JAR
|
||||
// See JENKINS-37332 for more info
|
||||
// The code idea is taken from https://github.com/jknack/handlebars.java/pull/394
|
||||
@@ -1160,7 +1160,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Fallbak to the default implementation
|
||||
return uc.getLastModified();
|
||||
}
|
||||
@@ -1347,7 +1347,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
public static boolean isNonMetaLabel(String label) {
|
||||
return !("adopt-this-plugin".equals(label) || "deprecated".equals(label));
|
||||
}
|
||||
|
||||
|
||||
@Restricted(NoExternalUse.class)
|
||||
public HttpResponse doPluginsSearch(@QueryParameter String query, @QueryParameter Integer limit) {
|
||||
List<JSONObject> plugins = new ArrayList<>();
|
||||
@@ -1458,10 +1458,10 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
|
||||
JSONArray mappedPlugins = new JSONArray();
|
||||
mappedPlugins.addAll(plugins);
|
||||
|
||||
|
||||
return hudson.util.HttpResponses.okJSON(mappedPlugins);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of all plugins - available and installed.
|
||||
* @return The list of all plugins - available and installed.
|
||||
@@ -1532,9 +1532,9 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
|
||||
return new HttpRedirect("./sites");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called to progress status beyond installing plugins, e.g. if
|
||||
* Called to progress status beyond installing plugins, e.g. if
|
||||
* there were failures that prevented installation from naturally proceeding
|
||||
*/
|
||||
@RequirePOST
|
||||
@@ -1651,7 +1651,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
index = n.indexOf('.', index + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (p == null) {
|
||||
throw new Failure("No such plugin: " + n);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
|
||||
* Yahoo! Inc., Erik Ramfelt, Tom Huybrechts
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -168,7 +168,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* The snapshot of {@code disableFile.exists()} as of the start up.
|
||||
*/
|
||||
private final boolean active;
|
||||
|
||||
|
||||
private boolean hasCycleDependency = false;
|
||||
|
||||
private final List<Dependency> dependencies;
|
||||
@@ -384,11 +384,11 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
/**
|
||||
* Inject the specified jar file(s) to the plugins classpath.
|
||||
* <p><strong>Warning:</strong> This is advanced usage that you should not be needed in 99.9% of all cases, any jar insertion
|
||||
* should happen early into the plugins lifecycle to prevent classloading issues in dependent plugins.
|
||||
* should happen early into the plugins lifecycle to prevent classloading issues in dependent plugins.
|
||||
* </p><p>
|
||||
* Rather than use this functionality it is to have co-operative behaviour between any consumer of the libraries and load the classes in a separate {@link ClassLoader}.
|
||||
* you can expose third-party libraries from a dynamic location in various ways, such as:
|
||||
*
|
||||
*
|
||||
* <ul>
|
||||
* <li>You could split your plugin into two modules:
|
||||
* <ul>
|
||||
@@ -409,7 +409,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* For a concrete example see the <a href=
|
||||
* "https://github.com/jenkinsci/database-plugin/blob/117.va2009e38b882/src/main/java/org/jenkinsci/plugins/database/GenericDatabase.java#L129-L142">database
|
||||
* plugin</a>. *
|
||||
*
|
||||
*
|
||||
* @throws Exception if the File could not be inserted into the classpath for some reason.
|
||||
* @since 2.313
|
||||
*/
|
||||
@@ -467,7 +467,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
@Override
|
||||
public String toString() {
|
||||
return shortName + " (" + version + ")" + (optional ? " optional" : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -484,8 +484,8 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* @param dependencies a list of mandatory dependencies
|
||||
* @param optionalDependencies a list of optional dependencies
|
||||
*/
|
||||
public PluginWrapper(PluginManager parent, File archive, Manifest manifest, URL baseResourceURL,
|
||||
ClassLoader classLoader, File disableFile,
|
||||
public PluginWrapper(PluginManager parent, File archive, Manifest manifest, URL baseResourceURL,
|
||||
ClassLoader classLoader, File disableFile,
|
||||
List<Dependency> dependencies, List<Dependency> optionalDependencies) {
|
||||
this.parent = parent;
|
||||
this.manifest = manifest;
|
||||
@@ -718,7 +718,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
return getVersionNumber().compareTo(v) < 0;
|
||||
} catch (IllegalArgumentException e) {
|
||||
// if we can't figure out our current version, it probably means it's very old,
|
||||
// since the version information is missing only from the very old plugins
|
||||
// since the version information is missing only from the very old plugins
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -889,7 +889,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
public boolean isActive() {
|
||||
return active && !hasCycleDependency();
|
||||
}
|
||||
|
||||
|
||||
public boolean hasCycleDependency(){
|
||||
return hasCycleDependency;
|
||||
}
|
||||
@@ -1056,7 +1056,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
if(p!=null && p.isNewerThan(getVersion())) return p;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* returns the {@link hudson.model.UpdateSite.Plugin} object, or null.
|
||||
*/
|
||||
@@ -1083,7 +1083,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
public boolean hasUpdate() {
|
||||
return getUpdateInfo()!=null;
|
||||
}
|
||||
|
||||
|
||||
@Exported
|
||||
@Deprecated // See https://groups.google.com/d/msg/jenkinsci-dev/kRobm-cxFw8/6V66uhibAwAJ
|
||||
public boolean isPinned() {
|
||||
@@ -1376,7 +1376,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
@RequirePOST
|
||||
public HttpResponse doDoUninstall() throws IOException {
|
||||
Jenkins jenkins = Jenkins.get();
|
||||
|
||||
|
||||
jenkins.checkPermission(Jenkins.ADMINISTER);
|
||||
Files.deleteIfExists(Util.fileToPath(archive));
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jean-Baptiste Quenot, Tom Huybrechts
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -97,7 +97,7 @@ public class WebAppMain implements ServletContextListener {
|
||||
* <p>
|
||||
* The SecurityRealm should be corrected but this is a hardening in Jenkins core.
|
||||
* <p>
|
||||
* As this property is read during startup, you will not be able to change it at runtime
|
||||
* As this property is read during startup, you will not be able to change it at runtime
|
||||
* depending on your application server (not possible with Jetty nor Tomcat)
|
||||
* <p>
|
||||
* When running hpi:run, the default tracking is COOKIE+URL.
|
||||
@@ -108,7 +108,7 @@ public class WebAppMain implements ServletContextListener {
|
||||
public static final String FORCE_SESSION_TRACKING_BY_COOKIE_PROP = WebAppMain.class.getName() + ".forceSessionTrackingByCookie";
|
||||
|
||||
private final RingBufferLogHandler handler = new RingBufferLogHandler(WebAppMain.getDefaultRingBufferSize()) {
|
||||
|
||||
|
||||
@Override public synchronized void publish(LogRecord record) {
|
||||
if (record.getLevel().intValue() >= Level.INFO.intValue()) {
|
||||
super.publish(record);
|
||||
@@ -329,7 +329,7 @@ public class WebAppMain implements ServletContextListener {
|
||||
* <p>
|
||||
* People makes configuration mistakes, so we are trying to be nice
|
||||
* with those by doing {@link String#trim()}.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* @return the File alongside with some description to help the user troubleshoot issues
|
||||
*/
|
||||
|
||||
@@ -63,7 +63,7 @@ import org.kohsuke.args4j.Argument;
|
||||
@Documented
|
||||
public @interface CLIMethod {
|
||||
/**
|
||||
* CLI command name. Used as {@link CLICommand#getName()}
|
||||
* CLI command name. Used as {@link CLICommand#getName()}
|
||||
*/
|
||||
String name();
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public class AnnotatedLargeText<T> extends LargeText {
|
||||
|
||||
/**
|
||||
* For reusing code between text/html and text/plain, we run them both through the same code path
|
||||
* and use this request attribute to differentiate.
|
||||
* and use this request attribute to differentiate.
|
||||
*/
|
||||
private boolean isHtml() {
|
||||
StaplerRequest req = Stapler.getCurrentRequest();
|
||||
|
||||
@@ -51,7 +51,7 @@ import org.jvnet.hudson.reactor.Task;
|
||||
* The method in question can be either {@code static} or an instance method. When used with instance
|
||||
* methods, those methods have to be on a class annotated with {@link Extension} and marked as
|
||||
* {@link #after()} {@link InitMilestone#PLUGINS_PREPARED}.
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@Indexed
|
||||
@@ -99,7 +99,7 @@ public @interface Initializer {
|
||||
/**
|
||||
* Should the failure in this task prevent Hudson from starting up?
|
||||
*
|
||||
* @see Task#failureIsFatal()
|
||||
* @see Task#failureIsFatal()
|
||||
*/
|
||||
boolean fatal() default true;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ import jenkins.util.groovy.GroovyHookScript;
|
||||
/**
|
||||
* Run the initialization script, if it exists.
|
||||
* It runs strictly after the initialization of other tasks during the last initialization milestone.
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GroovyInitScript {
|
||||
|
||||
@@ -2,7 +2,7 @@ package hudson.lifecycle;
|
||||
|
||||
/**
|
||||
* Indicates that the {@link Lifecycle} doesn't support restart.
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class RestartNotSupportedException extends Exception {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -43,7 +43,7 @@ import org.apache.commons.io.output.ByteArrayOutputStream;
|
||||
|
||||
/**
|
||||
* {@link Lifecycle} for Hudson installed as Windows service.
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see WindowsInstallerLink
|
||||
*/
|
||||
@@ -143,10 +143,10 @@ public class WindowsServiceLifecycle extends Lifecycle {
|
||||
if(r!=0)
|
||||
throw new IOException(baos.toString());
|
||||
}
|
||||
|
||||
|
||||
private static File getBaseDir() {
|
||||
File baseDir;
|
||||
|
||||
|
||||
String baseEnv = System.getenv("BASE");
|
||||
if (baseEnv != null) {
|
||||
baseDir = new File(baseEnv);
|
||||
|
||||
@@ -462,7 +462,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
@Override
|
||||
public Result run(@NonNull BuildListener listener) throws Exception {
|
||||
final Node node = getCurrentNode();
|
||||
|
||||
|
||||
assert builtOn==null;
|
||||
builtOn = node.getNodeName();
|
||||
hudsonVersion = Jenkins.VERSION;
|
||||
@@ -502,7 +502,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
} else {
|
||||
listener.getLogger().print(Messages.AbstractBuild_Building());
|
||||
}
|
||||
|
||||
|
||||
lease = decideWorkspace(node, Computer.currentComputer().getWorkspaceList());
|
||||
|
||||
workspace = lease.path.getRemote();
|
||||
@@ -887,7 +887,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
* No need to lock the entire AbstractBuild on change set calculation
|
||||
*/
|
||||
private transient Object changeSetLock = new Object();
|
||||
|
||||
|
||||
/**
|
||||
* Gets the changes incorporated into this build.
|
||||
*
|
||||
@@ -897,7 +897,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
@NonNull public ChangeLogSet<? extends ChangeLogSet.Entry> getChangeSet() {
|
||||
synchronized (changeSetLock) {
|
||||
if (scm==null) {
|
||||
scm = NullChangeLogParser.INSTANCE;
|
||||
scm = NullChangeLogParser.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -973,13 +973,13 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
|
||||
/**
|
||||
* During the build, expose the environments contributed by {@link BuildWrapper}s and others.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Since 1.444, executor thread that's doing the build can access mutable underlying list,
|
||||
* which allows the caller to add/remove environments. The recommended way of adding
|
||||
* environment is through {@link BuildWrapper}, but this might be handy for build steps
|
||||
* who wants to expose additional environment variables to the rest of the build.
|
||||
*
|
||||
*
|
||||
* @return can be empty list, but never null. Immutable.
|
||||
* @since 1.437
|
||||
*/
|
||||
@@ -987,9 +987,9 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
Executor e = Executor.currentExecutor();
|
||||
if (e!=null && e.getCurrentExecutable()==this) {
|
||||
if (buildEnvironments==null) buildEnvironments = new ArrayList<>();
|
||||
return new EnvironmentList(buildEnvironments);
|
||||
return new EnvironmentList(buildEnvironments);
|
||||
}
|
||||
|
||||
|
||||
return new EnvironmentList(buildEnvironments==null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList<>(buildEnvironments)));
|
||||
}
|
||||
|
||||
@@ -1004,7 +1004,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
@Override public void addAction(Action a) {
|
||||
super.addAction(a);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<Action> getPersistentActions(){
|
||||
return super.getActions();
|
||||
@@ -1036,7 +1036,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
bw.makeSensitiveBuildVariables(this, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -1394,7 +1394,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
*
|
||||
* If we use this/executor/stop URL, it causes 404 if the build is already killed,
|
||||
* as {@link #getExecutor()} returns null.
|
||||
*
|
||||
*
|
||||
* @since 1.489
|
||||
*/
|
||||
@RequirePOST
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi,
|
||||
* Daniel Dyer, Tom Huybrechts, Yahoo!, Inc.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -124,7 +124,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
|
||||
protected volatile String description;
|
||||
|
||||
private transient ItemGroup parent;
|
||||
|
||||
|
||||
protected String displayName;
|
||||
|
||||
protected AbstractItem(ItemGroup parent, String name) {
|
||||
@@ -168,7 +168,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
|
||||
// if the displayName is not set, then return the name as we use to do
|
||||
return getName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is intended to be used by the Job configuration pages where
|
||||
* we want to return null if the display name is not set.
|
||||
@@ -179,21 +179,21 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
|
||||
public String getDisplayNameOrNull() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method exists so that the Job configuration pages can use
|
||||
* This method exists so that the Job configuration pages can use
|
||||
* getDisplayNameOrNull so that nothing is shown in the display name text
|
||||
* box if the display name is not set.
|
||||
*/
|
||||
public void setDisplayNameOrNull(String displayName) throws IOException {
|
||||
setDisplayName(displayName);
|
||||
}
|
||||
|
||||
|
||||
public void setDisplayName(String displayName) throws IOException {
|
||||
this.displayName = Util.fixEmptyAndTrim(displayName);
|
||||
save();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public File getRootDir() {
|
||||
return getParent().getRootDirFor(this);
|
||||
@@ -488,7 +488,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
|
||||
if(n.length()==0) return getDisplayName();
|
||||
else return n+" » "+getDisplayName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the display name of the current item relative to the given group.
|
||||
*
|
||||
@@ -500,7 +500,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
|
||||
public String getRelativeDisplayNameFrom(ItemGroup p) {
|
||||
return Functions.getRelativeDisplayNameFrom(this, p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method only exists to disambiguate {@link #getRelativeNameFrom(ItemGroup)} and {@link #getRelativeNameFrom(Item)}
|
||||
* @since 1.512
|
||||
@@ -527,7 +527,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
|
||||
* to perform any implementation-specific work.
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param src
|
||||
* Item from which it's copied from. The same type as {@code this}. Never null.
|
||||
@@ -740,8 +740,8 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
|
||||
final WorkUnit workUnit = e.getCurrentWorkUnit();
|
||||
final Executable executable = workUnit != null ? workUnit.getExecutable() : null;
|
||||
final SubTask subtask = executable != null ? getParentOf(executable) : null;
|
||||
|
||||
if (subtask != null) {
|
||||
|
||||
if (subtask != null) {
|
||||
Item item = Tasks.getItemOf(subtask);
|
||||
while (item != null) {
|
||||
if (item == this) {
|
||||
|
||||
@@ -41,37 +41,37 @@ import jenkins.util.Timer;
|
||||
/**
|
||||
* Extension point which allows scheduling a task with variable interval. Interval in evaluated every time before next
|
||||
* task is scheduled by calling {@link #getRecurrencePeriod()}. Task to be scheduled is obtain by calling {@link #getNewInstance()}.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This class is similar to {@link PeriodicWork}. The main difference is in re-evaluating delay interval every time.
|
||||
* See {@link PeriodicWork} for details. Analog of {@link AsyncPeriodicWork} is {@link AsyncAperiodicWork}.
|
||||
*
|
||||
*
|
||||
* @author vjuranek
|
||||
* @since 1.410
|
||||
*/
|
||||
@SuppressFBWarnings(value="PREDICTABLE_RANDOM", justification = "The random is just used for an initial delay.")
|
||||
public abstract class AperiodicWork extends SafeTimerTask implements ExtensionPoint {
|
||||
|
||||
|
||||
protected final Logger logger = Logger.getLogger(getClass().getName());
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of milliseconds between successive executions.
|
||||
*
|
||||
* <p>
|
||||
* Jenkins calls this method every time the timer task is scheduled.
|
||||
* Jenkins calls this method every time the timer task is scheduled.
|
||||
*
|
||||
*/
|
||||
public abstract long getRecurrencePeriod();
|
||||
|
||||
/**
|
||||
* Gets new instance of task to be executed. Method should return new instance each time, as there no check, if previously
|
||||
* Gets new instance of task to be executed. Method should return new instance each time, as there no check, if previously
|
||||
* scheduled task already finished. Returning same instance could lead to throwing {@link IllegalStateException} (especially
|
||||
* in case of {@link AsyncAperiodicWork}) and therefore scheduling of next tasks will be broken.
|
||||
*
|
||||
*
|
||||
* @return AperiodicWork - timer task instance to be executed
|
||||
*/
|
||||
public abstract AperiodicWork getNewInstance();
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of milliseconds till the first execution.
|
||||
*
|
||||
@@ -107,7 +107,7 @@ public abstract class AperiodicWork extends SafeTimerTask implements ExtensionPo
|
||||
}
|
||||
|
||||
protected abstract void doAperiodicRun();
|
||||
|
||||
|
||||
/**
|
||||
* Returns all the registered {@link AperiodicWork}s.
|
||||
*/
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Martin Eigenbrodt
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -78,7 +78,7 @@ import org.kohsuke.accmod.restrictions.NoExternalUse;
|
||||
*
|
||||
* <p>
|
||||
* And beyond that, the build is considered complete, and from then on {@link Build} object is there to
|
||||
* keep the record of what happened in this build.
|
||||
* keep the record of what happened in this build.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@@ -148,7 +148,7 @@ public abstract class Build <P extends Project<P,B>,B extends Build<P,B>>
|
||||
Result r = null;
|
||||
try {
|
||||
List<BuildWrapper> wrappers = new ArrayList<>(project.getBuildWrappers().values());
|
||||
|
||||
|
||||
ParametersAction parameters = getAction(ParametersAction.class);
|
||||
if (parameters != null)
|
||||
parameters.createBuildWrappers(Build.this,wrappers);
|
||||
@@ -199,7 +199,7 @@ public abstract class Build <P extends Project<P,B>,B extends Build<P,B>>
|
||||
LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {Build.this, bs});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Executor executor = getExecutor();
|
||||
if (executor != null && executor.isInterrupted()) {
|
||||
// someone asked build interruption, let stop the build before trying to run another build step
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -29,7 +29,7 @@ package hudson.model;
|
||||
*
|
||||
* <p>
|
||||
* This can be implemented by {@link Action}s that associate themselves
|
||||
* with {@link Run}.
|
||||
* with {@link Run}.
|
||||
*
|
||||
* <p>
|
||||
* Actions with this marker should have a view {@code badge.jelly},
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Stephen Connolly, Thomas J. Black
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -227,7 +227,7 @@ public final class ComputerSet extends AbstractModelObject implements Describabl
|
||||
@RequirePOST
|
||||
public void doUpdateNow( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
|
||||
Jenkins.get().checkPermission(Jenkins.MANAGE);
|
||||
|
||||
|
||||
for (NodeMonitor nodeMonitor : NodeMonitor.getAll()) {
|
||||
Thread t = nodeMonitor.triggerUpdate();
|
||||
String columnCaption = nodeMonitor.getColumnCaption();
|
||||
@@ -298,7 +298,7 @@ public final class ComputerSet extends AbstractModelObject implements Describabl
|
||||
|
||||
JSONObject formData = req.getSubmittedForm();
|
||||
formData.put("name", fixedName);
|
||||
|
||||
|
||||
// TODO type is probably NodeDescriptor.id but confirm
|
||||
Node result = NodeDescriptor.all().find(type).newInstance(req, formData);
|
||||
app.addNode(result);
|
||||
@@ -333,7 +333,7 @@ public final class ComputerSet extends AbstractModelObject implements Describabl
|
||||
|
||||
if(Util.fixEmpty(value)==null)
|
||||
return FormValidation.ok();
|
||||
|
||||
|
||||
try {
|
||||
checkName(value);
|
||||
return FormValidation.ok();
|
||||
@@ -341,7 +341,7 @@ public final class ComputerSet extends AbstractModelObject implements Describabl
|
||||
return FormValidation.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Accepts submission from the configuration page.
|
||||
*/
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -136,7 +136,7 @@ import org.springframework.util.StringUtils;
|
||||
* {@link Descriptor} defines addition to the standard Java reflection
|
||||
* and provides reflective information about its corresponding {@link Describable}.
|
||||
* These are primarily used by tag libraries to
|
||||
* keep the Jelly scripts concise.
|
||||
* keep the Jelly scripts concise.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see Describable
|
||||
@@ -241,7 +241,7 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable,
|
||||
/**
|
||||
* Help file redirect, keyed by the field name to the path.
|
||||
*
|
||||
* @see #getHelpFile(String)
|
||||
* @see #getHelpFile(String)
|
||||
*/
|
||||
private final transient Map<String,HelpRedirect> helpRedirect = new HashMap<>(2);
|
||||
|
||||
@@ -279,7 +279,7 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable,
|
||||
* Infers the type of the corresponding {@link Describable} from the outer class.
|
||||
* This version works when you follow the common convention, where a descriptor
|
||||
* is written as the static nested class of the describable class.
|
||||
*
|
||||
*
|
||||
* @since 1.278
|
||||
*/
|
||||
protected Descriptor() {
|
||||
@@ -335,7 +335,7 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable,
|
||||
*
|
||||
* @return
|
||||
* Stick to valid Java identifier character, plus '.', which had to be allowed for historical reasons.
|
||||
*
|
||||
*
|
||||
* @since 1.391
|
||||
*/
|
||||
public String getId() {
|
||||
@@ -537,7 +537,7 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable,
|
||||
/**
|
||||
* @deprecated
|
||||
* Implement {@link #newInstance(StaplerRequest, JSONObject)} method instead.
|
||||
* Deprecated as of 1.145.
|
||||
* Deprecated as of 1.145.
|
||||
*/
|
||||
@Deprecated
|
||||
public T newInstance(StaplerRequest req) throws FormException {
|
||||
@@ -769,7 +769,7 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable,
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tells Jenkins that the help file for the field 'fieldName' is defined in the help file for
|
||||
* the 'fieldNameToRedirectTo' in the 'owner' class.
|
||||
|
||||
@@ -248,7 +248,7 @@ public class Executor extends Thread implements ModelObject {
|
||||
// this method is almost always called as a result of the current thread being interrupted
|
||||
// as a result we need to clean the interrupt flag so that the lock's lock method doesn't
|
||||
// get confused and think it was interrupted while awaiting the lock
|
||||
Thread.interrupted();
|
||||
Thread.interrupted();
|
||||
// we need to use a write lock as we may be repeatedly interrupted while processing and
|
||||
// we need the same lock as used in void interrupt(Result,boolean,CauseOfInterruption...)
|
||||
// JENKINS-28690
|
||||
@@ -539,12 +539,12 @@ public class Executor extends Thread implements ModelObject {
|
||||
Executable candidate = getCurrentExecutable();
|
||||
return candidate instanceof AccessControlled && ((AccessControlled) candidate).hasPermission(Item.READ) ? candidate : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns causes of interruption.
|
||||
*
|
||||
* @return Unmodifiable collection of causes of interruption.
|
||||
* @since 1.617
|
||||
* @since 1.617
|
||||
*/
|
||||
public @NonNull Collection<CauseOfInterruption> getCausesOfInterruption() {
|
||||
return Collections.unmodifiableCollection(causes);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Stephen Connolly
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -42,7 +42,7 @@ public interface HealthReportingAction extends Action {
|
||||
* Get this {@link Action}'s {@link HealthReport}.
|
||||
*
|
||||
* @return
|
||||
* The health report for this instance of the Action or
|
||||
* The health report for this instance of the Action or
|
||||
* {@code null} if the Action does not want to
|
||||
* contribute a HealthReport.
|
||||
*/
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -31,7 +31,7 @@ package hudson.model;
|
||||
* {@link Action} for just storing data associated with a build.
|
||||
*
|
||||
* <p>
|
||||
* It could also be used to reduce the amount of code required to just create an accessible url for tests
|
||||
* It could also be used to reduce the amount of code required to just create an accessible url for tests
|
||||
* by overriding the {@link #getUrlName()} method.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Martin Eigenbrodt, Matthew R. Harrah, Red Hat, Inc., Stephen Connolly, Tom Huybrechts, CloudBees, Inc.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -123,7 +123,7 @@ import org.kohsuke.stapler.verb.POST;
|
||||
|
||||
/**
|
||||
* A job is an runnable entity under the monitoring of Hudson.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Every time it "runs", it will be recorded as a {@link Run} object.
|
||||
*
|
||||
@@ -305,14 +305,14 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
RunT b = getLastBuild();
|
||||
return b!=null && b.isBuilding();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the log file is still being updated.
|
||||
*/
|
||||
public boolean isLogUpdated() {
|
||||
RunT b = getLastBuild();
|
||||
return b!=null && b.isLogUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPronoun() {
|
||||
@@ -383,7 +383,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
if (node != null) {
|
||||
final Computer computer = node.toComputer();
|
||||
if (computer != null) {
|
||||
// we need to get computer environment to inherit platform details
|
||||
// we need to get computer environment to inherit platform details
|
||||
env = computer.getEnvironment();
|
||||
env.putAll(computer.buildEnvironment(listener));
|
||||
}
|
||||
@@ -406,12 +406,12 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
|
||||
/**
|
||||
* Programmatically updates the next build number.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Much of Hudson assumes that the build number is unique and monotonic, so
|
||||
* this method can only accept a new value that's bigger than
|
||||
* {@link #getLastBuild()} returns. Otherwise it'll be no-op.
|
||||
*
|
||||
*
|
||||
* @since 1.199 (before that, this method was package private.)
|
||||
*/
|
||||
public synchronized void updateNextBuildNumber(int next) throws IOException {
|
||||
@@ -510,7 +510,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
|
||||
/**
|
||||
* Adds {@link JobProperty}.
|
||||
*
|
||||
*
|
||||
* @since 1.188
|
||||
*/
|
||||
public void addProperty(JobProperty<? super JobT> jobProp) throws IOException {
|
||||
@@ -726,7 +726,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
|
||||
/**
|
||||
* Gets the read-only view of all the builds.
|
||||
*
|
||||
*
|
||||
* @return never null. The first entry is the latest build.
|
||||
*/
|
||||
@Exported(name="allBuilds",visibility=-2)
|
||||
@@ -818,7 +818,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
|
||||
/**
|
||||
* Gets the youngest build #m that satisfies {@code n<=m}.
|
||||
*
|
||||
*
|
||||
* This is useful when you'd like to fetch a build but the exact build might
|
||||
* be already gone (deleted, rotated, etc.)
|
||||
* @see LazyBuildMixIn#getNearestBuild
|
||||
@@ -833,7 +833,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
|
||||
/**
|
||||
* Gets the latest build #m that satisfies {@code m<=n}.
|
||||
*
|
||||
*
|
||||
* This is useful when you'd like to fetch a build but the exact build might
|
||||
* be already gone (deleted, rotated, etc.)
|
||||
* @see LazyBuildMixIn#getNearestOldBuild
|
||||
@@ -874,7 +874,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
* Some {@link Job}s may not have backing data store for {@link Run}s, but
|
||||
* those {@link Job}s that use file system for storing data should use this
|
||||
* directory for consistency.
|
||||
*
|
||||
*
|
||||
* @see RunMap
|
||||
*/
|
||||
public File getBuildDir() {
|
||||
@@ -890,7 +890,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
|
||||
/**
|
||||
* Gets all the runs.
|
||||
*
|
||||
*
|
||||
* The resulting map must be treated immutable (by employing copy-on-write
|
||||
* semantics.) The map is descending order, with newest builds at the top.
|
||||
* @see LazyBuildMixIn#_getRuns
|
||||
@@ -899,7 +899,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
|
||||
/**
|
||||
* Called from {@link Run} to remove it from this job.
|
||||
*
|
||||
*
|
||||
* The files are deleted already. So all the callee needs to do is to remove
|
||||
* a reference from this {@link Job}.
|
||||
* @see LazyBuildMixIn#removeRun
|
||||
@@ -937,7 +937,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
/**
|
||||
* Returns the last successful build, if any. Otherwise null. A successful build
|
||||
* would include either {@link Result#SUCCESS} or {@link Result#UNSTABLE}.
|
||||
*
|
||||
*
|
||||
* @see #getLastStableBuild()
|
||||
*/
|
||||
@Exported
|
||||
@@ -993,10 +993,10 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
public RunT getLastCompletedBuild() {
|
||||
return (RunT)Permalink.LAST_COMPLETED_BUILD.resolve(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the last {@code numberOfBuilds} builds with a build result ≥ {@code threshold}
|
||||
*
|
||||
*
|
||||
* @return a list with the builds. May be smaller than 'numberOfBuilds' or even empty
|
||||
* if not enough builds satisfying the threshold have been found. Never null.
|
||||
*/
|
||||
@@ -1004,13 +1004,13 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
RunT r = getLastBuild();
|
||||
return r.getBuildsOverThreshold(numberOfBuilds, threshold);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns candidate build for calculating the estimated duration of the current run.
|
||||
*
|
||||
*
|
||||
* Returns the 3 last successful (stable or unstable) builds, if there are any.
|
||||
* Failing to find 3 of those, it will return up to 3 last unsuccessful builds.
|
||||
*
|
||||
*
|
||||
* In any case it will not go more than 6 builds into the past to avoid costly build loading.
|
||||
*/
|
||||
protected List<RunT> getEstimatedDurationCandidates() {
|
||||
@@ -1037,20 +1037,20 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
i++;
|
||||
r = r.getPreviousBuild();
|
||||
}
|
||||
|
||||
|
||||
while (candidates.size() < 3) {
|
||||
if (fallbackCandidates.isEmpty())
|
||||
break;
|
||||
RunT run = fallbackCandidates.remove(0);
|
||||
candidates.add(run);
|
||||
}
|
||||
|
||||
|
||||
return candidates;
|
||||
}
|
||||
|
||||
|
||||
public long getEstimatedDuration() {
|
||||
List<RunT> builds = getEstimatedDurationCandidates();
|
||||
|
||||
|
||||
if(builds.isEmpty()) return -1;
|
||||
|
||||
long totalDuration = 0;
|
||||
@@ -1188,7 +1188,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
|
||||
/**
|
||||
* Get the current health report for a job.
|
||||
*
|
||||
*
|
||||
* @return the health report. Never returns null
|
||||
*/
|
||||
public HealthReport getBuildHealth() {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -10,15 +10,15 @@ import org.jenkinsci.Symbol;
|
||||
import org.kohsuke.stapler.Stapler;
|
||||
|
||||
public class PaneStatusProperties extends UserProperty implements Saveable {
|
||||
|
||||
|
||||
private final PersistedList<String> collapsed = new PersistedList<>(this);
|
||||
|
||||
|
||||
private static final PaneStatusProperties FALLBACK = new PaneStatusPropertiesSessionFallback();
|
||||
|
||||
|
||||
public boolean isCollapsed(String paneId) {
|
||||
return collapsed.contains(paneId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param paneId panel name
|
||||
* @return the actual state of panel
|
||||
@@ -32,17 +32,17 @@ public class PaneStatusProperties extends UserProperty implements Saveable {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() throws IOException {
|
||||
user.save();
|
||||
}
|
||||
|
||||
|
||||
private Object readResolve() {
|
||||
collapsed.setOwner(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Extension @Symbol("paneStatus")
|
||||
public static class DescriptorImpl extends UserPropertyDescriptor {
|
||||
|
||||
@@ -55,13 +55,13 @@ public class PaneStatusProperties extends UserProperty implements Saveable {
|
||||
public boolean isEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class PaneStatusPropertiesSessionFallback extends PaneStatusProperties {
|
||||
|
||||
|
||||
private static final String attribute = "jenkins_pane_%s_collapsed";
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCollapsed(String paneId) {
|
||||
final HttpSession session = Stapler.getCurrentRequest().getSession();
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
|
||||
* Jean-Baptiste Quenot, Seiji Sogabe, Tom Huybrechts
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -142,7 +142,7 @@ public class ParametersDefinitionProperty extends OptionalJobProperty<Job<?, ?>>
|
||||
|
||||
|
||||
List<ParameterValue> values = new ArrayList<>();
|
||||
|
||||
|
||||
JSONObject formData = req.getSubmittedForm();
|
||||
JSONArray a = JSONArray.fromObject(formData.get("parameter"));
|
||||
|
||||
@@ -193,7 +193,7 @@ public class ParametersDefinitionProperty extends OptionalJobProperty<Job<?, ?>>
|
||||
ScheduleResult scheduleResult = Jenkins.get().getQueue().schedule2(
|
||||
getJob(), delay.getTimeInSeconds(), new ParametersAction(values), ParameterizedJobMixIn.getBuildCause(getJob(), req));
|
||||
Queue.Item item = scheduleResult.getItem();
|
||||
|
||||
|
||||
if (item != null && !scheduleResult.isCreated()) {
|
||||
rsp.sendRedirect(SC_SEE_OTHER, req.getContextPath() + '/' + item.getUrl());
|
||||
return;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -53,7 +53,7 @@ import jenkins.util.Timer;
|
||||
*
|
||||
* <p>
|
||||
* This class is designed to run a short task. Implementations whose periodic work takes a long time
|
||||
* to run should extend from {@link AsyncPeriodicWork} instead.
|
||||
* to run should extend from {@link AsyncPeriodicWork} instead.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see AsyncPeriodicWork
|
||||
|
||||
@@ -850,7 +850,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
private List<StubItem> filterDiscoverableItemListBasedOnPermissions(List<StubItem> r, Item t) {
|
||||
if (t.task instanceof hudson.model.Item) {
|
||||
hudson.model.Item taskAsItem = (hudson.model.Item) t.task;
|
||||
if (!taskAsItem.hasPermission(hudson.model.Item.READ)
|
||||
if (!taskAsItem.hasPermission(hudson.model.Item.READ)
|
||||
&& taskAsItem.hasPermission(hudson.model.Item.DISCOVER)) {
|
||||
r.add(new StubItem(new StubTask(t.task)));
|
||||
}
|
||||
@@ -947,7 +947,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
protected List<BlockedItem> getBlockedItems() {
|
||||
return new ArrayList<>(snapshot.blockedProjects);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the snapshot of all {@link LeftItem}s.
|
||||
*
|
||||
@@ -1010,7 +1010,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
* @param l Label to be checked. If null, any label will be accepted.
|
||||
* If you want to count {@link BuildableItem}s without assigned labels,
|
||||
* use {@link #strictCountBuildableItemsFor(hudson.model.Label)}.
|
||||
* @return Number of {@link BuildableItem}s for the specified label.
|
||||
* @return Number of {@link BuildableItem}s for the specified label.
|
||||
*/
|
||||
public /* @java.annotation.Nonnegative */ int countBuildableItemsFor(@CheckForNull Label l) {
|
||||
Snapshot snapshot = this.snapshot;
|
||||
@@ -1025,7 +1025,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
r++;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* How many {@link BuildableItem}s are assigned for the given label?
|
||||
* <p>
|
||||
@@ -1331,7 +1331,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Wraps a {@link Runnable} with the {@link Queue} lock held.
|
||||
* Wraps a {@link Runnable} with the {@link Queue} lock held.
|
||||
*
|
||||
* @param runnable the operation to wrap.
|
||||
* @since 1.618
|
||||
@@ -1344,7 +1344,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a {@link hudson.remoting.Callable} with the {@link Queue} lock held.
|
||||
* Wraps a {@link hudson.remoting.Callable} with the {@link Queue} lock held.
|
||||
*
|
||||
* @param callable the operation to wrap.
|
||||
* @since 1.618
|
||||
@@ -1357,7 +1357,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a {@link java.util.concurrent.Callable} with the {@link Queue} lock held.
|
||||
* Wraps a {@link java.util.concurrent.Callable} with the {@link Queue} lock held.
|
||||
*
|
||||
* @param callable the operation to wrap.
|
||||
* @since 1.618
|
||||
@@ -1593,10 +1593,10 @@ public class Queue extends ResourceController implements Saveable {
|
||||
LOGGER.log(Level.WARNING, "s.sortBuildableItems() threw Throwable: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Ensure that identification of blocked tasks is using the live state: JENKINS-27708 & JENKINS-27871
|
||||
updateSnapshot();
|
||||
|
||||
|
||||
// allocate buildable jobs to executors
|
||||
for (BuildableItem p : new ArrayList<>(
|
||||
buildables)) {// copy as we'll mutate the list in the loop
|
||||
@@ -2217,7 +2217,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
* Test if the specified {@link SubTask} needs to be run on a node with a particular label.
|
||||
* <p>
|
||||
* This method takes {@link LabelAssignmentAction} into account, the first
|
||||
* non-null assignment will be returned.
|
||||
* non-null assignment will be returned.
|
||||
* Otherwise falls back to {@link SubTask#getAssignedLabel()}
|
||||
* @param st {@link SubTask} to be checked.
|
||||
* @return Required {@link Label}. Otherwise null, indicating it can run on anywhere.
|
||||
@@ -2465,7 +2465,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An optional interface for actions on Queue.Item.
|
||||
* Lets the action cooperate in queue management.
|
||||
@@ -2987,7 +2987,7 @@ public class Queue extends ResourceController implements Saveable {
|
||||
return "Queue.Snapshot{waitingList=" + waitingList + ";blockedProjects=" + blockedProjects + ";buildables=" + buildables + ";pendings=" + pendings + "}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class LockedRunnable implements Runnable {
|
||||
private final Runnable delegate;
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -41,12 +41,12 @@ public interface ResourceActivity {
|
||||
* If the activity doesn't lock any resources, just
|
||||
* return {@link ResourceList#EMPTY} (or decline to override).
|
||||
*
|
||||
* @return never null
|
||||
* @return never null
|
||||
*/
|
||||
default ResourceList getResourceList() {
|
||||
return ResourceList.EMPTY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used for rendering HTML.
|
||||
*/
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2012, Sun Microsystems, Inc., Kohsuke Kawaguchi,
|
||||
* Daniel Dyer, Red Hat, Inc., Tom Huybrechts, Romain Seguy, Yahoo! Inc.,
|
||||
* Darek Ostolski, CloudBees, Inc.
|
||||
* Copyright (c) 2012, Martin Schroeder, Intel Mobile Communications GmbH
|
||||
* Copyright (c) 2019 Intel Corporation
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -211,7 +211,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/** ID as used for historical build records; otherwise null. */
|
||||
private @CheckForNull String id;
|
||||
|
||||
|
||||
/**
|
||||
* When the build is scheduled.
|
||||
*/
|
||||
@@ -396,10 +396,10 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
artifactManager.onLoad(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all transient actions associated with this build.
|
||||
*
|
||||
*
|
||||
* @return the list can be empty but never null. read only.
|
||||
* @deprecated Use {@link #getAllActions} instead.
|
||||
*/
|
||||
@@ -435,7 +435,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/**
|
||||
* Obtains 'this' in a more type safe signature.
|
||||
*/
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected @NonNull RunT _this() {
|
||||
return (RunT)this;
|
||||
@@ -549,14 +549,14 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
/**
|
||||
* Gets the {@link Executor} building this job, if it's being built.
|
||||
* Otherwise null.
|
||||
*
|
||||
*
|
||||
* This method looks for {@link Executor} who's {@linkplain Executor#getCurrentExecutable() assigned to this build},
|
||||
* and because of that this might not be necessarily in sync with the return value of {@link #isBuilding()} —
|
||||
* an executor holds on to {@link Run} some more time even after the build is finished (for example to
|
||||
* perform {@linkplain Run.State#POST_PRODUCTION post-production processing}.)
|
||||
* @see Executor#of
|
||||
*/
|
||||
@Exported
|
||||
@Exported
|
||||
public @CheckForNull Executor getExecutor() {
|
||||
return this instanceof Queue.Executable ? Executor.of((Queue.Executable) this) : null;
|
||||
}
|
||||
@@ -564,7 +564,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
/**
|
||||
* Gets the one off {@link Executor} building this job, if it's being built.
|
||||
* Otherwise null.
|
||||
* @since 1.433
|
||||
* @since 1.433
|
||||
*/
|
||||
public @CheckForNull Executor getOneOffExecutor() {
|
||||
for( Computer c : Jenkins.get().getComputers() ) {
|
||||
@@ -580,7 +580,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
* Gets the charset in which the log file is written.
|
||||
* @return never null.
|
||||
* @since 1.257
|
||||
*/
|
||||
*/
|
||||
public final @NonNull Charset getCharset() {
|
||||
if(charset==null) return Charset.defaultCharset();
|
||||
return Charset.forName(charset);
|
||||
@@ -607,7 +607,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
* Returns a {@link Cause} of a particular type.
|
||||
*
|
||||
* @since 1.362
|
||||
*/
|
||||
*/
|
||||
public @CheckForNull <T extends Cause> T getCause(Class<T> type) {
|
||||
for (Cause c : getCauses())
|
||||
if (type.isInstance(c))
|
||||
@@ -628,7 +628,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
/**
|
||||
* If {@link #isKeepLog()} returns true, returns a short, human-readable
|
||||
* sentence that explains why it's being kept.
|
||||
*/
|
||||
*/
|
||||
public @CheckForNull String getWhyKeepLog() {
|
||||
if(keepLog)
|
||||
return Messages.Run_MarkedExplicitly();
|
||||
@@ -637,7 +637,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/**
|
||||
* The project this build is for.
|
||||
*/
|
||||
*/
|
||||
public @NonNull JobT getParent() {
|
||||
return project;
|
||||
}
|
||||
@@ -646,7 +646,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
* When the build is scheduled.
|
||||
*
|
||||
* @see #getStartTimeInMillis()
|
||||
*/
|
||||
*/
|
||||
@Exported
|
||||
public @NonNull Calendar getTimestamp() {
|
||||
GregorianCalendar c = new GregorianCalendar();
|
||||
@@ -656,7 +656,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/**
|
||||
* Same as {@link #getTimestamp()} but in a different type.
|
||||
*/
|
||||
*/
|
||||
public final @NonNull Date getTime() {
|
||||
return new Date(timestamp);
|
||||
}
|
||||
@@ -744,9 +744,9 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
if (displayChars >= maxDescrLength) {
|
||||
truncDesc = truncDesc.substring(0, lastTruncatablePoint) + ending;
|
||||
}
|
||||
|
||||
|
||||
return truncDesc;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -859,7 +859,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
* @return Reference to the build. Never null
|
||||
* @see jenkins.model.lazy.LazyBuildMixIn.RunMixIn#createReference
|
||||
* @since 1.556
|
||||
*/
|
||||
*/
|
||||
protected @NonNull BuildReference<RunT> createReference() {
|
||||
return new BuildReference<>(getId(), _this());
|
||||
}
|
||||
@@ -879,14 +879,14 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/**
|
||||
* @see jenkins.model.lazy.LazyBuildMixIn.RunMixIn#getPreviousBuild
|
||||
*/
|
||||
*/
|
||||
public @CheckForNull RunT getPreviousBuild() {
|
||||
return previousBuild;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the most recent {@linkplain #isBuilding() completed} build excluding 'this' Run itself.
|
||||
*/
|
||||
*/
|
||||
public final @CheckForNull RunT getPreviousCompletedBuild() {
|
||||
RunT r=getPreviousBuild();
|
||||
while (r!=null && r.isBuilding())
|
||||
@@ -901,7 +901,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
* <p>
|
||||
* We basically follow the existing skip list, and wherever we find a non-optimal pointer, we remember them
|
||||
* in 'fixUp' and update them later.
|
||||
*/
|
||||
*/
|
||||
public final @CheckForNull RunT getPreviousBuildInProgress() {
|
||||
if(previousBuildInProgress==this) return null; // the most common case
|
||||
|
||||
@@ -937,7 +937,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/**
|
||||
* Returns the last build that was actually built - i.e., skipping any with Result.NOT_BUILT
|
||||
*/
|
||||
*/
|
||||
public @CheckForNull RunT getPreviousBuiltBuild() {
|
||||
RunT r=getPreviousBuild();
|
||||
// in certain situations (aborted m2 builds) r.getResult() can still be null, although it should theoretically never happen
|
||||
@@ -948,7 +948,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/**
|
||||
* Returns the last build that didn't fail before this build.
|
||||
*/
|
||||
*/
|
||||
public @CheckForNull RunT getPreviousNotFailedBuild() {
|
||||
RunT r=getPreviousBuild();
|
||||
while( r!=null && r.getResult()==Result.FAILURE )
|
||||
@@ -958,7 +958,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/**
|
||||
* Returns the last failed build before this build.
|
||||
*/
|
||||
*/
|
||||
public @CheckForNull RunT getPreviousFailedBuild() {
|
||||
RunT r=getPreviousBuild();
|
||||
while( r!=null && r.getResult()!=Result.FAILURE )
|
||||
@@ -979,14 +979,14 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/**
|
||||
* Returns the last {@code numberOfBuilds} builds with a build result ≥ {@code threshold}.
|
||||
*
|
||||
*
|
||||
* @param numberOfBuilds the desired number of builds
|
||||
* @param threshold the build result threshold
|
||||
* @return a list with the builds (youngest build first).
|
||||
* May be smaller than 'numberOfBuilds' or even empty
|
||||
* if not enough builds satisfying the threshold have been found. Never null.
|
||||
* @since 1.383
|
||||
*/
|
||||
*/
|
||||
public @NonNull List<RunT> getPreviousBuildsOverThreshold(int numberOfBuilds, @NonNull Result threshold) {
|
||||
RunT r = getPreviousBuild();
|
||||
if (r != null) {
|
||||
@@ -1022,7 +1022,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
/**
|
||||
* @see jenkins.model.lazy.LazyBuildMixIn.RunMixIn#getNextBuild
|
||||
*/
|
||||
*/
|
||||
public @CheckForNull RunT getNextBuild() {
|
||||
return nextBuild;
|
||||
}
|
||||
@@ -1031,7 +1031,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
* Returns the URL of this {@link Run}, relative to the context root of Hudson.
|
||||
*
|
||||
* @return
|
||||
* String like "job/foo/32/" with trailing slash but no leading slash.
|
||||
* String like "job/foo/32/" with trailing slash but no leading slash.
|
||||
*/
|
||||
// I really messed this up. I'm hoping to fix this some time
|
||||
// it shouldn't have trailing '/', and instead it should have leading '/'
|
||||
@@ -1079,7 +1079,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
public @NonNull String getId() {
|
||||
return id != null ? id : Integer.toString(number);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the root directory of this {@link Run} on the controller.
|
||||
* Files related to this {@link Run} should be stored below this directory.
|
||||
@@ -1144,8 +1144,8 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
/**
|
||||
* Gets the artifacts (relative to {@link #getArtifactsDir()}.
|
||||
* @return The list can be empty but never null
|
||||
*/
|
||||
@Exported
|
||||
*/
|
||||
@Exported
|
||||
public @NonNull List<Artifact> getArtifacts() {
|
||||
return getArtifactsUpTo(Integer.MAX_VALUE);
|
||||
}
|
||||
@@ -1153,7 +1153,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
/**
|
||||
* Gets the first N artifacts.
|
||||
* @return The list can be empty but never null
|
||||
*/
|
||||
*/
|
||||
public @NonNull List<Artifact> getArtifactsUpTo(int artifactsNumber) {
|
||||
SerializableArtifactList sal;
|
||||
VirtualFile root = getArtifactManager().root();
|
||||
@@ -1195,7 +1195,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
}
|
||||
|
||||
private static int addArtifacts(@NonNull VirtualFile dir,
|
||||
@NonNull String path, @NonNull String pathHref,
|
||||
@NonNull String path, @NonNull String pathHref,
|
||||
@NonNull SerializableArtifactList r, @CheckForNull SerializableArtifact parent, int upTo) throws IOException {
|
||||
VirtualFile[] kids = dir.list();
|
||||
Arrays.sort(kids);
|
||||
@@ -1232,7 +1232,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Maximum number of artifacts to list before using switching to the tree view.
|
||||
*/
|
||||
@@ -1244,7 +1244,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
public static final int TREE_CUTOFF = Integer.parseInt(SystemProperties.getString("hudson.model.Run.ArtifactList.treeCutoff", "40"));
|
||||
|
||||
// ..and then "too many"
|
||||
|
||||
|
||||
/** {@link Run.Artifact} without the implicit link to {@link Run} */
|
||||
private static final class SerializableArtifact implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -1427,7 +1427,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
public String getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
public long getFileSize(){
|
||||
try {
|
||||
return Long.decode(length);
|
||||
@@ -1462,7 +1462,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the log file.
|
||||
* @return The file may reference both uncompressed or compressed logs
|
||||
@@ -1487,13 +1487,13 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
* Returns an input stream that reads from the log file.
|
||||
* It will use a gzip-compressed log file (log.gz) if that exists.
|
||||
*
|
||||
* @return An input stream from the log file.
|
||||
* @return An input stream from the log file.
|
||||
* If the log file does not exist, the error message will be returned to the output.
|
||||
* @since 1.349
|
||||
*/
|
||||
public @NonNull InputStream getLogInputStream() throws IOException {
|
||||
File logFile = getLogFile();
|
||||
|
||||
|
||||
if (logFile.exists() ) {
|
||||
// Checking if a ".gz" file was return
|
||||
try {
|
||||
@@ -1507,11 +1507,11 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String message = "No such file: " + logFile;
|
||||
return new ByteArrayInputStream(charset != null ? message.getBytes(charset) : message.getBytes(Charset.defaultCharset()));
|
||||
}
|
||||
|
||||
|
||||
public @NonNull Reader getLogReader() throws IOException {
|
||||
if (charset==null) return new InputStreamReader(getLogInputStream(),Charset.defaultCharset());
|
||||
else return new InputStreamReader(getLogInputStream(),charset);
|
||||
@@ -1565,7 +1565,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
/**
|
||||
* Used to URL-bind {@link AnnotatedLargeText}.
|
||||
* @return A {@link Run} log with annotations
|
||||
*/
|
||||
*/
|
||||
public @NonNull AnnotatedLargeText getLogText() {
|
||||
return new AnnotatedLargeText(getLogFile(),getCharset(),!isLogUpdated(),this);
|
||||
}
|
||||
@@ -1593,7 +1593,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes this build's artifacts.
|
||||
* Deletes this build's artifacts.
|
||||
*
|
||||
* @throws IOException
|
||||
* if we fail to delete.
|
||||
@@ -1639,17 +1639,17 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//The root dir exists and is a directory that needs to be purged
|
||||
RunListener.fireDeleted(this);
|
||||
|
||||
|
||||
if (artifactManager != null) {
|
||||
deleteArtifacts();
|
||||
} // for StandardArtifactManager, deleting the whole build dir suffices
|
||||
|
||||
|
||||
synchronized (this) { // avoid holding a lock while calling plugin impls of onDeleted
|
||||
File tmp = new File(rootDir.getParentFile(),'.'+rootDir.getName());
|
||||
|
||||
|
||||
if (tmp.exists()) {
|
||||
Util.deleteRecursive(tmp);
|
||||
}
|
||||
@@ -1662,7 +1662,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
} catch (UnsupportedOperationException | SecurityException ex) {
|
||||
throw new IOException(rootDir + " is in use", ex);
|
||||
}
|
||||
|
||||
|
||||
Util.deleteRecursive(tmp);
|
||||
// some user reported that they see some left-over .xyz files in the workspace,
|
||||
// so just to make sure we've really deleted it, schedule the deletion on VM exit, too.
|
||||
@@ -1728,7 +1728,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
*/
|
||||
public abstract class RunExecution {
|
||||
/**
|
||||
* Keeps track of the check points attained by a build, and abstracts away the synchronization needed to
|
||||
* Keeps track of the check points attained by a build, and abstracts away the synchronization needed to
|
||||
* maintain this data structure.
|
||||
*/
|
||||
private final class CheckpointSet {
|
||||
@@ -2201,9 +2201,9 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
if (isBuilding()) {
|
||||
return new Summary(false, Messages.Run_Summary_Unknown());
|
||||
}
|
||||
|
||||
|
||||
ResultTrend trend = ResultTrend.getResultTrend(this);
|
||||
|
||||
|
||||
for (StatusSummarizer summarizer : ExtensionList.lookup(StatusSummarizer.class)) {
|
||||
Summary summary = summarizer.summarize(this, trend);
|
||||
if (summary != null) {
|
||||
@@ -2213,30 +2213,30 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
|
||||
switch (trend) {
|
||||
case ABORTED : return new Summary(false, Messages.Run_Summary_Aborted());
|
||||
|
||||
|
||||
case NOT_BUILT : return new Summary(false, Messages.Run_Summary_NotBuilt());
|
||||
|
||||
|
||||
case FAILURE : return new Summary(true, Messages.Run_Summary_BrokenSinceThisBuild());
|
||||
|
||||
case STILL_FAILING :
|
||||
|
||||
case STILL_FAILING :
|
||||
RunT since = getPreviousNotFailedBuild();
|
||||
if(since==null)
|
||||
return new Summary(false, Messages.Run_Summary_BrokenForALongTime());
|
||||
RunT failedBuild = since.getNextBuild();
|
||||
return new Summary(false, Messages.Run_Summary_BrokenSince(failedBuild.getDisplayName()));
|
||||
|
||||
|
||||
case NOW_UNSTABLE:
|
||||
case STILL_UNSTABLE :
|
||||
return new Summary(false, Messages.Run_Summary_Unstable());
|
||||
case UNSTABLE :
|
||||
return new Summary(true, Messages.Run_Summary_Unstable());
|
||||
|
||||
|
||||
case SUCCESS :
|
||||
return new Summary(false, Messages.Run_Summary_Stable());
|
||||
|
||||
|
||||
case FIXED :
|
||||
return new Summary(false, Messages.Run_Summary_BackToNormal());
|
||||
|
||||
|
||||
default:
|
||||
return new Summary(false, Messages.Run_Summary_Unknown());
|
||||
}
|
||||
@@ -2356,7 +2356,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
}
|
||||
catch(IOException ex){
|
||||
req.setAttribute("stackTraces", Functions.printThrowable(ex));
|
||||
req.getView(this, "delete-retry.jelly").forward(req, rsp);
|
||||
req.getView(this, "delete-retry.jelly").forward(req, rsp);
|
||||
return;
|
||||
}
|
||||
rsp.sendRedirect2(req.getContextPath()+'/' + getParent().getUrl());
|
||||
@@ -2367,7 +2367,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
this.description = description;
|
||||
save();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Accepts the new description.
|
||||
*/
|
||||
@@ -2412,7 +2412,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
* <p>
|
||||
* Unlike earlier {@link #getEnvVars()}, this map contains the whole environment,
|
||||
* not just the overrides, so one can introspect values to change its behavior.
|
||||
*
|
||||
*
|
||||
* @return the map with the environmental variables.
|
||||
* @since 1.305
|
||||
*/
|
||||
@@ -2491,7 +2491,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
* Returns the estimated duration for this run if it is currently running.
|
||||
* Default to {@link Job#getEstimatedDuration()}, may be overridden in subclasses
|
||||
* if duration may depend on run specific parameters (like incremental Maven builds).
|
||||
*
|
||||
*
|
||||
* @return the estimated duration in milliseconds
|
||||
* @since 1.383
|
||||
*/
|
||||
@@ -2531,7 +2531,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
private static final Logger LOGGER = Logger.getLogger(Run.class.getName());
|
||||
|
||||
/**
|
||||
* Sort by date. Newer ones first.
|
||||
* Sort by date. Newer ones first.
|
||||
*/
|
||||
public static final Comparator<Run> ORDER_BY_DATE = new Comparator<Run>() {
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -142,13 +142,13 @@ import org.springframework.security.core.Authentication;
|
||||
* <p>
|
||||
* <b>Extending Update Centers</b>. The update center in {@code Jenkins} can be replaced by defining a
|
||||
* System Property ({@code hudson.model.UpdateCenter.className}). See {@link #createUpdateCenter(hudson.model.UpdateCenter.UpdateCenterConfiguration)}.
|
||||
* This className should be available on early startup, so it cannot come only from a library
|
||||
* This className should be available on early startup, so it cannot come only from a library
|
||||
* (e.g. Jenkins module or Extra library dependency in the WAR file project).
|
||||
* Plugins cannot be used for such purpose.
|
||||
* In order to be correctly instantiated, the class definition must have two constructors:
|
||||
* In order to be correctly instantiated, the class definition must have two constructors:
|
||||
* {@link #UpdateCenter()} and {@link #UpdateCenter(hudson.model.UpdateCenter.UpdateCenterConfiguration)}.
|
||||
* If the class does not comply with the requirements, a fallback to the default UpdateCenter will be performed.
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @since 1.220
|
||||
*/
|
||||
@@ -268,7 +268,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
UpdateCenter(@NonNull UpdateCenterConfiguration configuration) {
|
||||
configure(configuration);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates an update center.
|
||||
* @param config Requested configuration. May be {@code null} if defaults should be used
|
||||
@@ -283,7 +283,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
LOGGER.log(Level.FINE, "Using the default Update Center implementation");
|
||||
return createDefaultUpdateCenter(config);
|
||||
}
|
||||
|
||||
|
||||
LOGGER.log(Level.FINE, "Using the custom update center: {0}", requiredClassName);
|
||||
try {
|
||||
final Class<?> clazz = Class.forName(requiredClassName).asSubclass(UpdateCenter.class);
|
||||
@@ -308,7 +308,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
}
|
||||
return createDefaultUpdateCenter(config);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
private static UpdateCenter createDefaultUpdateCenter(@CheckForNull UpdateCenterConfiguration config) {
|
||||
return config != null ? new UpdateCenter(config) : new UpdateCenter();
|
||||
@@ -1663,7 +1663,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
addStatus(e);
|
||||
error = e;
|
||||
}
|
||||
|
||||
|
||||
if(internetCheck != null) {
|
||||
try {
|
||||
// Wait for internet check to complete
|
||||
@@ -1686,7 +1686,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enables a required plugin, provides feedback in the update center
|
||||
*/
|
||||
@@ -1694,11 +1694,11 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
public EnableJob(UpdateSite site, Authentication auth, @NonNull Plugin plugin, boolean dynamicLoad) {
|
||||
super(plugin, site, auth, dynamicLoad);
|
||||
}
|
||||
|
||||
|
||||
public Plugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -1712,7 +1712,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
error = e;
|
||||
status = new DownloadJob.Failure(e);
|
||||
}
|
||||
|
||||
|
||||
if (dynamicLoad) {
|
||||
try {
|
||||
// remove the existing, disabled inactive plugin to force a new one to load
|
||||
@@ -1739,7 +1739,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A no-op, e.g. this plugin is already installed
|
||||
*/
|
||||
@@ -1760,7 +1760,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
String getComputedSHA256();
|
||||
String getComputedSHA512();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Base class for a job that downloads a file from the Jenkins project.
|
||||
*/
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Yahoo! Inc., Seiji Sogabe,
|
||||
* Andrew Bayer
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -219,7 +219,7 @@ public class UpdateSite {
|
||||
public @NonNull FormValidation updateDirectlyNow(boolean signatureCheck) throws IOException {
|
||||
return updateData(DownloadService.loadJSON(new URL(getUrl() + "?id=" + URLEncoder.encode(getId(), "UTF-8") + "&version=" + URLEncoder.encode(Jenkins.VERSION, "UTF-8"))), signatureCheck);
|
||||
}
|
||||
|
||||
|
||||
private FormValidation updateData(String json, boolean signatureCheck)
|
||||
throws IOException {
|
||||
|
||||
@@ -314,7 +314,7 @@ public class UpdateSite {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
retryWindow = Math.max(retryWindow,SECONDS.toMillis(15));
|
||||
|
||||
|
||||
boolean due = now - dataTimestamp > DAY && now - lastAttempt > retryWindow;
|
||||
if(due) {
|
||||
lastAttempt = now;
|
||||
@@ -447,7 +447,7 @@ public class UpdateSite {
|
||||
return new TextFile(new File(Jenkins.get().getRootDir(),
|
||||
"updates/" + getId()+".json"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the list of plugins that are updates to currently installed ones.
|
||||
*
|
||||
@@ -458,16 +458,16 @@ public class UpdateSite {
|
||||
public List<Plugin> getUpdates() {
|
||||
Data data = getData();
|
||||
if(data==null) return Collections.emptyList(); // fail to determine
|
||||
|
||||
|
||||
List<Plugin> r = new ArrayList<>();
|
||||
for (PluginWrapper pw : Jenkins.get().getPluginManager().getPlugins()) {
|
||||
Plugin p = pw.getUpdateInfo();
|
||||
if(p!=null) r.add(p);
|
||||
}
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does any of the plugin has updates?
|
||||
*/
|
||||
@@ -475,17 +475,17 @@ public class UpdateSite {
|
||||
public boolean hasUpdates() {
|
||||
Data data = getData();
|
||||
if(data==null) return false;
|
||||
|
||||
|
||||
for (PluginWrapper pw : Jenkins.get().getPluginManager().getPlugins()) {
|
||||
if(!pw.isBundled() && pw.getUpdateInfo()!=null)
|
||||
// do not advertize updates to bundled plugins, since we generally want users to get them
|
||||
// as a part of jenkins.war updates. This also avoids unnecessary pinning of plugins.
|
||||
// as a part of jenkins.war updates. This also avoids unnecessary pinning of plugins.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Exposed to get rid of hardcoding of the URL that serves up update-center.json
|
||||
* in JavaScript.
|
||||
@@ -1164,7 +1164,7 @@ public class UpdateSite {
|
||||
*/
|
||||
@Exported
|
||||
public final Map<String,String> dependencies;
|
||||
|
||||
|
||||
/**
|
||||
* Optional dependencies of this plugin.
|
||||
*/
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -73,7 +73,7 @@ import org.kohsuke.stapler.StaplerRequest;
|
||||
@Extension
|
||||
public class UsageStatistics extends PageDecorator implements PersistentDescriptor {
|
||||
private static final Logger LOG = Logger.getLogger(UsageStatistics.class.getName());
|
||||
|
||||
|
||||
private final String keyImage;
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ public class UsageStatistics extends PageDecorator implements PersistentDescript
|
||||
public boolean isDue() {
|
||||
// user opted out. no data collection.
|
||||
if(!Jenkins.get().isUsageStatisticsCollected() || DISABLED) return false;
|
||||
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if(now - lastAttempt > DAY) {
|
||||
lastAttempt = now;
|
||||
@@ -125,7 +125,7 @@ public class UsageStatistics extends PageDecorator implements PersistentDescript
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the encrypted usage stat data to be sent to the Hudson server.
|
||||
* Gets the encrypted usage stat data to be sent to the Hudson server.
|
||||
* Used exclusively by jelly: resources/hudson/model/UsageStatistics/footer.jelly
|
||||
*/
|
||||
public String getStatData() throws IOException {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Daniel Dyer
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -25,7 +25,7 @@ package hudson.model;
|
||||
|
||||
/**
|
||||
* {@link Descriptor} for {@link UserProperty}.
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public abstract class UserPropertyDescriptor extends Descriptor<UserProperty> {
|
||||
@@ -67,7 +67,7 @@ public abstract class UserPropertyDescriptor extends Descriptor<UserProperty> {
|
||||
*
|
||||
* <p>
|
||||
* This mechanism is useful if the availability of the property is
|
||||
* contingent of some other settings.
|
||||
* contingent of some other settings.
|
||||
*/
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts,
|
||||
* Yahoo!, Inc.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -139,7 +139,7 @@ import org.xml.sax.SAXException;
|
||||
* <li>
|
||||
* {@link View} subtypes need the {@code newViewDetail.jelly} page,
|
||||
* which is included in the "new view" page. This page should have some
|
||||
* description of what the view is about.
|
||||
* description of what the view is about.
|
||||
* </ul>
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
@@ -164,7 +164,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
* Message displayed in the view page.
|
||||
*/
|
||||
protected String description;
|
||||
|
||||
|
||||
/**
|
||||
* If true, only show relevant executors
|
||||
*/
|
||||
@@ -174,7 +174,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
* If true, only show relevant queue items
|
||||
*/
|
||||
protected boolean filterQueue;
|
||||
|
||||
|
||||
/**
|
||||
* List of {@link ViewProperty}s configured for this view.
|
||||
* @since 1.406
|
||||
@@ -385,7 +385,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
public boolean isEditable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used to enable or disable automatic refreshes of the view.
|
||||
*
|
||||
@@ -397,14 +397,14 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
public boolean isAutomaticRefreshEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If true, only show relevant executors
|
||||
*/
|
||||
public boolean isFilterExecutors() {
|
||||
return filterExecutors;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If true, only show relevant queue items
|
||||
*/
|
||||
@@ -443,7 +443,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
public boolean isDefault() {
|
||||
return getOwner().getPrimaryView()==this;
|
||||
}
|
||||
|
||||
|
||||
public List<Computer> getComputers() {
|
||||
Computer[] computers = Jenkins.get().getComputers();
|
||||
|
||||
@@ -958,13 +958,13 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
|
||||
void addDisplayNamesToSearchIndex(SearchIndexBuilder sib, Collection<TopLevelItem> items) {
|
||||
for(TopLevelItem item : items) {
|
||||
|
||||
|
||||
if(LOGGER.isLoggable(Level.FINE)) {
|
||||
LOGGER.fine(String.format("Adding url=%s,displayName=%s",
|
||||
item.getSearchUrl(), item.getDisplayName()));
|
||||
}
|
||||
sib.add(item.getSearchUrl(), item.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -991,7 +991,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
public SearchIndexBuilder makeSearchIndex() {
|
||||
SearchIndexBuilder sib = super.makeSearchIndex();
|
||||
makeSearchIndex(sib);
|
||||
|
||||
|
||||
// add the display name for each item in the search index
|
||||
addDisplayNamesToSearchIndex(sib, getItems());
|
||||
|
||||
@@ -1060,7 +1060,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
* <p>
|
||||
* This method should call {@link ModifiableItemGroup#doCreateItem(StaplerRequest, StaplerResponse)}
|
||||
* and then add the newly created item to this view.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* null if fails.
|
||||
*/
|
||||
@@ -1160,11 +1160,11 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
public void doRssFailed( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
|
||||
RSS.rss(req, rsp, "Jenkins:" + getDisplayName() + " (failed builds)", getUrl(), getBuilds().failureOnly().newBuilds());
|
||||
}
|
||||
|
||||
|
||||
public RunList getBuilds() {
|
||||
return new RunList(this);
|
||||
}
|
||||
|
||||
|
||||
public BuildTimelineWidget getTimeline() {
|
||||
return new BuildTimelineWidget(getBuilds());
|
||||
}
|
||||
@@ -1336,7 +1336,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
||||
public static Permission getItemCreatePermission() {
|
||||
return Item.CREATE;
|
||||
}
|
||||
|
||||
|
||||
public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner)
|
||||
throws FormException, IOException, ServletException {
|
||||
String mode = req.getParameter("mode");
|
||||
|
||||
@@ -314,7 +314,7 @@ public class MappingWorksheet {
|
||||
|
||||
public MappingWorksheet(BuildableItem item, List<? extends ExecutorSlot> offers, Collection<? extends LoadPredictor> loadPredictors) {
|
||||
this.item = item;
|
||||
|
||||
|
||||
// group executors by their computers
|
||||
Map<Computer,List<ExecutorSlot>> j = new HashMap<>();
|
||||
for (ExecutorSlot o : offers) {
|
||||
|
||||
@@ -159,7 +159,7 @@ public abstract class SU {
|
||||
ArgumentListBuilder args = new ArgumentListBuilder().add(javaExe);
|
||||
if(agentJar.isFile())
|
||||
args.add("-jar").add(agentJar);
|
||||
else // in production code this never happens, but during debugging this is convenient
|
||||
else // in production code this never happens, but during debugging this is convenient
|
||||
args.add("-cp").add(agentJar).add(hudson.remoting.Launcher.class.getName());
|
||||
|
||||
if (Util.fixEmptyAndTrim(rootPassword) == null) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, InfraDNA, Inc.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -62,7 +62,7 @@ public final class CronTab {
|
||||
private String spec;
|
||||
|
||||
/**
|
||||
* Optional timezone string for calendar
|
||||
* Optional timezone string for calendar
|
||||
*/
|
||||
private @CheckForNull String specTimezone;
|
||||
|
||||
@@ -73,7 +73,7 @@ public final class CronTab {
|
||||
public CronTab(String format, Hash hash) throws ANTLRException {
|
||||
this(format,1,hash);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated as of 1.448
|
||||
* Use {@link #CronTab(String, int, Hash)}
|
||||
@@ -94,14 +94,14 @@ public final class CronTab {
|
||||
|
||||
/**
|
||||
* @param timezone
|
||||
* Used to schedule cron in a different timezone. Null to use the default system
|
||||
* Used to schedule cron in a different timezone. Null to use the default system
|
||||
* timezone
|
||||
* @since 1.615
|
||||
*/
|
||||
public CronTab(String format, int line, Hash hash, @CheckForNull String timezone) throws ANTLRException {
|
||||
set(format, line, hash, timezone);
|
||||
}
|
||||
|
||||
|
||||
private void set(String format, int line, Hash hash) throws ANTLRException {
|
||||
set(format, line, hash, null);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -52,7 +52,7 @@ public abstract class SCMDescriptor<T extends SCM> extends Descriptor<SCM> {
|
||||
* that type. Otherwise this SCM will not have any repository browser.
|
||||
*/
|
||||
public final transient Class<? extends RepositoryBrowser> repositoryBrowser;
|
||||
|
||||
|
||||
private final transient AtomicInteger atomicGeneration = new AtomicInteger(1);
|
||||
|
||||
protected SCMDescriptor(Class<T> clazz, Class<? extends RepositoryBrowser> repositoryBrowser) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -43,7 +43,7 @@ import java.lang.annotation.Target;
|
||||
* <p>
|
||||
* Such getter/field indicates an edge in the search graph, and will be added
|
||||
* automatically by {@link SearchIndexBuilder#addAllAnnotations(SearchableModelObject)}
|
||||
* to a search index.
|
||||
* to a search index.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi,
|
||||
* Yahoo!, Inc.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -133,7 +133,7 @@ public class Search implements StaplerProxy {
|
||||
*
|
||||
* @return
|
||||
* can be empty but never null. The size of the list is always smaller than
|
||||
* a certain threshold to avoid showing too many options.
|
||||
* a certain threshold to avoid showing too many options.
|
||||
*/
|
||||
public SearchResult getSuggestions(StaplerRequest req, String query) {
|
||||
Set<String> paths = new HashSet<>(); // paths already added, to control duplicates
|
||||
@@ -225,7 +225,7 @@ public class Search implements StaplerProxy {
|
||||
* When there are multiple suggested items, this method can narrow down the resultset
|
||||
* to the SuggestedItem that has a url that contains the query. This is useful is one
|
||||
* job has a display name that matches another job's project name.
|
||||
* @param r A list of Suggested items. It is assumed that there is at least one
|
||||
* @param r A list of Suggested items. It is assumed that there is at least one
|
||||
* SuggestedItem in r.
|
||||
* @param query A query string
|
||||
* @return Returns the SuggestedItem which has a search url that contains the query.
|
||||
@@ -241,12 +241,12 @@ public class Search implements StaplerProxy {
|
||||
return curItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// couldn't find an item with the query in the url so just
|
||||
// return the first one
|
||||
return r.get(0);
|
||||
return r.get(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Search#find(SearchIndex, String, SearchableModelObject)} instead.
|
||||
*/
|
||||
@@ -254,7 +254,7 @@ public class Search implements StaplerProxy {
|
||||
public static SuggestedItem find(SearchIndex index, String query) {
|
||||
return find(index, query, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Performs a search and returns the match, or null if no match was found
|
||||
* or more than one match was found.
|
||||
@@ -262,7 +262,7 @@ public class Search implements StaplerProxy {
|
||||
*/
|
||||
public static SuggestedItem find(SearchIndex index, String query, SearchableModelObject searchContext) {
|
||||
List<SuggestedItem> r = find(Mode.FIND, index, query, searchContext);
|
||||
if(r.isEmpty()){
|
||||
if(r.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
else if(1==r.size()){
|
||||
@@ -273,11 +273,11 @@ public class Search implements StaplerProxy {
|
||||
// contains the query as this is probably the job's name
|
||||
return findClosestSuggestedItem(r, query);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Search#suggest(SearchIndex, String, SearchableModelObject)} instead.
|
||||
* @deprecated use {@link Search#suggest(SearchIndex, String, SearchableModelObject)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<SuggestedItem> suggest(SearchIndex index, final String tokenList) {
|
||||
@@ -354,8 +354,8 @@ public class Search implements StaplerProxy {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder s = new StringBuilder("TokenList{");
|
||||
@@ -364,7 +364,7 @@ public class Search implements StaplerProxy {
|
||||
s.append(",");
|
||||
}
|
||||
s.append('}');
|
||||
|
||||
|
||||
return s.toString();
|
||||
}
|
||||
}
|
||||
@@ -380,7 +380,7 @@ public class Search implements StaplerProxy {
|
||||
List<SearchItem> items = new ArrayList<>(); // items found in 1 step
|
||||
|
||||
LOGGER.log(Level.FINE, "tokens={0}", tokens);
|
||||
|
||||
|
||||
// first token
|
||||
int w=1; // width of token
|
||||
for (String token : tokens.subSequence(0)) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -54,7 +54,7 @@ import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
*
|
||||
* <p>
|
||||
* The page that programs see is entirely white, and it auto-redirects,
|
||||
* so humans wouldn't notice it.
|
||||
* so humans wouldn't notice it.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -56,7 +56,7 @@ public class HudsonFilter implements Filter {
|
||||
* The SecurityRealm specific filter.
|
||||
*/
|
||||
private volatile Filter filter;
|
||||
|
||||
|
||||
/**
|
||||
* The {@link #init(FilterConfig)} may be called before the Jenkins instance is up (which is
|
||||
* required for initialization of the filter). So we store the
|
||||
@@ -85,7 +85,7 @@ public class HudsonFilter implements Filter {
|
||||
*/
|
||||
@Deprecated
|
||||
public static final UserDetailsServiceProxy USER_DETAILS_SERVICE_PROXY = new UserDetailsServiceProxy();
|
||||
|
||||
|
||||
/**
|
||||
* {@link RememberMeServices} proxy so that the Spring Security filter chain can stay the same
|
||||
* even when security setting is reconfigured.
|
||||
|
||||
@@ -105,14 +105,14 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
*/
|
||||
public class HudsonPrivateSecurityRealm extends AbstractPasswordBasedSecurityRealm implements ModelObject, AccessControlled {
|
||||
private static /* not final */ String ID_REGEX = System.getProperty(HudsonPrivateSecurityRealm.class.getName() + ".ID_REGEX");
|
||||
|
||||
|
||||
/**
|
||||
* Default REGEX for the user ID check in case the ID_REGEX is not set
|
||||
* It allows A-Za-z0-9 + "_-"
|
||||
* in Java {@code \w} is equivalent to {@code [A-Za-z0-9_]} (take care of "_")
|
||||
*/
|
||||
private static final String DEFAULT_ID_REGEX = "^[\\w-]+$";
|
||||
|
||||
|
||||
/**
|
||||
* If true, sign up is not allowed.
|
||||
* <p>
|
||||
@@ -275,7 +275,7 @@ public class HudsonPrivateSecurityRealm extends AbstractPasswordBasedSecurityRea
|
||||
session.invalidate();
|
||||
}
|
||||
req.getSession(true);
|
||||
|
||||
|
||||
// ... and let him login
|
||||
Authentication a = new UsernamePasswordAuthenticationToken(u.getId(),req.getParameter("password1"));
|
||||
a = this.getSecurityComponents().manager2.authenticate(a);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -30,7 +30,7 @@ package hudson.security;
|
||||
*/
|
||||
public enum SecurityMode {
|
||||
/**
|
||||
* None. Anyone can make any changes.
|
||||
* None. Anyone can make any changes.
|
||||
*/
|
||||
UNSECURED,
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ public enum SecurityMode {
|
||||
* Authentication is performed by the container.
|
||||
* <p>
|
||||
* This is the only secured mode of Hudson up to 1.160.
|
||||
* This is maintained only for backward compatibility.
|
||||
* This is maintained only for backward compatibility.
|
||||
*/
|
||||
LEGACY,
|
||||
/**
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -114,7 +114,7 @@ public abstract class SidACL extends ACL {
|
||||
* true if the access should be granted, false if it should be denied.
|
||||
* The null value indicates that the ACL does no rule for this Sid/Permission
|
||||
* combination. The caller can decide what to do—such as consulting the higher level ACL,
|
||||
* or denying the access (if the model is no-access-by-default.)
|
||||
* or denying the access (if the model is no-access-by-default.)
|
||||
*/
|
||||
protected abstract Boolean hasPermission(Sid p, Permission permission);
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Martin Eigenbrodt
|
||||
* Copyright (c) 2019 Intel Corporation
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -53,20 +53,20 @@ import org.kohsuke.stapler.DataBoundConstructor;
|
||||
* Default implementation of {@link BuildDiscarder}.
|
||||
*
|
||||
* For historical reason, this is called LogRotator, but it does not rotate logs :-)
|
||||
*
|
||||
*
|
||||
* Since 1.350 it has also the option to keep the build, but delete its recorded artifacts.
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class LogRotator extends BuildDiscarder {
|
||||
|
||||
|
||||
/** @deprecated Replaced by more generic {@link CompositeIOException}. */
|
||||
@Deprecated
|
||||
public static class CollatedLogRotatorException extends IOException {
|
||||
private static final long serialVersionUID = 5944233808072651101L;
|
||||
|
||||
|
||||
public final Collection<Exception> collated;
|
||||
|
||||
|
||||
public CollatedLogRotatorException(String msg, Exception... collated) {
|
||||
super(msg);
|
||||
if (collated == null || collated.length == 0) {
|
||||
@@ -81,7 +81,7 @@ public class LogRotator extends BuildDiscarder {
|
||||
this.collated = values != null ? values : Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If not -1, history is only kept up to this days.
|
||||
*/
|
||||
@@ -135,17 +135,17 @@ public class LogRotator extends BuildDiscarder {
|
||||
this.numToKeep = numToKeep;
|
||||
this.artifactDaysToKeep = artifactDaysToKeep;
|
||||
this.artifactNumToKeep = artifactNumToKeep;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void perform(Job<?,?> job) throws IOException, InterruptedException {
|
||||
//Exceptions thrown by the deletion submethods are collated and reported
|
||||
Map<Run<?,?>, Set<IOException>> exceptionMap = new HashMap<>();
|
||||
|
||||
|
||||
LOGGER.log(FINE, "Running the log rotation for {0} with numToKeep={1} daysToKeep={2} artifactNumToKeep={3} artifactDaysToKeep={4}", new Object[] {job, numToKeep, daysToKeep, artifactNumToKeep, artifactDaysToKeep});
|
||||
|
||||
|
||||
// always keep the last successful and the last stable builds
|
||||
Run lsb = job.getLastSuccessfulBuild();
|
||||
Run lstb = job.getLastStableBuild();
|
||||
@@ -212,7 +212,7 @@ public class LogRotator extends BuildDiscarder {
|
||||
r = r.getNextBuild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!exceptionMap.isEmpty()) {
|
||||
//Collate all encountered exceptions into a single exception and throw that
|
||||
String msg = String.format(
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Brian Westrich, Jean-Baptiste Quenot, id:cactusman
|
||||
* 2015 Kanstantsin Shautsou
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -96,14 +96,14 @@ import org.kohsuke.stapler.StaplerResponse;
|
||||
*
|
||||
* You can add UI elements under the SCM section by creating a
|
||||
* config.jelly or config.groovy in the resources area for
|
||||
* your class that inherits from SCMTrigger and has the
|
||||
* {@link Extension} annotation. The UI should
|
||||
* your class that inherits from SCMTrigger and has the
|
||||
* {@link Extension} annotation. The UI should
|
||||
* be wrapped in an f:section element to denote it.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class SCMTrigger extends Trigger<Item> {
|
||||
|
||||
|
||||
private boolean ignorePostCommitHooks;
|
||||
|
||||
@DataBoundConstructor
|
||||
@@ -131,7 +131,7 @@ public class SCMTrigger extends Trigger<Item> {
|
||||
* This trigger wants to ignore post-commit hooks.
|
||||
* <p>
|
||||
* SCM plugins must respect this and not run this trigger for post-commit notifications.
|
||||
*
|
||||
*
|
||||
* @since 1.493
|
||||
*/
|
||||
public boolean isIgnorePostCommitHooks() {
|
||||
@@ -167,7 +167,7 @@ public class SCMTrigger extends Trigger<Item> {
|
||||
/**
|
||||
* Run the SCM trigger with additional build actions. Used by SubversionRepositoryStatus
|
||||
* to trigger a build at a specific revision number.
|
||||
*
|
||||
*
|
||||
* @since 1.375
|
||||
*/
|
||||
public void run(Action[] additionalActions) {
|
||||
@@ -426,7 +426,7 @@ public class SCMTrigger extends Trigger<Item> {
|
||||
this.run = run;
|
||||
build = run instanceof AbstractBuild ? (AbstractBuild) run : null;
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public BuildAction(AbstractBuild build) {
|
||||
this((Run) build);
|
||||
@@ -476,7 +476,7 @@ public class SCMTrigger extends Trigger<Item> {
|
||||
public AnnotatedLargeText getPollingLogText() {
|
||||
return new AnnotatedLargeText<>(getPollingLogFile(), Charset.defaultCharset(), true, this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used from {@code polling.jelly} to write annotated polling log to the given output.
|
||||
*/
|
||||
@@ -562,7 +562,7 @@ public class SCMTrigger extends Trigger<Item> {
|
||||
public Runner() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
|
||||
@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH", justification = "False positive")
|
||||
public Runner(Action[] actions) {
|
||||
if (job == null) {
|
||||
@@ -575,7 +575,7 @@ public class SCMTrigger extends Trigger<Item> {
|
||||
additionalActions = Arrays.copyOf(actions, actions.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Where the log file is written.
|
||||
*/
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jean-Baptiste Quenot, Martin Eigenbrodt
|
||||
* 2015 Kanstantsin Shautsou
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -82,7 +82,7 @@ public class TimerTrigger extends Trigger<BuildableItem> {
|
||||
public FormValidation doCheck(@QueryParameter String value, @AncestorInPath Item item) {
|
||||
return doCheckSpec(value, item);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Performs syntax check.
|
||||
*/
|
||||
@@ -120,7 +120,7 @@ public class TimerTrigger extends Trigger<BuildableItem> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class TimerTriggerCause extends Cause {
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.kohsuke.stapler.export.Flavor;
|
||||
|
||||
/**
|
||||
* Model object for dynamically filed combo box, which is really just {@code ArrayList<String>}
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class ComboBoxModel extends ArrayList<String> implements HttpResponse {
|
||||
|
||||
@@ -150,7 +150,7 @@ public abstract class DirScanner implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
|
||||
private static class DescendantFileSelector implements FileSelector{
|
||||
private final Set<String> alreadyDeselected;
|
||||
private final FilePath baseDirFP;
|
||||
@@ -161,7 +161,7 @@ public abstract class DirScanner implements Serializable {
|
||||
this.baseDirPathLength = basedir.getPath().length();
|
||||
this.alreadyDeselected = new HashSet<>();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSelected(File basedir, String filename, File file) throws BuildException {
|
||||
String parentName = file.getParent();
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -87,7 +87,7 @@ public class DoubleLaunchChecker {
|
||||
public final File home;
|
||||
|
||||
/**
|
||||
* ID string of the other Hudson that we are colliding with.
|
||||
* ID string of the other Hudson that we are colliding with.
|
||||
* Can be null.
|
||||
*/
|
||||
private String collidingId;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jene Jasper, Tom Huybrechts
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -361,7 +361,7 @@ public abstract class FormFieldValidator {
|
||||
* Checks the file mask (specified in the 'value' query parameter) against
|
||||
* the current workspace.
|
||||
* @since 1.90.
|
||||
* @deprecated as of 1.294. Use {@link FilePath#validateFileMask(String, boolean, boolean)}
|
||||
* @deprecated as of 1.294. Use {@link FilePath#validateFileMask(String, boolean, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static class WorkspaceFileMask extends FormFieldValidator {
|
||||
@@ -622,7 +622,7 @@ public abstract class FormFieldValidator {
|
||||
fail();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
java.util.Base64.getDecoder().decode(v);
|
||||
ok();
|
||||
} catch (IOException | IllegalArgumentException e) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -25,7 +25,7 @@ package hudson.util;
|
||||
|
||||
/**
|
||||
* Unary function {@code y=f(x)}.
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public interface Function1<R,P1> {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -36,7 +36,7 @@ import org.kohsuke.stapler.StaplerResponse;
|
||||
*
|
||||
* Set this object to {@link ServletContext#setAttribute(String, Object)} "app" while
|
||||
* the loading activity is taking place.
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class HudsonIsLoading {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -33,7 +33,7 @@ package hudson.util;
|
||||
*
|
||||
* <p>
|
||||
* Once the event becomes signaled, or the pandora's box is opened,
|
||||
* every thread gets through freely, and there's no way to turn it back off.
|
||||
* every thread gets through freely, and there's no way to turn it back off.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
|
||||
@@ -109,7 +109,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
* Lazily obtained {@link ProcessKiller}s to be applied on this process tree.
|
||||
*/
|
||||
private transient volatile List<ProcessKiller> killers;
|
||||
|
||||
|
||||
/**
|
||||
* Flag to skip the veto check since there aren't any.
|
||||
*/
|
||||
@@ -119,7 +119,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
private ProcessTree() {
|
||||
skipVetoes = false;
|
||||
}
|
||||
|
||||
|
||||
private ProcessTree(boolean vetoesExist) {
|
||||
skipVetoes = !vetoesExist;
|
||||
}
|
||||
@@ -288,12 +288,12 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
public abstract void killRecursively() throws InterruptedException;
|
||||
|
||||
/**
|
||||
* @return The first non-null {@link VetoCause} provided by a process killing veto extension for this OSProcess.
|
||||
* @return The first non-null {@link VetoCause} provided by a process killing veto extension for this OSProcess.
|
||||
* null if no one objects killing the process.
|
||||
*/
|
||||
protected @CheckForNull VetoCause getVeto() {
|
||||
String causeMessage = null;
|
||||
|
||||
|
||||
// Quick check, does anything exist to check against
|
||||
if (!skipVetoes) {
|
||||
try {
|
||||
@@ -308,7 +308,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
LOGGER.log(Level.WARNING, "Interrupted Exception while checking for vetoes", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (causeMessage != null) {
|
||||
return new VetoCause(causeMessage);
|
||||
}
|
||||
@@ -368,14 +368,14 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
Object writeReplace() {
|
||||
return new SerializedProcess(pid);
|
||||
}
|
||||
|
||||
|
||||
private class CheckVetoes extends SlaveToMasterCallable<String, IOException> {
|
||||
private IOSProcess process;
|
||||
|
||||
|
||||
CheckVetoes(IOSProcess processToCheck) {
|
||||
process = processToCheck;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String call() throws IOException {
|
||||
for (ProcessKillingVeto vetoExtension : ProcessKillingVeto.all()) {
|
||||
@@ -429,7 +429,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
|
||||
|
||||
/* package */ static volatile Boolean vetoersExist;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the {@link ProcessTree} of the current system
|
||||
* that JVM runs in, or in the worst case return the default one
|
||||
@@ -458,10 +458,10 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
LOGGER.log(Level.WARNING, "Error while determining if vetoers exist", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Null-check in case the previous call worked
|
||||
boolean vetoes = vetoersExist == null ? true : vetoersExist;
|
||||
|
||||
|
||||
try {
|
||||
if(File.pathSeparatorChar==';')
|
||||
return new Windows(vetoes);
|
||||
@@ -484,7 +484,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
private static class DoVetoersExist extends SlaveToMasterCallable<Boolean, IOException> {
|
||||
@Override
|
||||
public Boolean call() throws IOException {
|
||||
@@ -519,7 +519,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
|
||||
@Override
|
||||
public void kill() throws InterruptedException {
|
||||
if (getVeto() != null)
|
||||
if (getVeto() != null)
|
||||
return;
|
||||
proc.destroy();
|
||||
killByKiller();
|
||||
@@ -546,11 +546,11 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
};
|
||||
|
||||
private class WindowsOSProcess extends OSProcess {
|
||||
|
||||
|
||||
private final WinProcess p;
|
||||
private EnvVars env;
|
||||
private List<String> args;
|
||||
|
||||
|
||||
WindowsOSProcess(WinProcess p) {
|
||||
super(p.getPid());
|
||||
this.p = p;
|
||||
@@ -565,7 +565,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
|
||||
@Override
|
||||
public void killRecursively() throws InterruptedException {
|
||||
if (getVeto() != null)
|
||||
if (getVeto() != null)
|
||||
return;
|
||||
|
||||
LOGGER.log(FINER, "Killing recursively {0}", getPid());
|
||||
@@ -580,7 +580,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
if (getVeto() != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LOGGER.log(FINER, "Killing {0}", getPid());
|
||||
// Firstly try to kill it gracefully, then do a forcekill if it does not help (algorithm is described in JENKINS-17116)
|
||||
killSoftly();
|
||||
@@ -636,7 +636,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
||||
|
||||
private synchronized EnvVars getEnvironmentVariables2() throws WindowsOSProcessException {
|
||||
if(env !=null) {
|
||||
return env;
|
||||
@@ -650,7 +650,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
||||
|
||||
private boolean hasMatchingEnvVars2(Map<String,String> modelEnvVar) throws WindowsOSProcessException {
|
||||
if(modelEnvVar.isEmpty())
|
||||
// sanity check so that we don't start rampage.
|
||||
@@ -666,8 +666,8 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Cleanup once Winp provides proper API
|
||||
|
||||
//TODO: Cleanup once Winp provides proper API
|
||||
/**
|
||||
* Wrapper for runtime {@link WinpException}.
|
||||
*/
|
||||
@@ -675,7 +675,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
WindowsOSProcessException(WinpException ex) {
|
||||
super(ex);
|
||||
}
|
||||
|
||||
|
||||
WindowsOSProcessException(String message, WinpException ex) {
|
||||
super(message, ex);
|
||||
}
|
||||
@@ -684,7 +684,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
private static final class Windows extends Local {
|
||||
Windows(boolean vetoesExist) {
|
||||
super(vetoesExist);
|
||||
|
||||
|
||||
for (final WinProcess p : WinProcess.all()) {
|
||||
int pid = p.getPid();
|
||||
if(pid == 0 || pid == 4) continue; // skip the System Idle and System processes
|
||||
@@ -729,7 +729,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
static {
|
||||
WinProcess.enableDebugPrivilege();
|
||||
}
|
||||
|
||||
|
||||
private static boolean hasMatchingEnvVars(@NonNull OSProcess p, @NonNull Map<String, String> modelEnvVars)
|
||||
throws WindowsOSProcessException {
|
||||
if (p instanceof WindowsOSProcess) {
|
||||
@@ -770,7 +770,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
abstract static class ProcfsUnix extends Unix {
|
||||
ProcfsUnix(boolean vetoersExist) {
|
||||
super(vetoersExist);
|
||||
|
||||
|
||||
File[] processes = new File("/proc").listFiles(File::isDirectory);
|
||||
if(processes==null) {
|
||||
LOGGER.info("No /proc");
|
||||
@@ -819,7 +819,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
}
|
||||
|
||||
private void kill(long deadline) throws InterruptedException {
|
||||
if (getVeto() != null)
|
||||
if (getVeto() != null)
|
||||
return;
|
||||
try {
|
||||
int pid = getPid();
|
||||
@@ -972,7 +972,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
Linux(boolean vetoersExist) {
|
||||
super(vetoersExist);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected LinuxProcess createProcess(int pid) throws IOException {
|
||||
return new LinuxProcess(pid);
|
||||
@@ -1086,7 +1086,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
AIX(boolean vetoersExist) {
|
||||
super(vetoersExist);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected OSProcess createProcess(final int pid) throws IOException {
|
||||
return new AIXProcess(pid);
|
||||
@@ -1173,7 +1173,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
if (adjust((int)pstatus.readLong()) != pid)
|
||||
throw new IOException("pstatus PID mismatch"); // sanity check
|
||||
|
||||
ppid = adjust((int)pstatus.readLong()); // AIX pids are stored as a 64 bit integer,
|
||||
ppid = adjust((int)pstatus.readLong()); // AIX pids are stored as a 64 bit integer,
|
||||
// but the first 4 bytes are always 0
|
||||
}
|
||||
|
||||
@@ -1269,7 +1269,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
arguments.add(readLine(fd, addr, "arg["+ n +"]"));
|
||||
}
|
||||
} finally {
|
||||
LIBC.close(fd);
|
||||
LIBC.close(fd);
|
||||
}
|
||||
} catch (IOException | LastErrorException e) {
|
||||
// failed to read. this can happen under normal circumstances (most notably permission denied)
|
||||
@@ -1317,7 +1317,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
envVars.addLine(readLine(fd, addr, "env["+ n +"]"));
|
||||
}
|
||||
} finally {
|
||||
LIBC.close(fd);
|
||||
LIBC.close(fd);
|
||||
}
|
||||
} catch (IOException | LastErrorException e) {
|
||||
// failed to read. this can happen under normal circumstances (most notably permission denied)
|
||||
@@ -1417,7 +1417,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
Solaris(boolean vetoersExist) {
|
||||
super(vetoersExist);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected OSProcess createProcess(final int pid) throws IOException {
|
||||
return new SolarisProcess(pid);
|
||||
@@ -2133,7 +2133,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
@Deprecated
|
||||
Local() {
|
||||
}
|
||||
|
||||
|
||||
Local(boolean vetoesExist) {
|
||||
super(vetoesExist);
|
||||
}
|
||||
@@ -2151,10 +2151,10 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
for (Map.Entry<Integer,OSProcess> e : proxy.processes.entrySet())
|
||||
processes.put(e.getKey(),new RemoteProcess(e.getValue(),ch));
|
||||
}
|
||||
|
||||
|
||||
public Remote(ProcessTree proxy, Channel ch, boolean vetoersExist) {
|
||||
super(vetoersExist);
|
||||
|
||||
|
||||
this.proxy = ch.export(IProcessTree.class,proxy);
|
||||
for (Map.Entry<Integer,OSProcess> e : proxy.processes.entrySet())
|
||||
processes.put(e.getKey(),new RemoteProcess(e.getValue(),ch));
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -122,7 +122,7 @@ public class RobustReflectionConverter implements Converter {
|
||||
criticalFieldsLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean hasCriticalField(Class<?> clazz, String field) {
|
||||
// Lock the write lock
|
||||
criticalFieldsLock.readLock().lock();
|
||||
@@ -383,7 +383,7 @@ public class RobustReflectionConverter implements Converter {
|
||||
// Report any class/field errors in Saveable objects if it happens during loading of existing data from disk
|
||||
if (shouldReportUnloadableDataForCurrentUser() && context.get("ReadError") != null && context.get("Saveable") == result) {
|
||||
// Avoid any error in OldDataMonitor to be catastrophic. See JENKINS-62231 and JENKINS-59582
|
||||
// The root cause is the OldDataMonitor extension is not ready before a plugin triggers an error, for
|
||||
// The root cause is the OldDataMonitor extension is not ready before a plugin triggers an error, for
|
||||
// example when trying to load a field that was created by a new version and you downgrade to the previous
|
||||
// one.
|
||||
try {
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
* Copyright (c) 2016, CloudBees Inc.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -122,7 +122,7 @@ public final class Secret implements Serializable {
|
||||
/**
|
||||
* Encrypts {@link #value} and returns it in an encoded printable form.
|
||||
*
|
||||
* @see #toString()
|
||||
* @see #toString()
|
||||
*/
|
||||
public String getEncryptedValue() {
|
||||
try {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* The MIT License
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
||||
@@ -85,7 +85,7 @@ public class InstallUtil {
|
||||
return functions.next().apply(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Proceed to the state following the provided one
|
||||
*/
|
||||
@@ -95,7 +95,7 @@ public class InstallUtil {
|
||||
Jenkins.get().setInstallState(next);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the next state during a transition from the current install state
|
||||
*/
|
||||
@@ -106,7 +106,7 @@ public class InstallUtil {
|
||||
}
|
||||
// Terminal condition: getNextState() on the current install state
|
||||
installStateFilterChain.add(input -> {
|
||||
// Initially, install state is unknown and
|
||||
// Initially, install state is unknown and
|
||||
// needs to be determined
|
||||
if (current == null || InstallState.UNKNOWN.equals(current)) {
|
||||
return getDefaultInstallState();
|
||||
@@ -124,11 +124,11 @@ public class InstallUtil {
|
||||
}
|
||||
return states.get(current);
|
||||
});
|
||||
|
||||
|
||||
ProviderChain<InstallState> chain = new ProviderChain<>(installStateFilterChain.iterator());
|
||||
return chain.get();
|
||||
}
|
||||
|
||||
|
||||
private static InstallState getDefaultInstallState() {
|
||||
// Support a simple state override. Useful for testing.
|
||||
String stateOverride = System.getProperty("jenkins.install.state", System.getenv("jenkins.install.state"));
|
||||
@@ -139,18 +139,18 @@ public class InstallUtil {
|
||||
throw new IllegalStateException("Unknown install state override specified on the commandline: '" + stateOverride + "'.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Support a 3-state flag for running or disabling the setup wizard
|
||||
String shouldRunFlag = SystemProperties.getString("jenkins.install.runSetupWizard");
|
||||
boolean shouldRun = "true".equalsIgnoreCase(shouldRunFlag);
|
||||
boolean shouldNotRun = "false".equalsIgnoreCase(shouldRunFlag);
|
||||
|
||||
|
||||
// install wizard will always run if environment specified
|
||||
if (!shouldRun) {
|
||||
if (Functions.getIsUnitTest()) {
|
||||
return InstallState.TEST;
|
||||
}
|
||||
|
||||
|
||||
if (SystemProperties.getBoolean("hudson.Main.development")) {
|
||||
return InstallState.DEVELOPMENT;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class InstallUtil {
|
||||
// has the setup wizard been completed?
|
||||
if (!SetupWizard.getUpdateStateFile().exists()) {
|
||||
Jenkins j = Jenkins.get();
|
||||
|
||||
|
||||
// Allow for skipping
|
||||
if(shouldNotRun) {
|
||||
InstallState.INITIAL_SETUP_COMPLETED.initializeState();
|
||||
|
||||
@@ -78,7 +78,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
/**
|
||||
* A Jenkins instance used during first-run to provide a limited set of services while
|
||||
* initial installation is in progress
|
||||
*
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
@Restricted(NoExternalUse.class)
|
||||
@@ -99,20 +99,20 @@ public class SetupWizard extends PageDecorator {
|
||||
private static final String ADMIN_INITIAL_API_TOKEN_PROPERTY_NAME = SetupWizard.class.getName() + ".adminInitialApiToken";
|
||||
|
||||
/**
|
||||
* This property determines the behavior during the SetupWizard install phase concerning the API Token creation
|
||||
* This property determines the behavior during the SetupWizard install phase concerning the API Token creation
|
||||
* for the initial admin account.
|
||||
* The behavior depends on the provided value:
|
||||
* - true
|
||||
* A token is generated using random value at startup and the information is put
|
||||
* A token is generated using random value at startup and the information is put
|
||||
* in the file "$JENKINS_HOME/secrets/initialAdminApiToken".
|
||||
* - [2-char hash version][32-hex-char of secret], where the hash version is currently only 11.
|
||||
* - [2-char hash version][32-hex-char of secret], where the hash version is currently only 11.
|
||||
* E.g. 110123456789abcdef0123456789abcdef.
|
||||
* A fixed API Token will be created for the user with that plain value as the token.
|
||||
* It is strongly recommended to use it to generate a new one (random) and then revoke it.
|
||||
* See {@link ApiTokenProperty#generateNewToken(String)} and {@link ApiTokenProperty#revokeAllTokensExceptOne(String)}
|
||||
* for scripting methods or using the web API calls:
|
||||
* /user/[user-login]/descriptorByName/jenkins.security.ApiTokenProperty/generateNewToken and
|
||||
* /user/[user-login]/descriptorByName/jenkins.security.ApiTokenProperty/revokeAllExcept
|
||||
* for scripting methods or using the web API calls:
|
||||
* /user/[user-login]/descriptorByName/jenkins.security.ApiTokenProperty/generateNewToken and
|
||||
* /user/[user-login]/descriptorByName/jenkins.security.ApiTokenProperty/revokeAllExcept
|
||||
* - @[file-location] where the file contains plain text value of the token, all stuff explained above is applicable
|
||||
* The application will not delete the file after read, so the script is responsible to clean up the stuff
|
||||
*
|
||||
@@ -139,7 +139,7 @@ public class SetupWizard extends PageDecorator {
|
||||
*/
|
||||
/*package*/ void init(boolean newInstall) throws IOException, InterruptedException {
|
||||
Jenkins jenkins = Jenkins.get();
|
||||
|
||||
|
||||
if(newInstall) {
|
||||
// Create an admin user by default with a difficult password
|
||||
FilePath iapf = getInitialAdminPasswordFile();
|
||||
@@ -148,27 +148,27 @@ public class SetupWizard extends PageDecorator {
|
||||
HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(false, false, null);
|
||||
jenkins.setSecurityRealm(securityRealm);
|
||||
String randomUUID = UUID.randomUUID().toString().replace("-", "").toLowerCase(Locale.ENGLISH);
|
||||
|
||||
|
||||
// create an admin user
|
||||
User initialAdmin = securityRealm.createAccount(SetupWizard.initialSetupAdminUserName, randomUUID);
|
||||
|
||||
|
||||
if (ADMIN_INITIAL_API_TOKEN != null) {
|
||||
createInitialApiToken(initialAdmin);
|
||||
}
|
||||
|
||||
|
||||
// JENKINS-33599 - write to a file in the jenkins home directory
|
||||
// most native packages of Jenkins creates a machine user account 'jenkins' to run Jenkins,
|
||||
// and use group 'jenkins' for admins. So we allow groups to read this file
|
||||
iapf.touch(System.currentTimeMillis());
|
||||
iapf.chmod(0640);
|
||||
iapf.write(randomUUID + System.lineSeparator(), "UTF-8");
|
||||
|
||||
|
||||
|
||||
|
||||
// Lock Jenkins down:
|
||||
FullControlOnceLoggedInAuthorizationStrategy authStrategy = new FullControlOnceLoggedInAuthorizationStrategy();
|
||||
authStrategy.setAllowAnonymousRead(false);
|
||||
jenkins.setAuthorizationStrategy(authStrategy);
|
||||
|
||||
|
||||
// Disable jnlp by default, but honor system properties
|
||||
jenkins.setSlaveAgentPort(SystemProperties.getInteger(Jenkins.class.getName()+".slaveAgentPort",-1));
|
||||
|
||||
@@ -179,7 +179,7 @@ public class SetupWizard extends PageDecorator {
|
||||
bc.commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(iapf.exists()) {
|
||||
String setupKey = iapf.readToString().trim();
|
||||
String ls = System.lineSeparator();
|
||||
@@ -276,7 +276,7 @@ public class SetupWizard extends PageDecorator {
|
||||
throw new RuntimeException("Unable to remove PluginServletFilter for the SetupWizard", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indicates a generated password should be used - e.g. this is a new install, no security realm set up
|
||||
*/
|
||||
@@ -370,7 +370,7 @@ public class SetupWizard extends PageDecorator {
|
||||
Authentication auth = new UsernamePasswordAuthenticationToken(newUser.getId(), req.getParameter("password1"));
|
||||
auth = securityRealm.getSecurityComponents().manager2.authenticate(auth);
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
||||
|
||||
HttpSession session = req.getSession(false);
|
||||
if (session != null) {
|
||||
// avoid session fixation
|
||||
@@ -382,7 +382,7 @@ public class SetupWizard extends PageDecorator {
|
||||
String sessionSeed = userSeed.getSeed();
|
||||
// include the new seed
|
||||
newSession.setAttribute(UserSeedProperty.USER_SESSION_SEED, sessionSeed);
|
||||
|
||||
|
||||
CrumbIssuer crumbIssuer = Jenkins.get().getCrumbIssuer();
|
||||
JSONObject data = new JSONObject();
|
||||
if (crumbIssuer != null) {
|
||||
@@ -402,28 +402,28 @@ public class SetupWizard extends PageDecorator {
|
||||
admin.save(); // recreate this initial user if something failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@POST
|
||||
@Restricted(NoExternalUse.class)
|
||||
public HttpResponse doConfigureInstance(StaplerRequest req, @QueryParameter String rootUrl) {
|
||||
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
|
||||
|
||||
|
||||
Map<String, String> errors = new HashMap<>();
|
||||
// pre-check data
|
||||
checkRootUrl(errors, rootUrl);
|
||||
|
||||
|
||||
if(!errors.isEmpty()){
|
||||
return HttpResponses.errorJSON(Messages.SetupWizard_ConfigureInstance_ValidationErrors(), errors);
|
||||
}
|
||||
|
||||
|
||||
// use the parameters to configure the instance
|
||||
useRootUrl(errors, rootUrl);
|
||||
|
||||
|
||||
if(!errors.isEmpty()){
|
||||
return HttpResponses.errorJSON(Messages.SetupWizard_ConfigureInstance_ValidationErrors(), errors);
|
||||
}
|
||||
|
||||
|
||||
InstallUtil.proceedToNextStateFrom(InstallState.CONFIGURE_INSTANCE);
|
||||
|
||||
CrumbIssuer crumbIssuer = Jenkins.get().getCrumbIssuer();
|
||||
@@ -433,7 +433,7 @@ public class SetupWizard extends PageDecorator {
|
||||
}
|
||||
return HttpResponses.okJSON(data);
|
||||
}
|
||||
|
||||
|
||||
private void checkRootUrl(Map<String, String> errors, @CheckForNull String rootUrl){
|
||||
if(rootUrl == null){
|
||||
errors.put("rootUrl", Messages.SetupWizard_ConfigureInstance_RootUrl_Empty());
|
||||
@@ -443,7 +443,7 @@ public class SetupWizard extends PageDecorator {
|
||||
errors.put("rootUrl", Messages.SetupWizard_ConfigureInstance_RootUrl_Invalid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void useRootUrl(Map<String, String> errors, @CheckForNull String rootUrl){
|
||||
LOGGER.log(Level.FINE, "Root URL set during SetupWizard to {0}", new Object[]{ rootUrl });
|
||||
JenkinsLocationConfiguration.getOrDie().setUrl(rootUrl);
|
||||
@@ -452,7 +452,7 @@ public class SetupWizard extends PageDecorator {
|
||||
/*package*/ void setCurrentLevel(VersionNumber v) throws IOException {
|
||||
FileUtils.writeStringToFile(getUpdateStateFile(), v.toString(), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* File that captures the state of upgrade.
|
||||
*
|
||||
@@ -461,7 +461,7 @@ public class SetupWizard extends PageDecorator {
|
||||
/*package*/ static File getUpdateStateFile() {
|
||||
return new File(Jenkins.get().getRootDir(),"jenkins.install.UpgradeWizard.state");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* What is the version the upgrade wizard has run the last time and upgraded to?.
|
||||
* If {@link #getUpdateStateFile()} is missing, presumes the baseline is 1.0
|
||||
@@ -482,7 +482,7 @@ public class SetupWizard extends PageDecorator {
|
||||
}
|
||||
return from;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the initial plugin list in JSON format
|
||||
*/
|
||||
@@ -504,7 +504,7 @@ public class SetupWizard extends PageDecorator {
|
||||
}
|
||||
return HttpResponses.okJSON();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the system needs a restart, and if it is supported
|
||||
* e.g. { restartRequired: true, restartSupported: false }
|
||||
@@ -531,7 +531,7 @@ public class SetupWizard extends PageDecorator {
|
||||
}
|
||||
return getPlatformPluginsForUpdate(version, Jenkins.getVersion());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the suggested plugin list from the update sites, falling back to a local version
|
||||
* @return JSON array with the categorized plugin list
|
||||
@@ -551,7 +551,7 @@ public class SetupWizard extends PageDecorator {
|
||||
}
|
||||
try {
|
||||
URLConnection connection = ProxyConfiguration.open(new URL(suggestedPluginUrl));
|
||||
|
||||
|
||||
try {
|
||||
String initialPluginJson = IOUtils.toString(connection.getInputStream(), StandardCharsets.UTF_8);
|
||||
|
||||
@@ -624,7 +624,7 @@ public class SetupWizard extends PageDecorator {
|
||||
if (category instanceof JSONObject) {
|
||||
JSONObject cat = (JSONObject)category;
|
||||
JSONArray plugins = cat.getJSONArray("plugins");
|
||||
|
||||
|
||||
nextPlugin: for (Iterator<?> pluginIterator = plugins.iterator(); pluginIterator.hasNext();) {
|
||||
Object pluginData = pluginIterator.next();
|
||||
if (pluginData instanceof JSONObject) {
|
||||
@@ -658,10 +658,10 @@ public class SetupWizard extends PageDecorator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pluginIterator.remove();
|
||||
}
|
||||
|
||||
|
||||
if (plugins.isEmpty()) {
|
||||
categoryIterator.remove();
|
||||
}
|
||||
@@ -676,7 +676,7 @@ public class SetupWizard extends PageDecorator {
|
||||
public FilePath getInitialAdminPasswordFile() {
|
||||
return Jenkins.get().getRootPath().child("secrets/initialAdminPassword");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the file used to store the initial admin API Token, in case the system property
|
||||
* {@link #ADMIN_INITIAL_API_TOKEN} is set to "true" (and only in this case).
|
||||
@@ -694,21 +694,21 @@ public class SetupWizard extends PageDecorator {
|
||||
completeSetup();
|
||||
return HttpResponses.okJSON();
|
||||
}
|
||||
|
||||
|
||||
/*package*/ void completeSetup() throws IOException, ServletException {
|
||||
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
|
||||
InstallUtil.saveLastExecVersion();
|
||||
setCurrentLevel(Jenkins.getVersion());
|
||||
InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_SETUP_COMPLETED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets all the install states
|
||||
*/
|
||||
public List<InstallState> getInstallStates() {
|
||||
return InstallState.all();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an installState by name
|
||||
*/
|
||||
|
||||
@@ -370,9 +370,9 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
|
||||
@Deprecated
|
||||
private InstallState installState;
|
||||
|
||||
|
||||
/**
|
||||
* If we're in the process of an initial setup,
|
||||
* If we're in the process of an initial setup,
|
||||
* this will be set
|
||||
*/
|
||||
private transient SetupWizard setupWizard;
|
||||
@@ -1093,7 +1093,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
|
||||
/**
|
||||
* Set the proxy configuration.
|
||||
*
|
||||
*
|
||||
* @param proxy the proxy to set
|
||||
* @since 2.205
|
||||
*/
|
||||
@@ -1116,7 +1116,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the current install state. This will invoke state.initializeState()
|
||||
* Update the current install state. This will invoke state.initializeState()
|
||||
* when the state has been transitioned.
|
||||
*/
|
||||
public void setInstallState(@NonNull InstallState newState) {
|
||||
@@ -2425,7 +2425,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
* It is done in this order so that it can work correctly even in the face
|
||||
* of a reverse proxy.
|
||||
*
|
||||
* @return {@code null} if this parameter is not configured by the user and the calling thread is not in an HTTP request;
|
||||
* @return {@code null} if this parameter is not configured by the user and the calling thread is not in an HTTP request;
|
||||
* otherwise the returned URL will always have the trailing {@code /}
|
||||
* @throws IllegalStateException {@link JenkinsLocationConfiguration} cannot be retrieved.
|
||||
* Jenkins instance may be not ready, or there is an extension loading glitch.
|
||||
@@ -3951,7 +3951,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
boolean result = true;
|
||||
for (Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfigUnclassified())
|
||||
result &= configureDescriptor(req,json,d);
|
||||
|
||||
|
||||
save();
|
||||
updateComputerList();
|
||||
if(result)
|
||||
@@ -4201,7 +4201,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
throw new Failure(Messages.Hudson_TrailingDot());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// looks good
|
||||
}
|
||||
|
||||
@@ -4940,7 +4940,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
}
|
||||
return byCategory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If set, a currently active setup wizard - e.g. installation
|
||||
*
|
||||
@@ -4950,7 +4950,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
public SetupWizard getSetupWizard() {
|
||||
return setupWizard;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Exposes the current user to {@code /me} URL.
|
||||
*/
|
||||
@@ -4986,7 +4986,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test a path to see if it is subject to mandatory read permission checks by container-managed security
|
||||
* @param restOfPath the URI, excluding the Jenkins root URI and query string
|
||||
@@ -5307,7 +5307,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
LOGGER.log(WARNING, e, () -> "Unable to read Jenkins version: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VERSION = ver;
|
||||
context.setAttribute("version",ver);
|
||||
|
||||
@@ -5463,9 +5463,9 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
* Name of the system property escape hatch for SECURITY-2424. It allows to have back the legacy (and vulnerable)
|
||||
* behavior allowing a "good name" to end with a dot. This could be used to exploit two names colliding in the file
|
||||
* system to extract information. The files ending with a dot are only a problem on Windows.
|
||||
*
|
||||
*
|
||||
* The default value is true.
|
||||
*
|
||||
*
|
||||
* For detailed documentation: https://docs.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/file-folder-name-whitespace-characters
|
||||
* @see #checkGoodName(String)
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@ public class JenkinsLocationConfiguration extends GlobalConfiguration implements
|
||||
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "Accessible via System Groovy Scripts")
|
||||
public static /* not final */ boolean DISABLE_URL_VALIDATION =
|
||||
SystemProperties.getBoolean(JenkinsLocationConfiguration.class.getName() + ".disableUrlValidation");
|
||||
|
||||
|
||||
@Restricted(NoExternalUse.class)
|
||||
public static final int ORDINAL = 200;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class JenkinsLocationConfiguration extends GlobalConfiguration implements
|
||||
public static @NonNull JenkinsLocationConfiguration get() {
|
||||
return GlobalConfiguration.all().getInstance(JenkinsLocationConfiguration.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets local configuration. For explanation when it could die, see {@link #get()}
|
||||
*/
|
||||
|
||||
@@ -92,7 +92,7 @@ import org.kohsuke.stapler.interceptor.RequirePOST;
|
||||
*/
|
||||
@SuppressWarnings("unchecked") // AbstractItem.getParent does not correctly override; scheduleBuild2 inherently untypable
|
||||
public abstract class ParameterizedJobMixIn<JobT extends Job<JobT, RunT> & ParameterizedJobMixIn.ParameterizedJob<JobT, RunT> & Queue.Task, RunT extends Run<JobT, RunT> & Queue.Executable> {
|
||||
|
||||
|
||||
protected abstract JobT asJob();
|
||||
|
||||
/** @see BuildableItem#scheduleBuild() */
|
||||
|
||||
@@ -247,7 +247,7 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
|
||||
|
||||
/**
|
||||
* Historical holder for map.
|
||||
*
|
||||
*
|
||||
* TODO all this mess including {@link #numberOnDisk} could probably be simplified to a single {@code TreeMap<Integer,BuildReference<R>>}
|
||||
* where a null value means not yet loaded and a broken entry just uses {@code NoHolder}.
|
||||
*
|
||||
@@ -317,7 +317,7 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
|
||||
public final void updateBaseDir(File dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Let go of all the loaded references.
|
||||
*
|
||||
@@ -625,7 +625,7 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
|
||||
|
||||
/**
|
||||
* Tries to load the record #N.
|
||||
*
|
||||
*
|
||||
* @return null if the data failed to load.
|
||||
*/
|
||||
private R load(int n, Index editInPlace) {
|
||||
|
||||
@@ -3,13 +3,13 @@ package jenkins.views;
|
||||
/**
|
||||
* {@link Header} that provides its own resources as full replacement. It does not
|
||||
* depends on any core resource (images, CSS, JS, etc.)
|
||||
*
|
||||
*
|
||||
* Given this kind of header is totally independent, it will be compatible by default.
|
||||
*
|
||||
*
|
||||
* @see Header
|
||||
*/
|
||||
public abstract class FullHeader extends Header {
|
||||
|
||||
|
||||
public boolean isCompatible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user