本文整理汇总了Java中jenkins.scm.api.SCMSource类的典型用法代码示例。如果您正苦于以下问题:Java SCMSource类的具体用法?Java SCMSource怎么用?Java SCMSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SCMSource类属于jenkins.scm.api包,在下文中一共展示了SCMSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: descriptionFor
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String descriptionFor(SCMSource source) {
GiteaPullRequestEventType action = getPayload().getAction();
if (action != null) {
switch (action) {
case OPENED:
return "Pull request #" + getPayload().getNumber() + " opened";
case REOPENED:
return "Pull request #" + getPayload().getNumber() + " reopened";
case CLOSED:
return "Pull request #" + getPayload().getNumber() + " closed";
}
}
return "Pull request #" + getPayload().getNumber() + " event";
}
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:19,代码来源:GiteaPullSCMEvent.java
示例2: doIndex
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
@SuppressWarnings("unused")
public void doIndex() throws IOException {
HttpServletRequest req = Stapler.getCurrentRequest();
GerritProjectEvent projectEvent = getBody(req);
log.info("GerritWebHook invoked for event " + projectEvent);
List<Item> jenkinsItems = Jenkins.getActiveInstance().getAllItems();
for (Item item : jenkinsItems) {
if (item instanceof SCMSourceOwner) {
SCMSourceOwner scmJob = (SCMSourceOwner) item;
log.info("Found SCM job " + scmJob);
List<SCMSource> scmSources = scmJob.getSCMSources();
for (SCMSource scmSource : scmSources) {
if (scmSource instanceof GerritSCMSource) {
GerritSCMSource gerritSCMSource = (GerritSCMSource) scmSource;
if (projectEvent.matches(gerritSCMSource.getRemote())) {
log.info(
"Triggering SCM event for source " + scmSources.get(0) + " on job " + scmJob);
scmJob.onSCMSourceUpdated(scmSource);
}
}
}
}
}
}
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:27,代码来源:GerritWebHook.java
示例3: doRun
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected Result doRun(BuildListener listener)
throws IOException, InterruptedException {
// Attach an SCMRevisionAction with our revision
{
final SCMHead head = getParent().getBranch().getHead();
final SCMSource source = getParent().getSource();
final SCMRevision revision = source.fetch(head, listener);
TestBuild.this.addAction(new SCMRevisionAction(checkNotNull(revision)));
}
try {
project.innerItem.scheduleBuild2(0,
new Cause.UpstreamCause(TestBuild.this)).get();
} catch (ExecutionException e) {
return Result.FAILURE;
}
return Result.SUCCESS;
}
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:22,代码来源:TestBuild.java
示例4: run
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
public void run() {
for (SCMSource scmSource : ((SCMSourceOwner) project).getSCMSources()) {
if (scmSource instanceof GitSCMSource) {
GitSCMSource gitSCMSource = (GitSCMSource) scmSource;
try {
if (new URIish(gitSCMSource.getRemote()).equals(new URIish(gitSCMSource.getRemote()))) {
if (!gitSCMSource.isIgnoreOnPushNotifications()) {
LOGGER.log(Level.FINE, "Notify scmSourceOwner {0} about changes for {1}",
toArray(project.getName(), gitSCMSource.getRemote()));
((SCMSourceOwner) project).onSCMSourceUpdated(scmSource);
} else {
LOGGER.log(Level.FINE, "Ignore on push notification for scmSourceOwner {0} about changes for {1}",
toArray(project.getName(), gitSCMSource.getRemote()));
}
}
} catch (URISyntaxException e) {
// nothing to do
}
}
}
}
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:22,代码来源:PushBuildAction.java
示例5: testNoMultiStreams
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
@Test
public void testNoMultiStreams() throws Exception {
String credential = auth.getId();
String format = "jenkins-${NODE_NAME}-${JOB_NAME}";
String includes = "//depot/...";
SCMSource source = new StreamsScmSource(credential, includes, null, format);
WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "no-streams");
multi.getSourcesList().add(new BranchSource(source));
multi.scheduleBuild2(0);
jenkins.waitUntilNoActivity();
assertThat("We have no branches", multi.getItems(), containsInAnyOrder());
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:17,代码来源:PerforceScmSourceTest.java
示例6: testSimplePathStreams
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
@Test
public void testSimplePathStreams() throws Exception {
String credential = auth.getId();
String format = "jenkins-${NODE_NAME}-${JOB_NAME}";
String includes = "//stream";
SCMSource source = new StreamsScmSource(credential, includes, null, format);
WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "path-streams");
multi.getSourcesList().add(new BranchSource(source));
multi.scheduleBuild2(0);
jenkins.waitUntilNoActivity();
assertThat("We now have branches", multi.getItems(), not(containsInAnyOrder()));
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:17,代码来源:PerforceScmSourceTest.java
示例7: testSimplePathClassic
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
@Test
public void testSimplePathClassic() throws Exception {
String credential = auth.getId();
String format = "jenkins-${NODE_NAME}-${JOB_NAME}";
String includes = "//stream";
SCMSource source = new BranchesScmSource(credential, includes, null, format);
WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "path-classic");
multi.getSourcesList().add(new BranchSource(source));
multi.scheduleBuild2(0);
jenkins.waitUntilNoActivity();
assertThat("We now have branches", multi.getItems(), not(containsInAnyOrder()));
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:17,代码来源:PerforceScmSourceTest.java
示例8: testStarPathClassic
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
@Test
public void testStarPathClassic() throws Exception {
String credential = auth.getId();
String format = "jenkins-${NODE_NAME}-${JOB_NAME}";
String includes = "//stream/*";
SCMSource source = new BranchesScmSource(credential, includes, null, format);
WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "star-classic");
multi.getSourcesList().add(new BranchSource(source));
multi.scheduleBuild2(0);
jenkins.waitUntilNoActivity();
assertThat("We now have branches", multi.getItems(), not(containsInAnyOrder()));
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:17,代码来源:PerforceScmSourceTest.java
示例9: testRootPathClassic
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
@Test
public void testRootPathClassic() throws Exception {
String credential = auth.getId();
String format = "jenkins-${NODE_NAME}-${JOB_NAME}";
String includes = "//...";
SCMSource source = new BranchesScmSource(credential, includes, null, format);
WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "root-classic");
multi.getSourcesList().add(new BranchSource(source));
multi.scheduleBuild2(0);
jenkins.waitUntilNoActivity();
assertThat("We now have branches", multi.getItems(), not(containsInAnyOrder()));
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:17,代码来源:PerforceScmSourceTest.java
示例10: testRootPathStreams
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
@Test
public void testRootPathStreams() throws Exception {
String credential = auth.getId();
String format = "jenkins-${NODE_NAME}-${JOB_NAME}";
String includes = "//...";
SCMSource source = new StreamsScmSource(credential, includes, null, format);
WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "root-streams");
multi.getSourcesList().add(new BranchSource(source));
multi.scheduleBuild2(0);
jenkins.waitUntilNoActivity();
assertThat("We now have branches", multi.getItems(), not(containsInAnyOrder()));
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:17,代码来源:PerforceScmSourceTest.java
示例11: testMultiBranchClassicWithCredentialsInFolder
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
@Test
public void testMultiBranchClassicWithCredentialsInFolder() throws Exception {
WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "multi-classic-creds-in-folder");
CredentialsStore folderStore = getFolderStore(multi);
P4BaseCredentials inFolderCredentials = new P4PasswordImpl(
CredentialsScope.GLOBAL, "idInFolder", "desc:passwd", p4d.getRshPort(),
null, "jenkins", "0", "0", null, "jenkins");
folderStore.addCredentials(Domain.global(), inFolderCredentials);
String format = "jenkins-${NODE_NAME}-${JOB_NAME}";
String includes = "//stream/...";
SCMSource source = new BranchesScmSource(inFolderCredentials.getId(), includes, null, format);
multi.getSourcesList().add(new BranchSource(source));
multi.scheduleBuild2(0);
jenkins.waitUntilNoActivity();
assertEquals("Branch Indexing succeeded", Result.SUCCESS, multi.getComputation().getResult());
assertThat("We now have branches", multi.getItems(), not(containsInAnyOrder()));
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:22,代码来源:PerforceScmSourceTest.java
示例12: testMultiBranchStreamWithCredentialsInFolder
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
@Test
public void testMultiBranchStreamWithCredentialsInFolder() throws Exception {
WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "multi-streams-creds-in-folder");
CredentialsStore folderStore = getFolderStore(multi);
P4BaseCredentials inFolderCredentials = new P4PasswordImpl(
CredentialsScope.GLOBAL, "idInFolder", "desc:passwd", p4d.getRshPort(),
null, "jenkins", "0", "0", null, "jenkins");
folderStore.addCredentials(Domain.global(), inFolderCredentials);
String format = "jenkins-${NODE_NAME}-${JOB_NAME}";
String includes = "//stream/...";
SCMSource source = new StreamsScmSource(inFolderCredentials.getId(), includes, null, format);
multi.getSourcesList().add(new BranchSource(source));
multi.scheduleBuild2(0);
jenkins.waitUntilNoActivity();
assertEquals("Branch Indexing succeeded", Result.SUCCESS, multi.getComputation().getResult());
assertThat("We now have branches", multi.getItems(), not(containsInAnyOrder()));
}
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:22,代码来源:PerforceScmSourceTest.java
示例13: getGitHubClient
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
public static ExtendedGitHubClient getGitHubClient(@Nonnull final Job<?,?> job) {
SCMSource scmSource = SCMSource.SourceByItem.findSource(job);
if (scmSource instanceof GitHubSCMSource) {
GitHubSCMSource gitHubSource = (GitHubSCMSource) scmSource;
ExtendedGitHubClient client;
if (gitHubSource.getApiUri() == null) {
client = new ExtendedGitHubClient();
} else {
URI uri = URI.create(gitHubSource.getApiUri());
client = new ExtendedGitHubClient(uri.getHost(), uri.getPort(), uri.getScheme());
}
// configure credentials
if (gitHubSource.getCredentialsId() != null) {
StandardCredentials credentials = Connector.lookupScanCredentials(
job, gitHubSource.getApiUri(), gitHubSource.getCredentialsId());
if (credentials instanceof StandardUsernamePasswordCredentials) {
StandardUsernamePasswordCredentials c = (StandardUsernamePasswordCredentials) credentials;
String userName = c.getUsername();
String password = c.getPassword().getPlainText();
client.setCredentials(userName, password);
}
}
return client;
}
throw new IllegalArgumentException("Job's SCM is not GitHub.");
}
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:30,代码来源:GitHubHelper.java
示例14: getRepositoryId
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
public static RepositoryId getRepositoryId(@Nonnull final Job<?,?> job) {
SCMSource src = SCMSource.SourceByItem.findSource(job);
if (src instanceof GitHubSCMSource) {
GitHubSCMSource source = (GitHubSCMSource) src;
if (source.getScanCredentialsId() != null) {
return RepositoryId.create(source.getRepoOwner(), source.getRepository());
}
}
return null;
}
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:11,代码来源:GitHubHelper.java
示例15: getKey
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
private String getKey(final WorkflowJob project) {
GitHubSCMSource scmSource = (GitHubSCMSource) SCMSource.SourceByItem.findSource(project);
PullRequestSCMHead scmHead = (PullRequestSCMHead) SCMHead.HeadByItem.findHead(project);
return String.format("%s/%s/%d",
scmSource.getRepoOwner(),
scmSource.getRepository(),
scmHead.getNumber());
}
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:10,代码来源:IssueCommentTrigger.java
示例16: descriptionFor
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String descriptionFor(SCMSource source) {
switch (getType()) {
case CREATED:
return "Creation of repository";
case REMOVED:
return "Deletion of repository";
default:
return super.descriptionFor(source);
}
}
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:15,代码来源:GiteaRepositorySCMEvent.java
示例17: descriptionFor
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String descriptionFor(SCMSource source) {
String ref = getPayload().getRef();
ref = ref.startsWith(Constants.R_HEADS) ? ref.substring(Constants.R_HEADS.length()) : ref;
return "Push event to branch " + ref;
}
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:10,代码来源:GiteaPushSCMEvent.java
示例18: isMatch
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean isMatch(@NonNull SCMSource source) {
if (!(source instanceof GiteaSCMSource)) {
return false;
}
GiteaSCMSource src = (GiteaSCMSource) source;
return getPayload().getRepository().getOwner().getUsername().equalsIgnoreCase(src.getRepoOwner())
&& getPayload().getRepository().getName().equalsIgnoreCase(src.getRepository());
}
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:13,代码来源:AbstractGiteaSCMSourceEvent.java
示例19: GiteaSCMSourceRequest
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
/**
* Constructor.
*
* @param source the source.
* @param context the context.
* @param listener the listener.
*/
GiteaSCMSourceRequest(SCMSource source, GiteaSCMSourceContext context, TaskListener listener) {
super(source, context, listener);
fetchBranches = context.wantBranches();
fetchTags = context.wantTags();
fetchOriginPRs = context.wantOriginPRs();
fetchForkPRs = context.wantForkPRs();
originPRStrategies = fetchOriginPRs && !context.originPRStrategies().isEmpty()
? Collections.unmodifiableSet(EnumSet.copyOf(context.originPRStrategies()))
: Collections.<ChangeRequestCheckoutStrategy>emptySet();
forkPRStrategies = fetchForkPRs && !context.forkPRStrategies().isEmpty()
? Collections.unmodifiableSet(EnumSet.copyOf(context.forkPRStrategies()))
: Collections.<ChangeRequestCheckoutStrategy>emptySet();
Set<SCMHead> includes = context.observer().getIncludes();
if (includes != null) {
Set<Long> pullRequestNumbers = new HashSet<>(includes.size());
Set<String> branchNames = new HashSet<>(includes.size());
Set<String> tagNames = new HashSet<>(includes.size());
for (SCMHead h : includes) {
if (h instanceof BranchSCMHead) {
branchNames.add(h.getName());
} else if (h instanceof PullRequestSCMHead) {
pullRequestNumbers.add(Long.parseLong(((PullRequestSCMHead) h).getId()));
if (SCMHeadOrigin.DEFAULT.equals(h.getOrigin())) {
branchNames.add(((PullRequestSCMHead) h).getOriginName());
}
} else if (h instanceof TagSCMHead) { // TODO replace with concrete class when tag support added
tagNames.add(h.getName());
}
}
this.requestedPullRequestNumbers = Collections.unmodifiableSet(pullRequestNumbers);
this.requestedOriginBranchNames = Collections.unmodifiableSet(branchNames);
this.requestedTagNames = Collections.unmodifiableSet(tagNames);
} else {
requestedPullRequestNumbers = null;
requestedOriginBranchNames = null;
requestedTagNames = null;
}
}
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:46,代码来源:GiteaSCMSourceRequest.java
示例20: descriptionFor
import jenkins.scm.api.SCMSource; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String descriptionFor(SCMSource source) {
String ref = getPayload().getRef();
ref = ref.startsWith(Constants.R_HEADS) ? ref.substring(Constants.R_HEADS.length()) : ref;
return "Create event for branch " + ref;
}
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:10,代码来源:GiteaCreateSCMEvent.java
注:本文中的jenkins.scm.api.SCMSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论