Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init #192

Closed
wants to merge 52 commits into from
Closed

Init #192

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c06f1dc
Remove YUI
timja Jan 8, 2025
834891d
Merge branch 'master' into remove-yui
timja Jan 8, 2025
e8c71ee
Remove YUI suffix
timja Jan 9, 2025
9f8be1f
Merge branch 'master' into remove-yui
timja Jan 9, 2025
33aee9b
Update core/src/main/resources/lib/layout/yui.jelly
timja Jan 9, 2025
ce1ecd3
Restore DEBUG_YUI field for now
timja Jan 9, 2025
954c0c4
Init
janfaracik Jan 9, 2025
8090452
Rename class
janfaracik Jan 9, 2025
1a290c7
Update _buttons.scss
janfaracik Jan 9, 2025
4617883
Update _buttons.scss
janfaracik Jan 9, 2025
1c71f4c
Init
janfaracik Jan 9, 2025
991f787
Update DurationDetail.java
janfaracik Jan 9, 2025
f4f8ec9
Sorting out stuff
janfaracik Jan 9, 2025
701e7a7
Update Functions.java
janfaracik Jan 9, 2025
959a43b
Use passed in run
janfaracik Jan 9, 2025
4deafbd
Cleanup
janfaracik Jan 9, 2025
1a7bd33
Update DetailFactory.java
janfaracik Jan 9, 2025
abf4d00
Update Functions.java
janfaracik Jan 9, 2025
73a48c0
Make group of() private
janfaracik Jan 9, 2025
5d13a62
Update DetailGroup.java
janfaracik Jan 9, 2025
0da339b
Tidy up
janfaracik Jan 9, 2025
8886cd9
Push
janfaracik Jan 9, 2025
6fd6b1b
Update Detail.java
janfaracik Jan 9, 2025
8cdc3a6
Update Functions.java
janfaracik Jan 9, 2025
538ba93
Update DetailFactory.java
janfaracik Jan 9, 2025
c1cbb0d
Update DetailFactory.java
janfaracik Jan 9, 2025
53ad7f9
Consistent Jelly version for `commons-jelly-tags-xml` (#10131)
basil Jan 9, 2025
bcda96c
Remove Commons Discovery (#10122)
basil Jan 9, 2025
a49c83c
Update dependency org.jenkins-ci.main:jenkins-test-harness to v2376 (…
renovate[bot] Jan 9, 2025
6787247
Update core/src/main/java/hudson/Functions.java
timja Jan 9, 2025
45e27bb
Update core/src/main/java/hudson/Functions.java
timja Jan 9, 2025
2a55c2e
Update comment in `additionalAuthenticationChecks` to clarify why our…
dwnusbaum Jan 9, 2025
37082db
Merge branch 'master' into new-copy-button
timja Jan 9, 2025
cac4625
Update DetailGroup.java
janfaracik Jan 10, 2025
c649255
Add isApplicable
janfaracik Jan 10, 2025
b4b01ee
Update DetailGroup.java
janfaracik Jan 10, 2025
64babad
Update grid
janfaracik Jan 10, 2025
7fa6b5c
[JENKINS-75086] Allow users with Jenkins.MANAGE to configure global b…
mikecirioli Jan 10, 2025
d0aa978
Update the 'Copy' button animation (#10139)
krisstern Jan 12, 2025
9b6bc69
Remove YUI (#10135)
krisstern Jan 12, 2025
e5f18b5
Update comment in `additionalAuthenticationChecks` to clarify why our…
krisstern Jan 12, 2025
36c102b
Update dependency io.jenkins.plugins:design-library to v353
renovate[bot] Jan 12, 2025
e815917
Update dependency io.jenkins.plugins:design-library to v353 (#10144)
krisstern Jan 12, 2025
85269a5
Update dependency org.jenkins-ci.main:jenkins-test-harness to v2378
renovate[bot] Jan 12, 2025
271b098
Update dependency org.jenkins-ci.main:jenkins-test-harness to v2378 (…
krisstern Jan 13, 2025
e3e3c45
Update dependency org.jenkins-ci.plugins:cloudbees-folder to v6.976.v…
renovate[bot] Jan 13, 2025
7f11407
Apply suggestions from code review
timja Jan 13, 2025
d6cf74c
Merge branch 'master' into experimental-details-widget
janfaracik Jan 13, 2025
c53e9d5
Remove Javadoc implNote
janfaracik Jan 13, 2025
3647925
Add getUrl
janfaracik Jan 13, 2025
cd2d792
Update _cards.scss
janfaracik Jan 13, 2025
0085d2c
Update _cards.scss
janfaracik Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ node/

# libraries / external deps / generated files
src/main/js/plugin-setup-wizard/bootstrap-detached.js
war/src/main/webapp/scripts/yui
war/src/main/webapp/jsbundles/
src/main/scss/_bootstrap.scss

Expand Down
17 changes: 11 additions & 6 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ THE SOFTWARE.
<commons-fileupload2.version>2.0.0-M2</commons-fileupload2.version>
<groovy.version>2.4.21</groovy.version>
<jelly.version>1.1-jenkins-20250108</jelly.version>
<stapler.version>1940.v41211a_a_b_b_d8b_</stapler.version>
<stapler.version>1942.v708e07325402</stapler.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -132,11 +132,6 @@ THE SOFTWARE.
<artifactId>commons-io</artifactId>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand Down Expand Up @@ -243,11 +238,21 @@ THE SOFTWARE.
<artifactId>annotation-indexer</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>commons-jelly</artifactId>
<version>${jelly.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>commons-jelly-tags-fmt</artifactId>
<version>${jelly.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>${jelly.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>commons-jexl</artifactId>
Expand Down
48 changes: 14 additions & 34 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,40 +166,6 @@ THE SOFTWARE.
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<exclusions>
<exclusion>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly</artifactId>
</exclusion>
<exclusion>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-junit</artifactId>
</exclusion>
<exclusion>
<groupId>commons-jexl</groupId>
<artifactId>commons-jexl</artifactId>
</exclusion>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
<exclusion>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- Jenkins doesn't use this directly, but some plugins wanted to use the latest -->
<groupId>commons-lang</groupId>
Expand Down Expand Up @@ -310,6 +276,20 @@ THE SOFTWARE.
<groupId>org.jenkins-ci</groupId>
<artifactId>commons-jelly-tags-fmt</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<exclusions>
<exclusion>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
</exclusion>
<exclusion>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>commons-jexl</artifactId>
Expand Down
46 changes: 37 additions & 9 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import hudson.init.InitMilestone;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.Actionable;
import hudson.model.Computer;
import hudson.model.Describable;
import hudson.model.Descriptor;
Expand Down Expand Up @@ -161,6 +162,9 @@
import jenkins.console.ConsoleUrlProvider;
import jenkins.console.DefaultConsoleUrlProvider;
import jenkins.console.WithConsoleUrl;
import jenkins.model.Detail;
import jenkins.model.DetailFactory;
import jenkins.model.DetailGroup;
import jenkins.model.GlobalConfiguration;
import jenkins.model.GlobalConfigurationCategory;
import jenkins.model.Jenkins;
Expand Down Expand Up @@ -664,17 +668,14 @@ public static String validateIconSize(String iconSize) throws SecurityException
}

/**
* Gets the suffix to use for YUI JavaScript.
*/
public static String getYuiSuffix() {
return DEBUG_YUI ? "debug" : "min";
}

/**
* Set to true if you need to use the debug version of YUI.
* No longer used, to be removed after enough plugins have adopted a version of the test harness with
* <a href="https://github.com/jenkinsci/jenkins-test-harness/pull/874">jenkins-test-harness/pull/874</a> in it.
*
* @deprecated removed without replacement
*/
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "for script console")
public static boolean DEBUG_YUI = SystemProperties.getBoolean("debug.YUI");
@Deprecated(forRemoval = true, since = "TODO")
public static boolean DEBUG_YUI;

/**
* Creates a sub map by using the given range (both ends inclusive).
Expand Down Expand Up @@ -2589,6 +2590,33 @@ public static String generateItemId() {
return String.valueOf(Math.floor(Math.random() * 3000));
}

/**
* Returns a grouped list of Detail objects for the given Actionable object
*/
@Restricted(NoExternalUse.class)
public static Map<DetailGroup, List<Detail>> getDetailsFor(Actionable object) {
List<Detail> details = new ArrayList<>();

for (DetailFactory taf : DetailFactory.factoriesFor(object.getClass())) {
details.addAll(taf.createFor(object));
}

Map<DetailGroup, List<Detail>> orderedMap = new TreeMap<>(Comparator.comparingInt(DetailGroup::getOrder));

for (Detail detail : details) {
if (detail.isApplicable()) {
orderedMap.computeIfAbsent(detail.getGroup(), k -> new ArrayList<>()).add(detail);
}
}

for (Map.Entry<DetailGroup, List<Detail>> entry : orderedMap.entrySet()) {
List<Detail> detailList = entry.getValue();
detailList.sort(Comparator.comparingInt(Detail::getOrder));
}

return orderedMap;
}

@Restricted(NoExternalUse.class)
public static ExtensionList<SearchFactory> getSearchFactories() {
return SearchFactory.all();
Expand Down
21 changes: 1 addition & 20 deletions core/src/main/java/hudson/cli/CLICommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
import java.util.logging.Logger;
import jenkins.model.Jenkins;
import jenkins.util.SystemProperties;
import org.apache.commons.discovery.ResourceClassIterator;
import org.apache.commons.discovery.ResourceNameIterator;
import org.apache.commons.discovery.resource.ClassLoaders;
import org.apache.commons.discovery.resource.classes.DiscoverClasses;
import org.apache.commons.discovery.resource.names.DiscoverServiceNames;
import org.jvnet.hudson.annotation_indexer.Index;
import org.jvnet.tiger_types.Types;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -566,27 +561,13 @@ public static CLICommand getCurrent() {
if (j != null) { // only when running on the controller
// Register OptionHandlers through META-INF/services/annotations and Annotation Indexer
try {
for (Class c : Index.list(OptionHandlerExtension.class, Jenkins.get().pluginManager.uberClassLoader, Class.class)) {
for (Class c : Index.list(OptionHandlerExtension.class, j.getPluginManager().uberClassLoader, Class.class)) {
Type t = Types.getBaseClass(c, OptionHandler.class);
CmdLineParser.registerHandler(Types.erasure(Types.getTypeArgument(t, 0)), c);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}

// Register OptionHandlers through META-INF/services and Commons Discovery
ClassLoaders cls = new ClassLoaders();
cls.put(j.getPluginManager().uberClassLoader);
ResourceNameIterator servicesIter =
new DiscoverServiceNames(cls).findResourceNames(OptionHandler.class.getName());
final ResourceClassIterator itr =
new DiscoverClasses(cls).findResourceClasses(servicesIter);

while (itr.hasNext()) {
Class h = itr.nextResourceClass().loadClass();
Class c = Types.erasure(Types.getTypeArgument(Types.getBaseClass(h, OptionHandler.class), 0));
CmdLineParser.registerHandler(c, h);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
/**
* Refers to an {@link Item} by its name.
* May be subclassed to handle specific kinds of items.
* (Use {@code @MetaInfServices(OptionHandler.class)} to register the subclass.)
* (Use {@code @OptionHandlerExtension} to register the subclass.)
* @param <T> the kind of item being handled
* @since 1.538
*/
Expand Down
18 changes: 18 additions & 0 deletions core/src/main/java/hudson/model/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import hudson.AbortException;
import hudson.BulkChange;
import hudson.EnvVars;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.FeedAdapter;
Expand All @@ -53,6 +54,8 @@
import hudson.console.ModelHyperlinkNote;
import hudson.console.PlainTextConsoleOutputStream;
import hudson.model.Descriptor.FormException;
import hudson.model.details.DurationDetail;
import hudson.model.details.TimestampDetail;
import hudson.model.listeners.RunListener;
import hudson.model.listeners.SaveableListener;
import hudson.model.queue.SubTask;
Expand Down Expand Up @@ -115,6 +118,8 @@
import jenkins.model.ArtifactManagerConfiguration;
import jenkins.model.ArtifactManagerFactory;
import jenkins.model.BuildDiscarder;
import jenkins.model.Detail;
import jenkins.model.DetailFactory;
import jenkins.model.HistoricalBuild;
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
Expand Down Expand Up @@ -2669,4 +2674,17 @@ public void doDynamic(StaplerRequest2 req, StaplerResponse2 rsp) throws IOExcept
out.flush();
}
}

@Extension
public static final class BasicRunDetailFactory extends DetailFactory<Run> {

@Override
public Class<Run> type() {
return Run.class;
}

@NonNull @Override public Collection<? extends Detail> createFor(@NonNull Run target) {
return List.of(new TimestampDetail(target), new DurationDetail(target));
}
}
}
14 changes: 14 additions & 0 deletions core/src/main/java/hudson/model/details/DurationDetail.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package hudson.model.details;

import hudson.model.Run;
import jenkins.model.Detail;

/**
* Displays the duration of the given run, or, if the run has completed, shows the total time it took to execute
*/
public class DurationDetail extends Detail {

public DurationDetail(Run<?, ?> run) {
super(run);
}
}
14 changes: 14 additions & 0 deletions core/src/main/java/hudson/model/details/TimestampDetail.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package hudson.model.details;

import hudson.model.Run;
import jenkins.model.Detail;

/**
* Displays the start time of the given run
*/
public class TimestampDetail extends Detail {

public TimestampDetail(Run<?, ?> run) {
super(run);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ public GroupDetails loadGroupByGroupname(String groupname) throws org.acegisecur
class Authenticator extends AbstractUserDetailsAuthenticationProvider {
@Override
protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
// authentication is assumed to be done already in the retrieveUser method
// Authentication is done in the retrieveUser method. Note that this method being a no-op is only safe
// because we use Spring Security's default NullUserCache. If caching was enabled, it would be possible to
// log in as any cached user with any password unless we updated this method to check the provided
// authentication as recommended in the superclass method's documentation, so be careful reusing this code.
}

@Override
Expand Down
74 changes: 74 additions & 0 deletions core/src/main/java/jenkins/model/Detail.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package jenkins.model;

import edu.umd.cs.findbugs.annotations.Nullable;
import hudson.model.Actionable;
import hudson.model.ModelObject;
import hudson.model.Run;
import org.jenkins.ui.icon.IconSpec;

/**
* {@link Detail} represents a piece of information about a {@link Run}.
* Such information could include:
* <ul>
* <li>the date and time the run started</li>
* <li>the amount of time the run took to complete</li>
* <li>SCM information for the build</li>
* <li>who kicked the build off</li>
* </ul>
* @since TODO
*/
public abstract class Detail implements ModelObject, IconSpec {

private final Actionable object;

public Detail(Actionable object) {
this.object = object;
}

public Actionable getObject() {
return object;
}

/**
* {@inheritDoc}
*/
public @Nullable String getIconClassName() {
return null;
}

/**
* {@inheritDoc}
*/
@Override
public @Nullable String getDisplayName() {
return null;
}

/**
* Optional URL for the {@link Detail}
*/
public @Nullable String getUrl() {
return null;
}

/**
* Returns true if this detail is applicable to the given Actionable object
*/
public boolean isApplicable() {
return true;
}

/**
* @return the grouping of the detail
*/
public DetailGroup getGroup() {
return DetailGroup.GENERAL;
}

/**
* @return order in the group, zero is first, MAX_VALUE is any order
*/
public int getOrder() {
return Integer.MAX_VALUE;
}
}
Loading
Loading