package org.jenkinsci.plugins.p4.workspace; import hudson.Extension; import hudson.model.AutoCompletionCandidates; import hudson.util.FormValidation; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import org.jenkinsci.plugins.p4.client.ConnectionFactory; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import com.perforce.p4java.client.IClient; import com.perforce.p4java.core.IStream; import com.perforce.p4java.core.IStreamSummary; import com.perforce.p4java.impl.mapbased.client.Client; import com.perforce.p4java.option.server.GetStreamsOptions; import com.perforce.p4java.server.IOptionsServer; public class StreamWorkspaceImpl extends Workspace { private final String streamName; private final String format; private static Logger logger = Logger.getLogger(StreamWorkspaceImpl.class .getName()); public String getStreamName() { return streamName; } public String getFormat() { return format; } @Override public String getName() { return format; } @Override public WorkspaceType getType() { return WorkspaceType.STREAM; } @DataBoundConstructor public StreamWorkspaceImpl(String charset, boolean pinHost, String streamName, String format) { super(charset, pinHost); this.streamName = streamName; this.format = format; } @Override public IClient setClient(IOptionsServer connection, String user) throws Exception { // expands Workspace name if formatters are used. String clientName = getFullName(); IClient iclient = connection.getClient(clientName); if (iclient == null) { logger.info("P4: Creating stream client: " + clientName); Client implClient = new Client(connection); implClient.setName(clientName); connection.createClient(implClient); iclient = connection.getClient(clientName); } // Set owner (not set during create) iclient.setOwnerName(user); // Expand Stream name String streamFullName = expand(getStreamName(), false); iclient.setStream(streamFullName); return iclient; } @Extension public static final class DescriptorImpl extends WorkspaceDescriptor { public static final String defaultFormat = "jenkins-${NODE_NAME}-${JOB_NAME}"; @Override public String getDisplayName() { return "Streams (view generated by Perforce for each node)"; } /** * Provides auto-completion for workspace names. Stapler finds this * method via the naming convention. * * @param value * The text that the user entered. */ public AutoCompletionCandidates doAutoCompleteStreamName( @QueryParameter String value) { AutoCompletionCandidates c = new AutoCompletionCandidates(); try { IOptionsServer iserver = ConnectionFactory.getConnection(); if (iserver != null && value.length() > 1) { List<String> streamPaths = new ArrayList<String>(); streamPaths.add(value + "..."); GetStreamsOptions opts = new GetStreamsOptions(); opts.setMaxResults(10); List<IStreamSummary> list = iserver.getStreams(streamPaths, opts); for (IStreamSummary l : list) { c.add(l.getStream()); } } } catch (Exception e) { } return c; } public FormValidation doCheckStreamName(@QueryParameter String value) { try { IOptionsServer p4 = ConnectionFactory.getConnection(); IStream stream = p4.getStream(value); if (stream != null) { return FormValidation.ok(); } return FormValidation.warning("Unknown Stream: " + value); } catch (Exception e) { return FormValidation.error(e.getMessage()); } } public FormValidation doCheckFormat(@QueryParameter final String value) { if (value == null || value.isEmpty()) return FormValidation .error("Workspace Name format is mandatory."); if (value.contains("${") && value.contains("}")) { return FormValidation.ok(); } return FormValidation.error("Workspace Name format error."); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#19 | 29868 | Sandeep Kumar |
Merge pull request #196 from jenkinsci/StreamAtChange Add stream at change in StreamWorkspace and P4Sync |
||
#18 | 27675 | Paul Allen |
Substitute missing Axes for Key Name. Added useKey option to substitute empty keys in client views, depot paths and stream paths. JENKINS-55985 |
||
#17 | 24777 | Paul Allen |
Global Library to use UUID for client name and delete after use. Add a new 'Delete the Perforce Client after checkout' option (for Manual clients) which normaly is false, but set to true for Global Library checkouts. JENKINS-50975 |
||
#16 | 23589 | Paul Allen |
Remove forced clobber and set default clobber option to true. JENKINS-49041 |
||
#15 | 23372 | Paul Allen | Add setter to modify workspace name and spec. | ||
#14 | 22684 | Paul Allen | Added @Symbol to Extension classes for Pipeline Syntax. | ||
#13 | 22043 | Paul Allen |
Access remote Channel to find NODE_NAME If NODE_NAME is not set in the environment, look at the remote channel, then default to 'master'. JENKINS-34128 JENKINS-43551 |
||
#12 | 20308 | Paul Allen |
P4Groovy (experimental) Get a P4 object in groovy. Supporting basic functions: ’run’ (to run perforce commands), ‘fetch’ and ‘save’ (to access Perforce specs). |
||
#11 | 16628 | Paul Allen |
Set the Client Owner field on update as well as creation. (support for p4maven) |
||
#10 | 16625 | Paul Allen | Set the Workspace Owner at creation (not on update). | ||
#9 | 15394 | Paul Allen |
Workflow-DSL functionality. Tested workflow DSL against 1.596.1 older functionality tested against 1.580.1 @sven_erik_knop |
||
#8 | 15379 | Paul Allen |
Ground-work for Workflow-DSL (Split out Sven’s DSL changes to the core) @sven_erik_knop |
||
#7 | 13681 | Paul Allen |
Abstracted Expand class from Workspace. Added support for Label variable expansion in the name and description. |
||
#6 | 11472 | Paul Allen |
Pin the Workspace to the build host. Added a check box under the Workspace configuration to allow Jenkins to Pin the workspace, by setting the Host field. The hostname is resolved from the Computer object or InetAddress. |
||
#5 | 11461 | Paul Allen | Expand Jenkins variables for Streams paths. | ||
#4 | 10854 | Paul Allen |
Clone Workspace Object Seems Jenkins makes re-entrant calls to the PerforceScm Object and caused the Workspace Object to get trampled. JENKINS-25547 |
||
#3 | 9769 | Paul Allen | Copying using p4-jenkins | ||
#2 | 9738 | Paul Allen | Merging using p4-jenkins | ||
#1 | 9690 | Paul Allen |
[Branching using p4-jenkins] Release 1.0.1 |
||
//guest/paul_allen/dev/p4-jenkins/p4-client/src/main/java/org/jenkinsci/plugins/p4/workspace/StreamWorkspaceImpl.java | |||||
#1 | 9672 | Paul Allen | Refactor name from 'p4_client' to 'p4'. | ||
//guest/paul_allen/dev/p4-jenkins/p4-client/src/main/java/org/jenkinsci/plugins/p4_client/workspace/StreamWorkspaceImpl.java | |||||
#13 | 9495 | Paul Allen |
Fix Polling issue; using the wrong client. Removed static classes and internal referenced to PerforceScm attributes, to avoid threading issues. |
||
#12 | 9040 | Paul Allen | Sets the workspace 'Owner' field when generating a workspace for Template/Stream modes. | ||
#11 | 9038 | Paul Allen |
Improved error messages for Form Validate field checks. Uses Perforce Server messages (TPI-80) |
||
#10 | 8929 | Paul Allen |
Clean up doCheck Warnings on configuration page (TPI-80). - Added check exceptions to log as warnings. |
||
#9 | 8902 | Paul Allen |
Updated test cases: Pushed Workspace 'charset' to abstract Workspace class. Minor bugfixes in Workspace AutoCompletionCandidates method. |
||
#8 | 8899 | Paul Allen | Move Workspace setup/creation code to Implementation class. | ||
#7 | 8896 | Paul Allen | Moved common method 'doFillCharsetItems' into abstract class 'WorkspaceDescriptor'. | ||
#6 | 8771 | Paul Allen |
Perforce Server 12.1 min check for: Build configuration and password/ticket credentials. Includes: - Added logging for Perforce connections (fine) and set connection pool to 2. - Add 'none' to empty charset list (connection bug?) - Supress P4Java errors for syncing ubinary, xtext, unicode |
||
#5 | 8769 | Paul Allen | Update to charset option for workspaces to use a drop-down select with a default of 'none'. | ||
#4 | 8738 | Paul Allen |
Workspace Name Formatter. For Template and Stream workspaces it allows the substitution of the following tags: ${node} The name given to the slave Jenkins node. ${hostname} The hostname for the slave Jenkins node. ${project} The name of the Jenkins build Job. ${hash} Unique hash code of the Jenkins node. |
||
#3 | 8663 | Paul Allen | Rollout of charset for all Workspace modes. | ||
#2 | 8662 | Paul Allen | Added auto fill and checks for streams and templates. | ||
#1 | 8641 | Paul Allen | Added workspace helper (setClient) and template/stream types. |