package org.jenkinsci.plugins.p4.scm; import com.perforce.p4java.core.IRepo; import edu.umd.cs.findbugs.annotations.NonNull; import hudson.Extension; import hudson.model.TaskListener; import org.jenkinsci.plugins.p4.browsers.P4Browser; import org.jenkinsci.plugins.p4.changes.P4GraphRef; import org.jenkinsci.plugins.p4.changes.P4Ref; import org.jenkinsci.plugins.p4.client.ClientHelper; import org.jenkinsci.plugins.p4.client.ConnectionHelper; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; public class GraphScmSource extends AbstractP4ScmSource { private P4Browser browser; @DataBoundConstructor public GraphScmSource(String id, String credential, String includes, String charset, String format) { super(id, credential, charset, format); setIncludes(includes); } @DataBoundSetter public void setBrowser(P4Browser browser) { this.browser = browser; } @Override public P4Browser getBrowser() { return browser; } @Override public List<P4ChangeRequestSCMHead> getTags(@NonNull TaskListener listener) throws Exception { return new ArrayList<>(); } @Override public List<P4Head> getHeads(@NonNull TaskListener listener) throws Exception { List<String> includes = getIncludePaths(); HashSet<P4Head> list = new HashSet<P4Head>(); ConnectionHelper p4 = new ConnectionHelper(getOwner(), credential, listener); try { for (String inc : includes) { List<IRepo> repos = p4.listRepos(inc); for (IRepo r : repos) { String path = r.getName(); if (path.endsWith(".git")) { path = path.substring(0, path.lastIndexOf(".git")); } String name = path.substring(path.lastIndexOf("/") + 1); P4Head head = new P4Head(name, Arrays.asList(path), false); list.add(head); } } } finally { p4.disconnect(); } return new ArrayList<>(list); } @Override public P4Revision getRevision(P4Head head, TaskListener listener) throws Exception { try (ClientHelper p4 = new ClientHelper(getOwner(), credential, listener, scmSourceClient, getCharset())) { long change = -1; P4Ref ref = p4.getGraphHead(head.getPaths().get(0)); if (ref instanceof P4GraphRef) { P4GraphRef graphHead = (P4GraphRef) ref; change = graphHead.getDate(); } P4Revision revision = new P4Revision(head, change); return revision; } } @Extension public static final class DescriptorImpl extends P4ScmSourceDescriptor { @Override public String getDisplayName() { return "Perforce Graph"; } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#21 | 26673 | Paul Allen |
Code cleanup - remove calls to Deprecated methods - Deprecated classes like AbstractStepImpl, AbstractStepDescriptorImpl and AbstractSynchronousStepExecution for P4TaggingStep |
||
#20 | 26602 | Paul Allen |
Reuse temp client connections for the multi-branch scan. TempClientHelper is set in retrieve and updated for different heads. |
||
#19 | 25564 | Paul Allen |
Merge branch 'local_map' MultiBranch support for 'HelixBranches' local and remote Mappings. Allows MultiBranches to map Depot paths external to the MultiBranch projects root. For example, a MultiBranch project with the following Jenkinsfiles: ProjA >> main //depot/projA/main/Jenkinsfile //depot/projA/main/src/... ProjA>> dev //depot/projA/dev/Jenkinsfile //depot/projA/dev/src/... An 'Includes' path for Branch Sources set to: //depot/projA/... Jenkins will now create two branches 'main' and 'dev'. The default Mapping is '...' so the 'src/...' and any other files under the branch root will appear in the project's workspace. To import an extenal location we can add another line to the mapping: ... //depot/external/stuff/... Now both branches 'main' and 'dev' will have a folder 'depot/external/stuff' with the mapped files. We can also use the `BRANCH_NAME` environment variable in the remote path uses the branch name. ... //depot/external/${BRANCH_NAME}/... and in 'main' you will now see the remote files in ' depot/external/main' along with the local project files mapped with '...' |
||
#18 | 25006 | Paul Allen |
Support for remote Jenkinsfiles in a MultiBranch project. Jenkinsfile are idenitified by the Include branches path (e.g. //depot/Remote/...), but you must add a Mapping in the BranchSource->Advanced->View Mappings to locate the projects source and use a special ${BRANCH_NAME} in the path. e.g. //depot/ProjectA/${BRANCH_NAME}/... JENKINS-53936 |
||
#17 | 24767 | Paul Allen |
Global Library support for multiple instances. Enforce a depot syntax path ending of "/..." Remove 'beta' from Global Library configuration. Generate a unique workspace to sync multiple Libraries. JENKINS-53922 |
||
#16 | 24662 | Paul Allen |
Undo *SCMSource rename to original *ScmSource. Reslove configuration loading issue due to 1.9.0 bad release. |
||
#15 | 24504 | Paul Allen |
Tree walter for BranchSCMSource Events. On a change-submit event use the change number and grab a submitted file. Walk up the path looking for a Jenkinsfile, then derive 'Project' path, 'Branch' name and 'Path' for the SCMHead/Revision. This assumes that the Jenkinsfile is in the route of your projects. Alternatively use the Swarm Event and pass your own 'Project', 'Branch' and 'Path'. |
||
#14 | 24501 | Paul Allen | Refactor to use P4SCMXxx naming convention. | ||
#13 | 24488 | Paul Allen |
Min version Jenkins 2.60.3 Upgrade dependencies and move to Java 8. |
||
#12 | 24454 | Paul Allen |
Exclude and Include mapping support. Refactored P4Path usage and added P4SwarmPath. JENKINS-49804 |
||
#11 | 23328 | Paul Allen | Use client less connection for MultiBranch Graph. | ||
#10 | 23324 | Paul Allen | Use short lived temporary client when scanning MultiBranch. | ||
#9 | 23320 | Paul Allen | Remove deprecated ID for SCMSource constructor. | ||
#8 | 23017 | Paul Allen |
MultiBranch configuration cleanup. Remove BETA, hide standard options in Advanced group and added isGraphCompatible check in Populate Descriptor. |
||
#7 | 22875 | Paul Allen | Refactor P4Path and Swarm API | ||
#6 | 22866 | Paul Allen |
Merge pull request #55 from jenkinsci/hth Global Pipeline Library support. JENKINS-46121 JENKINS-46550 |
||
#5 | 22863 | Paul Allen | Store change in P4Revision as P4Ref. | ||
#4 | 22684 | Paul Allen | Added @Symbol to Extension classes for Pipeline Syntax. | ||
#3 | 22678 | Paul Allen |
MultiBranch support for Helix4Git (GitHub PR model). Update MultiBranch product names to Helix. |
||
#2 | 22396 | Paul Allen |
MultiBranch support for Perforce Swarm Reviews. A work in progress - adds Swarm API support to find branches and reviews from a Swarm project. #review-22354 |
||
#1 | 22128 | Paul Allen |
Helix Graph support for Jenkins. JENKINS-40354 |
||
//guest/perforce_software/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/scm/GraphSCMSource.java | |||||
#1 | 24504 | Paul Allen |
Tree walter for BranchSCMSource Events. On a change-submit event use the change number and grab a submitted file. Walk up the path looking for a Jenkinsfile, then derive 'Project' path, 'Branch' name and 'Path' for the SCMHead/Revision. This assumes that the Jenkinsfile is in the route of your projects. Alternatively use the Swarm Event and pass your own 'Project', 'Branch' and 'Path'. |
||
# | Change | User | Description | Committed | |
#14 | 24501 | Paul Allen | Refactor to use P4SCMXxx naming convention. | ||
#13 | 24488 | Paul Allen |
Min version Jenkins 2.60.3 Upgrade dependencies and move to Java 8. |
||
#12 | 24454 | Paul Allen |
Exclude and Include mapping support. Refactored P4Path usage and added P4SwarmPath. JENKINS-49804 |
||
#11 | 23328 | Paul Allen | Use client less connection for MultiBranch Graph. | ||
#10 | 23324 | Paul Allen | Use short lived temporary client when scanning MultiBranch. | ||
#9 | 23320 | Paul Allen | Remove deprecated ID for SCMSource constructor. | ||
#8 | 23017 | Paul Allen |
MultiBranch configuration cleanup. Remove BETA, hide standard options in Advanced group and added isGraphCompatible check in Populate Descriptor. |
||
#7 | 22875 | Paul Allen | Refactor P4Path and Swarm API | ||
#6 | 22866 | Paul Allen |
Merge pull request #55 from jenkinsci/hth Global Pipeline Library support. JENKINS-46121 JENKINS-46550 |
||
#5 | 22863 | Paul Allen | Store change in P4Revision as P4Ref. | ||
#4 | 22684 | Paul Allen | Added @Symbol to Extension classes for Pipeline Syntax. | ||
#3 | 22678 | Paul Allen |
MultiBranch support for Helix4Git (GitHub PR model). Update MultiBranch product names to Helix. |
||
#2 | 22396 | Paul Allen |
MultiBranch support for Perforce Swarm Reviews. A work in progress - adds Swarm API support to find branches and reviews from a Swarm project. #review-22354 |
||
#1 | 22128 | Paul Allen |
Helix Graph support for Jenkins. JENKINS-40354 |
||
//guest/paul_allen/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/scm/GraphScmSource.java | |||||
#1 | 22049 | Paul Allen | Basic MultiBranch support for Graph. |