Skip to content

Commit

Permalink
Merge branch 'fix-project-config-page-tabs' into update-forms
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Nov 5, 2021
2 parents 177c259 + 5537928 commit 9973c71
Show file tree
Hide file tree
Showing 158 changed files with 2,292 additions and 2,288 deletions.
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ updates:
# will require source code changes to replace javax.mail with jakarta.mail
# and some handling for plugins that depend on javax.mail being provided by Jenkins core.
- dependency-name: "com.sun.mail:jakarta.mail"
# needs updates in a number of plugins, see https://github.com/jenkinsci/jenkins/pull/5059 and https://github.com/jenkinsci/bom/pull/392
- dependency-name: "com.google.guava:*"
# this is a banned dependency, we have a hack in our pom to prevent anyone else pulling it in
- dependency-name: "javax.servlet.servlet-api"
# needs a jakarta upgrade project, imports changed
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
private_key: ${{ secrets.JENKINS_CHANGELOG_UPDATER_PRIVATE_KEY }}
repository: jenkins-infra/jenkins.io
- name: Check out
uses: actions/checkout@v2.3.5
uses: actions/checkout@v2.4.0
with:
fetch-depth: 0
- name: Publish jenkins.io changelog draft
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
project-version: ${{ steps.set-version.outputs.project-version }}
is-lts: ${{ steps.set-version.outputs.is-lts }}
steps:
- uses: actions/checkout@v2.3.5
- uses: actions/checkout@v2.4.0
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>11.0.1</version>
<version>31.0.1-jre</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
Expand Down Expand Up @@ -191,7 +191,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
<version>3.1.10</version>
<version>3.1.11</version>
</dependency>
<dependency>
<groupId>org.kohsuke</groupId>
Expand Down
20 changes: 12 additions & 8 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ THE SOFTWARE.
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
<exclusion> <!-- TODO it seems to want Guava 16; apparently it manages to run against 11 -->
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -538,9 +534,17 @@ THE SOFTWARE.
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<exclusions>
<exclusion> <!-- pick up from SpotBugs Annotations -->
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<exclusion>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.j2objc</groupId>
<artifactId>j2objc-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down Expand Up @@ -719,7 +723,7 @@ THE SOFTWARE.
<!-- Version specified in grandparent POM -->
<configuration>
<forkCount>0.5C</forkCount>
<reuseForks>true</reuseForks>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
<plugin><!-- set main class -->
Expand Down
272 changes: 149 additions & 123 deletions core/src/main/java/hudson/FilePath.java

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions core/src/main/java/hudson/PluginFirstClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
public class PluginFirstClassLoader
extends AntClassLoader
{
static {
registerAsParallelCapable();
}

public PluginFirstClassLoader() {
super(null, false);
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/StructuredForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

/**
* Obtains the structured form data from {@link StaplerRequest}.
* See http://wiki.jenkins-ci.org/display/JENKINS/Structured+Form+Submission
* See https://www.jenkins.io/doc/developer/forms/structured-form-submission/
*
* @author Kohsuke Kawaguchi
*/
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/XmlFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
* There's a few other possibilities, such as implementing a custom
* {@link Converter} for XStream, or {@link XStream#alias(String, Class) registering an alias}.
*
* @see <a href="https://wiki.jenkins-ci.org/display/JENKINS/Architecture#Architecture-Persistence">Architecture » Persistence</a>
* @see <a href="https://www.jenkins.io/doc/developer/persistence/">Architecture » Persistence</a>
* @author Kohsuke Kawaguchi
*/
public final class XmlFile {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/cli/CLICommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
* calls {@link #main(List, Locale, InputStream, PrintStream, PrintStream)} method.
*
* <h2>Note for CLI command implementor</h2>
* Start with <a href="http://wiki.jenkins-ci.org/display/JENKINS/Writing+CLI+commands">this document</a>
* Start with <a href="https://www.jenkins.io/doc/developer/cli/writing-cli-commands/">this document</a>
* to get the general idea of CLI.
*
* <ul>
Expand Down
15 changes: 0 additions & 15 deletions core/src/main/java/hudson/model/Computer.java
Original file line number Diff line number Diff line change
Expand Up @@ -613,21 +613,6 @@ public BuildTimelineWidget getTimeline() {
return new BuildTimelineWidget(getBuilds());
}

@Override
public void taskAccepted(Executor executor, Queue.Task task) {
// dummy implementation
}

@Override
public void taskCompleted(Executor executor, Queue.Task task, long durationMS) {
// dummy implementation
}

@Override
public void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems) {
// dummy implementation
}

@Exported
public boolean isOffline() {
return temporarilyOffline || getChannel()==null;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/DependencyGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void build() {
/**
*
*
* See http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm
* See https://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm
*/
private void topologicalDagSort() {
DirectedGraph<AbstractProject> g = new DirectedGraph<AbstractProject>() {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/model/Descriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ public T newInstance(StaplerRequest req) throws FormException {
* Always non-null (see note above.) This object includes represents the entire submission.
* @param formData
* The JSON object that captures the configuration data for this {@link Descriptor}.
* See http://wiki.jenkins-ci.org/display/JENKINS/Structured+Form+Submission
* See https://www.jenkins.io/doc/developer/forms/structured-form-submission/
* Always non-null.
*
* @throws FormException
Expand Down Expand Up @@ -809,7 +809,7 @@ public boolean configure( StaplerRequest req ) throws FormException {
*
* @param json
* The JSON object that captures the configuration data for this {@link Descriptor}.
* See http://wiki.jenkins-ci.org/display/JENKINS/Structured+Form+Submission
* See https://www.jenkins.io/doc/developer/forms/structured-form-submission/
* @return false
* to keep the client in the same config page.
*/
Expand Down
18 changes: 14 additions & 4 deletions core/src/main/java/hudson/model/ExecutorListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,40 @@
*/
package hudson.model;

import hudson.ExtensionPoint;
import hudson.slaves.SlaveComputer;

/**
* A listener for task related events from executors.
* A {@link Computer#getRetentionStrategy} or {@link SlaveComputer#getLauncher} may implement this interface.
* Or you may create an implementation as an extension (since TODO).
* @author Stephen Connolly
* @since 1.312
*/
public interface ExecutorListener {
public interface ExecutorListener extends ExtensionPoint {

/**
* Called whenever a task is accepted by an executor.
* @param executor The executor.
* @param task The task.
*/
void taskAccepted(Executor executor, Queue.Task task);
default void taskAccepted(Executor executor, Queue.Task task) {}

/**
* Called whenever a task is started by an executor.
* @param executor The executor.
* @param task The task.
* @since TODO
*/
default void taskStarted(Executor executor, Queue.Task task) {}

/**
* Called whenever a task is completed without any problems by an executor.
* @param executor The executor.
* @param task The task.
* @param durationMS The number of milliseconds that the task took to complete.
*/
void taskCompleted(Executor executor, Queue.Task task, long durationMS);
default void taskCompleted(Executor executor, Queue.Task task, long durationMS) {}

/**
* Called whenever a task is completed with some problems by an executor.
Expand All @@ -55,5 +65,5 @@ public interface ExecutorListener {
* @param durationMS The number of milliseconds that the task took to complete.
* @param problems The exception that was thrown.
*/
void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems);
default void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems) {}
}
19 changes: 12 additions & 7 deletions core/src/main/java/hudson/model/TimeZoneProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;

Expand Down Expand Up @@ -76,12 +77,12 @@ public boolean isEnabled() {
return true;
}

public ListBoxModel doFillTimeZoneNameItems() {
String current = forCurrentUser();
public ListBoxModel doFillTimeZoneNameItems(@AncestorInPath User user) {
String userTimezone = user != null ? forUser(user) : forCurrentUser();
ListBoxModel items = new ListBoxModel();
items.add(Messages.TimeZoneProperty_DisplayDefaultTimeZone(), "");
for (String id : TimeZone.getAvailableIDs()) {
if (id.equalsIgnoreCase(current)) {
if (id.equalsIgnoreCase(userTimezone)) {
items.add(new Option(id, id, true));
} else {
items.add(id);
Expand All @@ -103,15 +104,19 @@ public FormValidation doCheckTimeZoneName(@QueryParameter String timeZoneName) {

}

@Nullable
@CheckForNull
public static String forCurrentUser() {
final User current = User.current();
if (current == null) {
return null;
}
return forUser(current);
}

TimeZoneProperty tzp = current.getProperty(TimeZoneProperty.class);
if(tzp.timeZoneName == null || tzp.timeZoneName.isEmpty()) {
@CheckForNull
private static String forUser(User user) {
TimeZoneProperty tzp = user.getProperty(TimeZoneProperty.class);
if (tzp.timeZoneName == null || tzp.timeZoneName.isEmpty()) {
return null;
}

Expand All @@ -120,7 +125,7 @@ public static String forCurrentUser() {
//TimeZone.getTimeZone returns GMT on invalid time zone so
//warn the user if the time zone returned is different from
//the one they specified.
LOGGER.log(Level.WARNING, "Invalid user time zone {0} for {1}", new Object[]{tzp.timeZoneName, current.getId()});
LOGGER.log(Level.WARNING, "Invalid user time zone {0} for {1}", new Object[]{tzp.timeZoneName, user.getId()});
return null;
}

Expand Down
34 changes: 34 additions & 0 deletions core/src/main/java/hudson/model/queue/WorkUnitContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@
*/
package hudson.model.queue;

import hudson.ExtensionList;
import hudson.model.Action;
import hudson.model.Executor;
import hudson.model.ExecutorListener;
import hudson.model.Queue;
import hudson.model.Queue.BuildableItem;
import hudson.model.Queue.Task;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

Expand All @@ -41,6 +45,8 @@
*/
public final class WorkUnitContext {

private static final Logger LOGGER = Logger.getLogger(WorkUnitContext.class.getName());

public final BuildableItem item;

public final Task task;
Expand Down Expand Up @@ -81,6 +87,13 @@ protected void onCriteriaMet() {
Executor e = Executor.currentExecutor();
if (e.getCurrentWorkUnit().isMainWork()) {
e.getOwner().taskAccepted(e,task);
for (ExecutorListener listener : ExtensionList.lookup(ExecutorListener.class)) {
try {
listener.taskAccepted(e, task);
} catch (RuntimeException x) {
LOGGER.log(Level.WARNING, null, x);
}
}
}
}
};
Expand Down Expand Up @@ -120,6 +133,13 @@ public void synchronizeStart() throws InterruptedException {
WorkUnit wu = e.getCurrentWorkUnit();
if (wu.isMainWork()) {
future.start.set(e.getCurrentExecutable());
for (ExecutorListener listener : ExtensionList.lookup(ExecutorListener.class)) {
try {
listener.taskStarted(e, task);
} catch (RuntimeException x) {
LOGGER.log(Level.WARNING, null, x);
}
}
}
}
}
Expand Down Expand Up @@ -149,9 +169,23 @@ public void synchronizeEnd(Executor e, Queue.Executable executable, Throwable pr
if (problems == null) {
future.set(executable);
e.getOwner().taskCompleted(e, task, duration);
for (ExecutorListener listener : ExtensionList.lookup(ExecutorListener.class)) {
try {
listener.taskCompleted(e, task, duration);
} catch (RuntimeException x) {
LOGGER.log(Level.WARNING, null, x);
}
}
} else {
future.set(problems);
e.getOwner().taskCompletedWithProblems(e, task, duration, problems);
for (ExecutorListener listener : ExtensionList.lookup(ExecutorListener.class)) {
try {
listener.taskCompletedWithProblems(e, task, duration, problems);
} catch (RuntimeException x) {
LOGGER.log(Level.WARNING, null, x);
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/scm/SCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
*
* <p>
* If you are interested in writing a subclass in a plugin,
* also take a look at <a href="http://wiki.jenkins-ci.org/display/JENKINS/Writing+an+SCM+plugin">
* also take a look at <a href="https://www.jenkins.io/doc/developer/plugin-development/writing-an-scm-plugin/">
* "Writing an SCM plugin"</a> wiki article.
*
* @author Kohsuke Kawaguchi
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/security/Permission.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* Each permission is represented by a specific instance of {@link Permission}.
*
* @author Kohsuke Kawaguchi
* @see <a href="https://wiki.jenkins-ci.org/display/JENKINS/Making+your+plugin+behave+in+secured+Jenkins">Plugins in secured Jenkins</a>
* @see <a href="https://www.jenkins.io/doc/developer/security/">Security</a>
*/
public final class Permission {

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/security/csrf/CrumbIssuer.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* forged by a third party.
*
* @author dty
* @see <a href="http://en.wikipedia.org/wiki/XSRF">Wikipedia: Cross site request forgery</a>
* @see <a href="https://en.wikipedia.org/wiki/Cross-site_request_forgery">Wikipedia: Cross site request forgery</a>
*/
@ExportedBean
@StaplerAccessibleType
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/security/package.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@

<html><head/><body>
Security-related code.
See: <a href="https://wiki.jenkins-ci.org/display/JENKINS/Making+your+plugin+behave+in+secured+Jenkins">Making your plugin behave in secured Jenkins</a>
See: <a href="https://www.jenkins.io/doc/developer/security/">Security</a>
</body></html>
Loading

0 comments on commit 9973c71

Please sign in to comment.