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

Bump io.jenkins.tools.bom:bom-2.479.x from 3559.vb_5b_81183b_d23 to 3722.vcc62e7311580 #189

Closed
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -287,7 +287,7 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3559.vb_5b_81183b_d23</version>
<version>3722.vcc62e7311580</version>
<scope>import</scope>
<type>pom</type>
</dependency>

Unchanged files with check annotations Beta

* @return the default mode.
*/
public ScanMode getDefault() {
StaplerRequest2 request = Stapler.getCurrentRequest2();
if (request != null) {
String selected = (String)request.getSession(true).getAttribute(BFA_SOD_BUILD_TYPE);
if (!isBlank(selected)) {
ScanMode mode = getMode(selected);
if (mode != null) {
return mode;
}
}
}
return getMode(NonScanned.URL);
}
/**
* Stapler function to enable 'scan-on-demand/all' etc.
*
* @param url the scan mode
*
* @return most likely a {@link ScanMode}
*/
@SuppressWarnings("unused") //Stapler function
public Object getDynamic(String url) {
if (isBlank(url)) {
return getDefault();
} else {
return getMode(url);
}
}
/**
* Finds the mode with the provided url as returned by {@link ScanMode#getUrlName()}.
*
* @param url the url to match
*
* @return the scan mode or null if no matching scan mode is found.
*/
public ScanMode getMode(String url) {
for (ScanMode mode : ExtensionList.lookup(ScanMode.class)) {
if (mode.getUrlName().equals(url)) {
return mode;
}
}
return null;
}
/**
* Represents the different scan modes that can be used to re-scan the builds of a Job.
*
* @see NonScanned
* @see AllBuilds
*/
@Restricted(NoExternalUse.class)
public abstract static class ScanMode implements ExtensionPoint {
/**
* Session key used to store the default scan mode
*/
static final String BFA_SOD_BUILD_TYPE = "bfa-sod-buildType";
/**
* If there is any run in the job matching this scan mode's criteria.
* Default implementation is {@link #getRuns(Job)}{@code .hasNext()}
* @param job the job to check
*
* @return true if so.
*/
@SuppressWarnings("unused") //Called by the view
public boolean hasAnyRun(Job job) {
return getRuns(job).hasNext();
}
/**
* The short relative url name of this scan mode.
* Also used as a short identifier of the scan mode.
*
* @return the url name
*/
@NonNull
public abstract String getUrlName();
/**
* The full url from the root of Jenkins.
*
* @return the full url
* @see ScanOnDemandBaseAction#getFullUrl()
*/
@CheckForNull
public String getFullUrl() {
final String fullUrl = getParent().getFullUrl();
if (fullUrl == null) {
return null;
}
return Functions.joinPath(fullUrl, getUrlName());
}
/**
* Human readable name to display.
*
* @return the name
*/
@NonNull
public abstract String getDisplayName();
/**
* Provides an iterator of the {@link Run}s of the provided job that matches this scan mode.
*
* @param job the job to filter builds from
* @return an iterator of the matching builds
*/
@NonNull
abstract Iterator<Run> getRuns(Job job);
/**
* Sets this scan mode as the default for this user on future page visits.
*/
@SuppressWarnings("unused") //Called by the view
public void setAsDefault() {
StaplerRequest2 request = Stapler.getCurrentRequest2();

Check warning on line 317 in src/main/java/com/sonyericsson/jenkins/plugins/bfa/sod/ScanOnDemandBaseAction.java

ci.jenkins.io / Code Coverage

Not covered lines

Lines 200-317 are not covered by tests
if (request == null) {
throw new IllegalStateException("setAsDefault() can only be called in request scope");
}