• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SCMTriggerItem类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中jenkins.triggers.SCMTriggerItem的典型用法代码示例。如果您正苦于以下问题:Java SCMTriggerItem类的具体用法?Java SCMTriggerItem怎么用?Java SCMTriggerItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SCMTriggerItem类属于jenkins.triggers包,在下文中一共展示了SCMTriggerItem类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onChange

点赞 3

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onChange(Saveable o, XmlFile file) {
    if (!(o instanceof Item)) {
        // must be an Item
        return;
    }
    SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem((Item) o);
    if (item == null) {
        // more specifically must be an SCMTriggerItem
        return;
    }
    SCMTrigger trigger = item.getSCMTrigger();
    if (trigger == null || trigger.isIgnorePostCommitHooks()) {
        // must have the trigger enabled and not opted out of post commit hooks
        return;
    }
    for (SCM scm : item.getSCMs()) {
        if (scm instanceof GitSCM) {
            // we have a winner
            GiteaWebhookListener.register(item, (GitSCM) scm);
        }
    }
}
 

开发者ID:jenkinsci,
项目名称:gitea-plugin,
代码行数:27,
代码来源:GiteaWebhookListener.java

示例2: matchServer

点赞 3

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
private boolean matchServer(Job<?, ?> job, String port) {
	//Get all the trigger for this Job
	SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job);

	if (item != null) {
		//As soon as we find a match, return
		for (SCM scmTrigger : item.getSCMs()) {
			PerforceScm p4scm = PerforceScm.convertToPerforceScm(scmTrigger);
			if (p4scm != null) {
				String id = p4scm.getCredential();
				P4BaseCredentials credential = ConnectionHelper.findCredential(id);
				if (credential != null
						&& credential.getP4port() != null
						&& port.equals(credential.getP4port())) {
					return true;
				}
			}
		}
	}
	return false;
}
 

开发者ID:p4paul,
项目名称:p4-jenkins,
代码行数:22,
代码来源:P4Trigger.java

示例3: execute

点赞 2

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
public void execute(StaplerResponse response) {
    SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(project);
    if (!hasGitSCM(item)) {
        throw HttpResponses.error(409, "The project has no GitSCM configured");
    }
    writeStatusBody(response, build, getStatus(build));
}
 

开发者ID:jenkinsci,
项目名称:gitlab-plugin,
代码行数:8,
代码来源:BuildStatusAction.java

示例4: hasGitSCM

点赞 2

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
private boolean hasGitSCM(SCMTriggerItem item) {
    if (item != null) {
        for (SCM scm : item.getSCMs()) {
            if (scm instanceof GitSCM) {
                return true;
            }
        }
    }
    return false;
}
 

开发者ID:jenkinsci,
项目名称:gitlab-plugin,
代码行数:11,
代码来源:BuildStatusAction.java

示例5: createActions

点赞 2

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
protected Action[] createActions(Job<?, ?> job, H hook) {
    ArrayList<Action> actions = new ArrayList<>();
    actions.add(new CauseAction(new GitLabWebHookCause(retrieveCauseData(hook))));
    try {
        SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job);
        GitSCM gitSCM = getGitSCM(item);
        actions.add(createRevisionParameter(hook, gitSCM));
    } catch (NoRevisionToBuildException e) {
        LOGGER.log(Level.WARNING, "unknown handled situation, dont know what revision to build for req {0} for job {1}",
                new Object[]{hook, (job != null ? job.getFullName() : null)});
    }
    return actions.toArray(new Action[actions.size()]);
}
 

开发者ID:jenkinsci,
项目名称:gitlab-plugin,
代码行数:14,
代码来源:AbstractWebHookTriggerHandler.java

示例6: getGitSCM

点赞 2

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
private GitSCM getGitSCM(SCMTriggerItem item) {
    if (item != null) {
        for (SCM scm : item.getSCMs()) {
            if (scm instanceof GitSCM) {
                return (GitSCM) scm;
            }
        }
    }
    return null;
}
 

开发者ID:jenkinsci,
项目名称:gitlab-plugin,
代码行数:11,
代码来源:AbstractWebHookTriggerHandler.java

示例7: getSourceRepoURLDefault

点赞 2

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
/**
 * Get the URL of the first declared repository in the project configuration.
 * Use this as default source repository url.
 *
 * @return URIish the default value of the source repository url
 * @throws IllegalStateException Project does not use git scm.
 */
private URIish getSourceRepoURLDefault(Job<?, ?> job) {
    SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job);
    GitSCM gitSCM = getGitSCM(item);
    if (gitSCM == null) {
        LOGGER.log(Level.WARNING, "Could not find GitSCM for project. Project = {1}, next build = {2}",
                array(job.getName(), String.valueOf(job.getNextBuildNumber())));
        throw new IllegalStateException("This project does not use git:" + job.getName());
    }
    return getFirstRepoURL(gitSCM.getRepositories());
}
 

开发者ID:jenkinsci,
项目名称:gitlab-plugin,
代码行数:18,
代码来源:ProjectLabelsProvider.java

示例8: poke

点赞 2

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
public void poke(Job<?, ?> job, String port) throws IOException {
	// exit early if job does not match trigger
	if (!matchServer(job, port)) {
		return;
	}

	LOGGER.info("P4: poking: " + job.getName());

	StreamTaskListener listener = new StreamTaskListener(getLogFile(job));
	try {
		PrintStream log = listener.getLogger();

		SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job);
		if (item == null) {
			LOGGER.severe("Trigger item not found.");
			return;
		}

		PollingResult pollResult = item.poll(listener);
		if (pollResult != null && pollResult.hasChanges()) {
			log.println("Changes found");
			build(job);
		} else {
			log.println("No changes");
		}
	} catch (Exception e) {
		String msg = "P4: Failed to record P4 trigger: ";
		e.printStackTrace(listener.error(msg));
		LOGGER.severe(msg + e);
	} finally {
		listener.close();
	}
}
 

开发者ID:p4paul,
项目名称:p4-jenkins,
代码行数:34,
代码来源:P4Trigger.java

示例9: isApplicable

点赞 2

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
@Override
public boolean isApplicable(Item item) {
    return item instanceof Job &&
            SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(item) != null &&
            item instanceof ParameterizedJobMixIn.ParameterizedJob;
}
 

开发者ID:Affirm,
项目名称:jenkins-plugins,
代码行数:7,
代码来源:TagTrigger.java

示例10: isApplicable

点赞 2

import jenkins.triggers.SCMTriggerItem; //导入依赖的package包/类
@Override
public boolean isApplicable(Item item) {
    return item instanceof Job && nonNull(SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(item))
            && item instanceof ParameterizedJobMixIn.ParameterizedJob;
}
 

开发者ID:KostyaSha,
项目名称:github-integration-plugin,
代码行数:6,
代码来源:GitHubTriggerDescriptor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)