本文整理汇总了Java中jenkins.model.ParameterizedJobMixIn类的典型用法代码示例。如果您正苦于以下问题:Java ParameterizedJobMixIn类的具体用法?Java ParameterizedJobMixIn怎么用?Java ParameterizedJobMixIn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterizedJobMixIn类属于jenkins.model包,在下文中一共展示了ParameterizedJobMixIn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filter
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
@Override
public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) {
List<Pattern> patterns = getCompiled();
List<TopLevelItem> workList = added.isEmpty() ? all : added;
List<TopLevelItem> filtered = new LinkedList<TopLevelItem>();
for (TopLevelItem item : workList) {
if (item instanceof ParameterizedJobMixIn.ParameterizedJob) {
DockerHubTrigger trigger = DockerHubTrigger.getTrigger((ParameterizedJobMixIn.ParameterizedJob)item);
if (trigger != null) {
if (patterns.isEmpty()) {
filtered.add(item);
} else {
for (String name : trigger.getAllRepoNames()) {
if(matches(name)) {
filtered.add(item);
}
}
}
}
}
}
return filtered;
}
示例2: triggerFrom
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
/**
* support matrix plugin.
*
* @see JobInfoHelpers#triggerFrom(hudson.model.Job, java.lang.Class)
*/
@CheckForNull
public static <T extends Trigger> T triggerFrom(final Job<?, ?> job, Class<T> tClass) {
Job<?, ?> guessJob;
if (job instanceof MatrixConfiguration) {
guessJob = ((MatrixConfiguration) job).getParent();
} else {
guessJob = job;
}
if (guessJob instanceof AbstractProject<?, ?>) {
final AbstractProject<?, ?> abstractProject = (AbstractProject<?, ?>) guessJob;
return abstractProject.getTrigger(tClass);
} else if (guessJob instanceof ParameterizedJobMixIn.ParameterizedJob) {
ParameterizedJobMixIn.ParameterizedJob pJob = (ParameterizedJobMixIn.ParameterizedJob) guessJob;
for (Trigger candidate : pJob.getTriggers().values()) {
if (tClass.isInstance(candidate)) {
return tClass.cast(candidate);
}
}
}
return null;
}
示例3: builds
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
private BitbucketBuilds builds(Run<?, ?> r) {
BitbucketBuildTrigger trigger = null;
if (r instanceof AbstractBuild) {
trigger = BitbucketBuildTrigger.getTrigger(((AbstractBuild) r).getProject());
} else {
Job job = r.getParent();
if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {
for (Trigger<?> t : ((ParameterizedJobMixIn.ParameterizedJob) job).getTriggers().values()) {
if (t instanceof BitbucketBuildTrigger) {
trigger = (BitbucketBuildTrigger) t;
}
}
}
}
return trigger == null ? null : trigger.getBuilder().getBuilds();
}
开发者ID:nishio-dens,项目名称:bitbucket-pullrequest-builder-plugin,代码行数:18,代码来源:BitbucketBuildListener.java
示例4: probeJobs
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
private void probeJobs(@CheckForNull String port, List<Job> jobs) throws IOException {
for (Job<?, ?> job : jobs) {
P4Trigger trigger = null;
LOGGER.fine("P4: trying: " + job.getName());
if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {
ParameterizedJobMixIn.ParameterizedJob pJob = (ParameterizedJobMixIn.ParameterizedJob) job;
for (Trigger<?> t : pJob.getTriggers().values()) {
if (t instanceof P4Trigger) {
trigger = (P4Trigger) t;
break;
}
}
}
if (trigger != null) {
LOGGER.info("P4: probing: " + job.getName());
trigger.poke(job, port);
} else {
LOGGER.fine("P4: trigger not set: " + job.getName());
}
}
}
示例5: startJob
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
/**
* Invoked when a tag-related event is received.
*
* @param cause build cause
* @return task future, or {@code null} if it could not be scheduled.
*/
public QueueTaskFuture startJob(@Nonnull TagCause cause) {
LOGGER.info(cause.getShortDescription());
ArrayList<ParameterValue> values = getDefaultParameters();
values.add(new StringParameterValue("GH_PUSHER", cause.getPusher()));
values.add(new StringParameterValue("GIT_TAG", cause.getTag()));
values.add(new StringParameterValue("GIT_REF", cause.getRef()));
ParameterizedJobMixIn pjob = asParameterizedJobMixIn(job);
return pjob.scheduleBuild2(3, new CauseAction(cause), new ParametersAction(values));
}
示例6: getImageNames
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
public Collection<String> getImageNames(TopLevelItem item) {
if (item instanceof ParameterizedJobMixIn.ParameterizedJob) {
DockerHubTrigger trigger = DockerHubTrigger.getTrigger((ParameterizedJobMixIn.ParameterizedJob)item);
if (trigger != null) {
Set<String> names = trigger.getAllRepoNames();
if (showMax <= 0 || names.size() <= showMax) {
return names;
} else {
String[] array = names.toArray(new String[names.size()]);
return Arrays.asList(Arrays.copyOf(array, showMax));
}
}
}
return Collections.emptySet();
}
示例7: getTrigger
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
@CheckForNull
public static DockerHubTrigger getTrigger(ParameterizedJobMixIn.ParameterizedJob job) {
Jenkins jenkins = Jenkins.getInstance();
if (jenkins != null) {
DockerHubTrigger.DescriptorImpl descriptor = jenkins.getDescriptorByType(DockerHubTrigger.DescriptorImpl.class);
if (descriptor != null) {
Map<TriggerDescriptor, Trigger<?>> triggers = job.getTriggers();
return (DockerHubTrigger)triggers.get(descriptor);
}
}
return null;
}
示例8: getDockerImagesUsedByJob
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
@Nonnull
@Override
public Collection<String> getDockerImagesUsedByJob(@Nonnull Job<?,?> job) {
if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {
DockerHubTrigger trigger = DockerHubTrigger.getTrigger((ParameterizedJobMixIn.ParameterizedJob)job);
if (trigger != null) {
for (TriggerOption option : trigger.getOptions()) {
if (option instanceof TriggerOnSpecifiedImageNames) {
return ((TriggerOnSpecifiedImageNames)option).getRepoNames();
}
}
}
}
return Collections.emptySet();
}
示例9: schedule
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
public static QueueTaskFuture schedule(Job<?, ?> job, int number, String param, int queuetPeriod) {
ParameterizedJobMixIn jobMixIn = JobInfoHelpers.asParameterizedJobMixIn(job);
GitHubPRCause cause = newGitHubPRCause().withNumber(number);
ParametersAction parametersAction = new ParametersAction(
Collections.<ParameterValue>singletonList(new StringParameterValue("value", param))
);
return jobMixIn.scheduleBuild2(queuetPeriod, new CauseAction(cause), parametersAction);
}
示例10: retrieveScheduleJob
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
private ParameterizedJobMixIn retrieveScheduleJob(final Job<?, ?> job) {
// TODO 1.621+ use standard method
return new ParameterizedJobMixIn() {
@Override
protected Job asJob() {
return job;
}
};
}
示例11: getFromJob
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
public static GitLabPushTrigger getFromJob(Job<?, ?> job) {
GitLabPushTrigger trigger = null;
if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {
ParameterizedJobMixIn.ParameterizedJob p = (ParameterizedJobMixIn.ParameterizedJob) job;
for (Trigger t : p.getTriggers().values()) {
if (t instanceof GitLabPushTrigger) {
trigger = (GitLabPushTrigger) t;
}
}
}
return trigger;
}
示例12: handle
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
@Override
public void handle(Job<?, ?> job, PushHook hook, boolean ciSkip, BranchFilter branchFilter, MergeRequestLabelFilter mergeRequestLabelFilter) {
try {
if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {
ParameterizedJob project = (ParameterizedJobMixIn.ParameterizedJob) job;
GitLabConnectionProperty property = job.getProperty(GitLabConnectionProperty.class);
for (Trigger t : project.getTriggers().values()) {
if (t instanceof GitLabPushTrigger) {
final GitLabPushTrigger trigger = (GitLabPushTrigger) t;
Integer projectId = hook.getProjectId();
if (property != null && property.getClient() != null && projectId != null && trigger != null) {
GitLabClient client = property.getClient();
for (MergeRequest mergeRequest : getOpenMergeRequests(client, projectId.toString())) {
if (mergeRequestLabelFilter.isMergeRequestAllowed(mergeRequest.getLabels())) {
handleMergeRequest(job, hook, ciSkip, branchFilter, client, mergeRequest);
}
}
}
}
}
} else {
LOGGER.log(Level.FINE, "Not a ParameterizedJob: {0}",LoggerUtil.toArray(job.getClass().getName()));
}
} catch (WebApplicationException | ProcessingException e) {
LOGGER.log(Level.WARNING, "Failed to communicate with gitlab server to determine if this is an update for a merge request: " + e.getMessage(), e);
}
}
示例13: scheduleBuild
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
private void scheduleBuild(Job<?, ?> job, Action[] actions) {
int projectBuildDelay = 0;
if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {
ParameterizedJobMixIn.ParameterizedJob abstractProject = (ParameterizedJobMixIn.ParameterizedJob) job;
if (abstractProject.getQuietPeriod() > projectBuildDelay) {
projectBuildDelay = abstractProject.getQuietPeriod();
}
}
retrieveScheduleJob(job).scheduleBuild2(projectBuildDelay, actions);
}
示例14: scheduleBuild
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
protected void scheduleBuild(Job<?, ?> job, Action[] actions) {
int projectBuildDelay = 0;
if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {
ParameterizedJobMixIn.ParameterizedJob abstractProject = (ParameterizedJobMixIn.ParameterizedJob) job;
if (abstractProject.getQuietPeriod() > projectBuildDelay) {
projectBuildDelay = abstractProject.getQuietPeriod();
}
}
retrieveScheduleJob(job).scheduleBuild2(projectBuildDelay, actions);
}
示例15: build
import jenkins.model.ParameterizedJobMixIn; //导入依赖的package包/类
/**
* Schedule build
*
* @param job Jenkins Job
* @throws IOException push up stack
*/
private void build(final Job<?, ?> job) throws IOException {
SCMTriggerCause cause = new SCMTriggerCause(getLogFile(job));
@SuppressWarnings("rawtypes")
ParameterizedJobMixIn pJob = new ParameterizedJobMixIn() {
@Override
protected Job asJob() {
return job;
}
};
pJob.scheduleBuild(cause);
}