package org.jenkinsci.plugins.p4.scm; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; import jenkins.scm.api.SCMHead; import jenkins.scm.api.SCMRevision; import jenkins.scm.api.trait.SCMBuilder; import org.jenkinsci.plugins.p4.PerforceScm; import org.jenkinsci.plugins.p4.changes.P4Ref; import org.jenkinsci.plugins.p4.changes.P4RefBuilder; import java.util.logging.Logger; public class P4SCMBuilder extends SCMBuilder<P4SCMBuilder, PerforceScm> { private static Logger logger = Logger.getLogger(P4SCMBuilder.class.getName()); private final AbstractP4SCMSource source; private final P4SCMHead p4head; private final P4Path path; private final P4Ref revision; public P4SCMBuilder(@NonNull AbstractP4SCMSource source, @NonNull SCMHead head, @CheckForNull SCMRevision revision) { super(PerforceScm.class, head, revision); this.source = source; if (head instanceof P4SCMHead) { this.p4head = (P4SCMHead) head; if (p4head.getPath() != null) { this.path = p4head.getPath(); } else { this.path = null; } } else { this.path = null; this.p4head = null; } // TODO: // Not sure about this, Jenkins seems to ignore revision and send a null. // So use P4Path's revision from head... if (path != null && path.getRevision() != null) { String rev = path.getRevision(); this.revision = P4RefBuilder.get(rev); } else { this.revision = null; } logger.info("SCM: P4SCMBuilder: " + head + "(" + revision + ")"); } @NonNull @Override public PerforceScm build() { return p4head.getScm(source, path, revision); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 24670 | Paul Allen |
Swarm review support for MultiBranch scanning. Changed TempClient view map to add Jenkinsfile at the bottom. |
||
#5 | 24662 | Paul Allen |
Undo *SCMSource rename to original *ScmSource. Reslove configuration loading issue due to 1.9.0 bad release. |
||
#4 | 24571 | Paul Allen |
Support for Swarm pre-commit review events. Swarm pre-commit review event creates a new 'Reviews' Tag in the MultiBranch and builds with specified change and shelf. |
||
#3 | 24536 | Paul Allen |
Improved Swarm SCMRevision builder. Started to add Swarm Review Event support and exteded test case. JENKINS-52066 |
||
#2 | 24529 | Paul Allen |
Swarm Commit Event support, refactoring and test. JENKINS-52605 (Fix doc in 'Includes' help bubble for MultiBranch) JENKINS-52066 (Improve Swarm Commit and Branch Event support) |
||
#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'. |
||
//guest/perforce_software/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/scm/P4ScmBuilder.java | |||||
#4 | 24501 | Paul Allen | Refactor to use P4SCMXxx naming convention. | ||
#3 | 24500 | Paul Allen | Tidyup and refactor P4Ref classes. | ||
#2 | 24497 | Paul Allen |
Force use of revision for Head. Update P4Head->P4Path revision with P4Revision to avoid builds on unbounded 'latest'. |
||
#1 | 24492 | Paul Allen |
Initial work for MultiBranch Event trigger. JENKINS-52066 (Triggered Events and not Polling per change) |