Class PeepholePermalink
- java.lang.Object
-
- hudson.model.PermalinkProjectAction.Permalink
-
- jenkins.model.PeepholePermalink
-
public abstract class PeepholePermalink extends PermalinkProjectAction.Permalink implements Predicate<Run<?,?>>
Convenient base implementation forPermalinkProjectAction.Permalinks that satisfy certain properties.For a permalink to be able to use this, it has to satisfy the following:
Given a job J, permalink is a function F that computes a build B. A peephole permalink is a subset of this function that can be deduced to the "peep-hole" function G(B)→bool:
F(J) = { newest B | G(B)==true }Intuitively speaking, a peep-hole permalink resolves to the latest build that satisfies a certain characteristics that can be determined solely by looking at the build and nothing else (most commonly its build result.)
This base class provides a file-based caching mechanism that avoids walking the long build history.
The implementation transparently tolerates G(B) that goes from true to false over time (it simply scans the history till find the new matching build.) To tolerate G(B) that goes from false to true, you need to be able to intercept whenever G(B) changes from false to true, then call
resolve(Job)to check the current permalink target is up to date, then callupdateCache(Job, Run)if it needs updating.- Since:
- 1.507
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPeepholePermalink.RunListenerImpl
-
Field Summary
Fields Modifier and Type Field Description static PermalinkProjectAction.PermalinkLAST_COMPLETED_BUILDstatic PermalinkProjectAction.PermalinkLAST_FAILED_BUILDstatic PermalinkProjectAction.PermalinkLAST_STABLE_BUILDstatic PermalinkProjectAction.PermalinkLAST_SUCCESSFUL_BUILDstatic PermalinkProjectAction.PermalinkLAST_UNSTABLE_BUILDstatic PermalinkProjectAction.PermalinkLAST_UNSUCCESSFUL_BUILD-
Fields inherited from class hudson.model.PermalinkProjectAction.Permalink
BUILTIN, LAST_BUILD
-
-
Constructor Summary
Constructors Constructor Description PeepholePermalink()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract booleanapply(Run<?,?> run)Checks if the given build satisfies the peep-hole criteria.protected FilegetPermalinkFile(Job<?,?> job)Deprecated.No longer used.static voidinitialized()Run<?,?>resolve(Job<?,?> job)Resolves the permalink by using the cache if possible.booleantest(Run<?,?> run)protected voidupdateCache(Job<?,?> job, Run<?,?> b)Remembers the value 'n' in the cache for futureresolve(Job).-
Methods inherited from class hudson.model.PermalinkProjectAction.Permalink
getDisplayName, getId
-
-
-
-
Field Detail
-
LAST_STABLE_BUILD
public static final PermalinkProjectAction.Permalink LAST_STABLE_BUILD
- Since:
- 2.436
-
LAST_SUCCESSFUL_BUILD
public static final PermalinkProjectAction.Permalink LAST_SUCCESSFUL_BUILD
- Since:
- 2.436
-
LAST_FAILED_BUILD
public static final PermalinkProjectAction.Permalink LAST_FAILED_BUILD
- Since:
- 2.436
-
LAST_UNSTABLE_BUILD
public static final PermalinkProjectAction.Permalink LAST_UNSTABLE_BUILD
- Since:
- 2.436
-
LAST_UNSUCCESSFUL_BUILD
public static final PermalinkProjectAction.Permalink LAST_UNSUCCESSFUL_BUILD
- Since:
- 2.436
-
LAST_COMPLETED_BUILD
public static final PermalinkProjectAction.Permalink LAST_COMPLETED_BUILD
- Since:
- 2.436
-
-
Method Detail
-
apply
public abstract boolean apply(Run<?,?> run)
Checks if the given build satisfies the peep-hole criteria. This is the "G(B)" as described in the class javadoc.
-
getPermalinkFile
@Deprecated protected File getPermalinkFile(Job<?,?> job)
Deprecated.No longer used.
-
resolve
public Run<?,?> resolve(Job<?,?> job)
Resolves the permalink by using the cache if possible.- Specified by:
resolvein classPermalinkProjectAction.Permalink- Returns:
- null if the target of the permalink doesn't exist.
-
updateCache
protected void updateCache(@NonNull Job<?,?> job, @CheckForNull Run<?,?> b)Remembers the value 'n' in the cache for futureresolve(Job).
-
initialized
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void initialized()
-
-