本文整理了Java中hudson.model.AbstractBuild.getAction()
方法的一些代码示例,展示了AbstractBuild.getAction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractBuild.getAction()
方法的具体详情如下:
包路径:hudson.model.AbstractBuild
类名称:AbstractBuild
方法名:getAction
暂无
代码示例来源:origin: jenkinsci/jenkins
/**
* @deprecated Use {@link #getAction(Class)} on {@code AbstractTestResultAction}.
*/
@Deprecated
public Action getTestResultAction() {
try {
return getAction(Jenkins.getInstance().getPluginManager().uberClassLoader.loadClass("hudson.tasks.test.AbstractTestResultAction").asSubclass(Action.class));
} catch (ClassNotFoundException x) {
return null;
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* @deprecated Use {@link #getAction(Class)} on {@code AggregatedTestResultAction}.
*/
@Deprecated
public Action getAggregatedTestResultAction() {
try {
return getAction(Jenkins.getInstance().getPluginManager().uberClassLoader.loadClass("hudson.tasks.test.AggregatedTestResultAction").asSubclass(Action.class));
} catch (ClassNotFoundException x) {
return null;
}
}
代码示例来源:origin: jenkinsci/jenkins
@Deprecated
public boolean checkout(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener, @Nonnull File changelogFile) throws IOException, InterruptedException {
AbstractBuild<?,?> prev = build.getPreviousBuild();
checkout((Run) build, launcher, workspace, listener, changelogFile, prev != null ? prev.getAction(SCMRevisionState.class) : null);
return true;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets the changes in the dependency between the given build and this build.
* @return empty if there is no {@link FingerprintAction}
*/
public Map<AbstractProject,DependencyChange> getDependencyChanges(AbstractBuild from) {
if (from==null) return Collections.emptyMap(); // make it easy to call this from views
FingerprintAction n = this.getAction(FingerprintAction.class);
FingerprintAction o = from.getAction(FingerprintAction.class);
if (n==null || o==null) return Collections.emptyMap();
Map<AbstractProject,Integer> ndep = n.getDependencies(true);
Map<AbstractProject,Integer> odep = o.getDependencies(true);
Map<AbstractProject,DependencyChange> r = new HashMap<AbstractProject,DependencyChange>();
for (Map.Entry<AbstractProject,Integer> entry : odep.entrySet()) {
AbstractProject p = entry.getKey();
Integer oldNumber = entry.getValue();
Integer newNumber = ndep.get(p);
if (newNumber!=null && oldNumber.compareTo(newNumber)<0) {
r.put(p,new DependencyChange(p,oldNumber,newNumber));
}
}
return r;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Pushes the baseline up to the newly checked out revision.
*/
private void calcPollingBaseline(AbstractBuild build, Launcher launcher, TaskListener listener) throws IOException, InterruptedException {
SCMRevisionState baseline = build.getAction(SCMRevisionState.class);
if (baseline==null) {
try {
baseline = getScm().calcRevisionsFromBuild(build, launcher, listener);
} catch (AbstractMethodError e) {
baseline = SCMRevisionState.NONE; // pre-1.345 SCM implementations, which doesn't use the baseline in polling
}
if (baseline!=null)
build.addAction(baseline);
}
pollingBaseline = baseline;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Builds up a set of variable names that contain sensitive values that
* should not be exposed. The expectation is that this set is populated with
* keys returned by {@link #getBuildVariables()} that should have their
* values masked for display purposes.
*
* @since 1.378
*/
public Set<String> getSensitiveBuildVariables() {
Set<String> s = new HashSet<String>();
ParametersAction parameters = getAction(ParametersAction.class);
if (parameters != null) {
for (ParameterValue p : parameters) {
if (p.isSensitive()) {
s.add(p.getName());
}
}
}
// Allow BuildWrappers to determine if any of their data is sensitive
if (project instanceof BuildableItemWithBuildWrappers) {
for (BuildWrapper bw : ((BuildableItemWithBuildWrappers) project).getBuildWrappersList()) {
bw.makeSensitiveBuildVariables(this, s);
}
}
return s;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets the dependency relationship from this build (as the sink)
* and that project (as the source.)
*
* @return
* Build number of the upstream build that feed into this build,
* or -1 if no record is available (for example if there is no {@link FingerprintAction}, even if there is an {@link Cause.UpstreamCause}).
*/
public int getUpstreamRelationship(AbstractProject that) {
FingerprintAction f = getAction(FingerprintAction.class);
if (f==null) return -1;
int n = -1;
// look for fingerprints that point to the given project as the source, and merge them all
for (Fingerprint e : f.getFingerprints().values()) {
if (upstreamCulprits) {
// With upstreamCulprits, we allow upstream relationships
// from intermediate jobs
Fingerprint.RangeSet rangeset = e.getRangeSet(that);
if (!rangeset.isEmpty()) {
n = Math.max(n, rangeset.listNumbersReverse().iterator().next());
}
} else {
BuildPtr o = e.getOriginal();
if (o!=null && o.belongsTo(that))
n = Math.max(n,o.getNumber());
}
}
return n;
}
代码示例来源:origin: jenkinsci/jenkins
Map<String,String> r = new HashMap<String, String>();
ParametersAction parameters = getAction(ParametersAction.class);
if (parameters!=null) {
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets the dependency relationship from this build (as the source)
* and that project (as the sink.)
*
* @return
* range of build numbers that represent which downstream builds are using this build.
* The range will be empty if no build of that project matches this (or there is no {@link FingerprintAction}), but it'll never be null.
*/
public RangeSet getDownstreamRelationship(AbstractProject that) {
RangeSet rs = new RangeSet();
FingerprintAction f = getAction(FingerprintAction.class);
if (f==null) return rs;
// look for fingerprints that point to this build as the source, and merge them all
for (Fingerprint e : f.getFingerprints().values()) {
if (upstreamCulprits) {
// With upstreamCulprits, we allow downstream relationships
// from intermediate jobs
rs.add(e.getRangeSet(that));
} else {
BuildPtr o = e.getOriginal();
if (o!=null && o.is(this))
rs.add(e.getRangeSet(that));
}
}
return rs;
}
代码示例来源:origin: jenkinsci/jenkins
SCMRevisionState s = r.getAction(SCMRevisionState.class);
if (s!=null) {
pollingBaseline = s;
代码示例来源:origin: jenkinsci/jenkins
/**
* Obtains the {@link WorkspaceSnapshot} object that this {@link SCM} points to,
* or throws {@link hudson.fsp.WorkspaceSnapshotSCM.ResolvedFailedException} upon failing.
*
* @return never null.
*/
public Snapshot resolve() throws ResolvedFailedException {
Jenkins h = Jenkins.getInstance();
AbstractProject<?,?> job = h.getItemByFullName(jobName, AbstractProject.class);
if(job==null) {
if(h.getItemByFullName(jobName)==null) {
AbstractProject nearest = AbstractProject.findNearest(jobName);
throw new ResolvedFailedException(Messages.WorkspaceSnapshotSCM_NoSuchJob(jobName,nearest.getFullName()));
} else
throw new ResolvedFailedException(Messages.WorkspaceSnapshotSCM_IncorrectJobType(jobName));
}
PermalinkList permalinks = job.getPermalinks();
Permalink p = permalinks.get(permalink);
if(p==null)
throw new ResolvedFailedException(Messages.WorkspaceSnapshotSCM_NoSuchPermalink(permalink,jobName));
AbstractBuild<?,?> b = (AbstractBuild<?,?>)p.resolve(job);
if(b==null)
throw new ResolvedFailedException(Messages.WorkspaceSnapshotSCM_NoBuild(permalink,jobName));
WorkspaceSnapshot snapshot = b.getAction(WorkspaceSnapshot.class);
if(snapshot==null)
throw new ResolvedFailedException(Messages.WorkspaceSnapshotSCM_NoWorkspace(jobName,permalink));
return new Snapshot(snapshot,b);
}
代码示例来源:origin: hudson/hudson-2.x
private <U extends AbstractTestResultAction> U getPreviousResult(Class<U> type) {
AbstractBuild<?,?> b = owner;
while(true) {
b = b.getPreviousBuild();
if(b==null)
return null;
U r = b.getAction(type);
if(r!=null)
return r;
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Gets the counter part of this {@link TestResult} in the specified run.
*
* @return null if no such counter part exists.
*/
public TestResult getResultInBuild(AbstractBuild<?,?> build) {
AbstractTestResultAction tra = build.getAction(getParentAction().getClass());
if (tra == null) {
tra = build.getAction(AbstractTestResultAction.class);
}
return (tra == null) ? null : tra.findCorrespondingResult(this.getId());
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* @deprecated Use {@link #getAction(Class)} on {@code AbstractTestResultAction}.
*/
@Deprecated
public Action getTestResultAction() {
try {
return getAction(Jenkins.getInstance().getPluginManager().uberClassLoader.loadClass("hudson.tasks.test.AbstractTestResultAction").asSubclass(Action.class));
} catch (ClassNotFoundException x) {
return null;
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* @deprecated Use {@link #getAction(Class)} on {@code AggregatedTestResultAction}.
*/
@Deprecated
public Action getAggregatedTestResultAction() {
try {
return getAction(Jenkins.getInstance().getPluginManager().uberClassLoader.loadClass("hudson.tasks.test.AggregatedTestResultAction").asSubclass(Action.class));
} catch (ClassNotFoundException x) {
return null;
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Deprecated
public boolean checkout(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener, @Nonnull File changelogFile) throws IOException, InterruptedException {
AbstractBuild<?,?> prev = build.getPreviousBuild();
checkout((Run) build, launcher, workspace, listener, changelogFile, prev != null ? prev.getAction(SCMRevisionState.class) : null);
return true;
}
代码示例来源:origin: org.hudsonci.plugins/analysis-core
@Override
public String evaluate(final AbstractBuild<?, ?> context, final TaskListener listener, final String macroName)
throws MacroEvaluationException, IOException, InterruptedException {
for (Class<? extends ResultAction<? extends BuildResult>> resultActionType : resultActions) {
ResultAction<? extends BuildResult> action = context.getAction(resultActionType);
if (action != null) {
return evaluate(action.getResult());
}
}
return "";
}
代码示例来源:origin: org.jvnet.hudson.plugins/git
@Override
public Action getAction(AbstractBuild<?, ?> build, TaskListener listener) {
BuildData data = build.getAction(BuildData.class);
if (data == null) {
listener.getLogger().println("This project doesn't use Git as SCM. Can't pass the revision to downstream");
return null;
}
return new RevisionParameterAction(data.getLastBuiltRevision().getSha1String());
}
代码示例来源:origin: org.jvnet.hudson.main/maven3-plugin
/**
* Attach the build action if its not already attached
*/
private void attachBuildAction( final AbstractBuild<?, ?> build )
{
if (build.getAction(MavenBuildAction.class) == null) {
build.addAction(new MavenBuildAction(build));
}
}
代码示例来源:origin: Diabol/delivery-pipeline-plugin
static void setVersion(AbstractBuild build, String version) {
PipelineVersionAction action = build.getAction(PipelineVersionAction.class);
if (action == null) {
build.addAction(new PipelineVersionAction(version));
} else {
build.replaceAction(action);
}
build.replaceAction(getVersionParameterAction(build, version));
}
内容来源于网络,如有侵权,请联系作者删除!