package org.jenkinsci.plugins.p4.client; import hudson.AbortException; import hudson.model.Item; import hudson.model.TaskListener; import org.jenkinsci.plugins.p4.workspace.ManualWorkspaceImpl; import org.jenkinsci.plugins.p4.workspace.Workspace; import org.jenkinsci.plugins.p4.workspace.WorkspaceSpec; import java.io.Closeable; import java.io.IOException; import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; public class TempClientHelper extends ClientHelper implements Closeable { private static final Logger LOGGER = Logger.getLogger(TempClientHelper.class.getName()); private final String clientUUID; public TempClientHelper(Item context, String credential, TaskListener listener, Workspace workspace) throws Exception { super(context, credential, listener); this.clientUUID = "jenkinsTemp-" + UUID.randomUUID().toString(); if (workspace != null) { update(workspace); } } @Override public void close() throws IOException { try { deleteClient(clientUUID); } catch (Exception e) { LOGGER.log(Level.INFO, "Unable to remove temporary client: " + clientUUID); } disconnect(); } public String getClientUUID() { return clientUUID; } public void update(Workspace workspace) throws AbortException { String oldName = workspace.getName(); workspace.setName(clientUUID); // Update view with new name if (workspace instanceof ManualWorkspaceImpl) { ManualWorkspaceImpl manual = (ManualWorkspaceImpl) workspace; WorkspaceSpec spec = manual.getSpec(); String view = spec.getView(); view = view.replace(oldName, clientUUID); spec.setView(view); manual.setSpec(spec); } clientLogin(workspace); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 26602 | Paul Allen |
Reuse temp client connections for the multi-branch scan. TempClientHelper is set in retrieve and updated for different heads. |
||
#4 | 25655 | Paul Allen |
Extract the Job Environment when fetching the Jenkinsfile. Allow Parameterized builds for the Stream field when using 'Pipline Script from SCM'. JENKINS-56775 |
||
#3 | 24487 | Paul Allen | Perforce Connection Refactor. | ||
#2 | 23373 | Paul Allen |
Lightweight checkout support. Implementation for scm-api classes SCMFile and SCMFileSystem, allowing Jenkins to navigate Perforce within the scope of a workspace view. Lightweight checkout uses a tempoary Perforce workspace to naviagete and fetch the files. The client name and client view mapping will be modified from a template name e.g. jenkins-${NODE_NAME}-${JOB_NAME} to the tempoary name jenkinsTemp-UUID. Alternativly if a user as used ${P4_CLIENT} in the client mapping this will remain unchanged and will be get expanded during the job run. JENKINS-45999 JENKINS-46269 |
||
#1 | 23324 | Paul Allen | Use short lived temporary client when scanning MultiBranch. |