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

[JENKINS-69966] Use string as alt text for icon (Jenkins 2.375 fix) #30

Merged
merged 3 commits into from Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
@@ -1,4 +1,3 @@
/.*
*.iml

/work
Expand Down
7 changes: 7 additions & 0 deletions .mvn/extensions.xml
@@ -0,0 +1,7 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.4</version>
</extension>
</extensions>
2 changes: 2 additions & 0 deletions .mvn/maven.config
@@ -0,0 +1,2 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
26 changes: 21 additions & 5 deletions pom.xml
Expand Up @@ -7,7 +7,7 @@
</parent>

<artifactId>cloud-stats</artifactId>
<version>0.28-SNAPSHOT</version>
<version>${revision}${changelist}</version>
<packaging>hpi</packaging>
<name>Cloud Statistics Plugin</name>
<description>Report Jenkins dynamic provisioning activities and statistics</description>
Expand All @@ -29,10 +29,10 @@
</licenses>

<scm>
<connection>scm:git:git://github.com/jenkinsci/cloud-stats-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/cloud-stats-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/cloud-stats-plugin</url>
<tag>HEAD</tag>
<connection>scm:git:git://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:git@github.com:${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</scm>

<dependencies>
Expand All @@ -42,6 +42,19 @@
<version>2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.2.0</version>
<scope>test</scope>
<exclusions>
<!-- JTH ships a newer version -->
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<repositories>
Expand All @@ -59,6 +72,9 @@
</pluginRepositories>

<properties>
<revision>0.28</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/cloud-stats-plugin</gitHubRepo>
<jenkins.version>2.235.1</jenkins.version>
<java.level>8</java.level>
<surefire.useFile>false</surefire.useFile>
Expand Down
Expand Up @@ -18,7 +18,7 @@ Health.Report report = index.cloudHealth(action.cloud.name).current
HealthReport hr = report.weather

h2 {
l.icon("class": "${hr.iconClassName} icon-md", alt: hr.score)
l.icon("class": "${hr.iconClassName} icon-md", alt: hr.score + "")
st.nbsp()
text("${action.displayName} (Health ${report})")
}
Expand Down
Expand Up @@ -56,13 +56,13 @@ l.layout(permission: stats.getRequiredPermission()) {
td()
td {
def score = ch.overall
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score)
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score + "")
st.nbsp()
text(score)
}
td {
def score = ch.current
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score)
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score + "")
st.nbsp()
text(score)
}
Expand All @@ -76,13 +76,13 @@ l.layout(permission: stats.getRequiredPermission()) {
td(template)
td {
def score = th.overall
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score)
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score + "")
st.nbsp()
text(score)
}
td {
def score = th.current
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score)
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score + "")
st.nbsp()
text(score)
}
Expand Down
Expand Up @@ -50,7 +50,7 @@ if (widget.displayed) {
tr {
def score = index.cloudHealth(cloudName).getCurrent()
td(colspan: 2) {
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score)
l.icon("class": "${score.weather.iconClassName} icon-sm", alt: score.weather.score + "")
st.nbsp()
if (cloudViews && j.getCloud(cloudName) != null) {
a(href: rootURL + "/cloud/" + cloudName) {
Expand All @@ -68,7 +68,7 @@ if (widget.displayed) {
tr {
td()
td {
l.icon("class": "${health.current.weather.iconClassName} icon-sm", alt: health.current.weather.score)
l.icon("class": "${health.current.weather.iconClassName} icon-sm", alt: health.current.weather.score + "")
st.nbsp()
text(templateName)
}
Expand Down
Expand Up @@ -31,12 +31,7 @@
import hudson.BulkChange;
import hudson.ExtensionList;
import hudson.Functions;
import hudson.model.Computer;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.model.Label;
import hudson.model.LoadStatistics;
import hudson.model.Node;
import hudson.model.*;
import hudson.model.queue.QueueTaskFuture;
import hudson.security.AuthorizationStrategy;
import hudson.slaves.NodeProvisioner;
Expand All @@ -56,12 +51,16 @@
import javax.annotation.Nonnull;
import java.io.ObjectStreamException;
import java.net.URL;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
Expand Down Expand Up @@ -229,13 +228,13 @@ public void ui() throws Exception {

Id okId = new Id("MyCloud", "working-template", "future-agent");
provisioningListener.onStarted(okId);
slave = TrackedAgent.create(okId, j);
provisioningListener.onComplete(okId, slave);
slave.toComputer().waitUntilOnline();
Thread.sleep(500);
slave.toComputer().doDoDelete();
final Node agent = TrackedAgent.create(okId, j);
provisioningListener.onComplete(okId, agent);
agent.toComputer().waitUntilOnline();
Thread.sleep(1000L);
agent.toComputer().doDoDelete();

Thread.sleep(500);
await().atMost(10, SECONDS).until(() -> j.jenkins.getNode(agent.getNodeName()) == null);
MarkEWaite marked this conversation as resolved.
Show resolved Hide resolved

// Then
ProvisioningActivity failedToProvision = cs.getActivityFor(failId);
Expand Down