package org.jenkinsci.plugins.p4.client; import hudson.model.TaskListener; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.jenkinsci.plugins.p4.credentials.P4StandardCredentials; import org.jenkinsci.plugins.p4.populate.AutoCleanImpl; import org.jenkinsci.plugins.p4.populate.ForceCleanImpl; import org.jenkinsci.plugins.p4.populate.Populate; import org.jenkinsci.plugins.p4.workspace.Workspace; import com.perforce.p4java.client.IClient; import com.perforce.p4java.core.IChangelistSummary; import com.perforce.p4java.core.file.FileAction; import com.perforce.p4java.core.file.FileSpecBuilder; import com.perforce.p4java.core.file.FileSpecOpStatus; import com.perforce.p4java.core.file.IFileSpec; import com.perforce.p4java.impl.generic.client.ClientOptions; import com.perforce.p4java.impl.generic.client.ClientView; import com.perforce.p4java.impl.generic.core.Changelist; import com.perforce.p4java.impl.generic.core.Label; import com.perforce.p4java.impl.generic.core.file.FileSpec; import com.perforce.p4java.option.client.ReconcileFilesOptions; import com.perforce.p4java.option.client.RevertFilesOptions; import com.perforce.p4java.option.client.SyncOptions; import com.perforce.p4java.option.server.GetChangelistsOptions; import com.perforce.p4java.option.server.GetFileContentsOptions; import com.perforce.p4java.server.CmdSpec; public class ClientHelper extends ConnectionHelper { private IClient iclient; public ClientHelper(String credential, TaskListener listener, String client) throws Exception { super(credential, listener); login(); iclient = connection.getClient(client); connection.setCurrentClient(iclient); } public ClientHelper(P4StandardCredentials credential, TaskListener listener, String client) throws Exception { super(credential, listener); login(); iclient = connection.getClient(client); connection.setCurrentClient(iclient); } public void setClient(Workspace workspace) throws Exception { if (connectionConfig.isUnicode()) { String charset = "utf8"; connection.setCharsetName(charset); } // Setup/Create workspace based on type iclient = workspace.setClient(connection, authorisationConfig.getUsername()); // Ensure root and host fields are set iclient.setRoot(workspace.getRootPath()); iclient.setHostName(workspace.getHostName()); // Set clobber on to ensure workspace is always good ClientOptions options = new ClientOptions(); options.setClobber(true); iclient.setOptions(options); // Save client spec iclient.update(); // Set active client for this connection connection.setCurrentClient(iclient); } /** * Test to see if workspace is at the latest revision. * * @throws Exception */ public boolean updateFiles() throws Exception { // build file revision spec List<IFileSpec> syncFiles; syncFiles = FileSpecBuilder.makeFileSpecList("//..."); // Sync revision to re-edit SyncOptions syncOpts = new SyncOptions(); syncOpts.setNoUpdate(true); List<IFileSpec> syncMsg = iclient.sync(syncFiles, syncOpts); for (IFileSpec fileSpec : syncMsg) { if (fileSpec.getOpStatus() != FileSpecOpStatus.VALID) { String msg = fileSpec.getStatusMessage(); if (msg.contains("file(s) up-to-date.")) { return false; } } } return true; } /** * Sync files to workspace at the specified change. * * @param change * @throws Exception */ public boolean syncFiles(int change, Populate populate) throws Exception { log("SCM Task: syncing files at change: " + change); // build file revision spec List<IFileSpec> files; String revisions = "//...@" + change; log("... sync " + revisions); // Sync files files = FileSpecBuilder.makeFileSpecList(revisions); return syncFiles(files, populate); } /** * Sync files to workspace at the specified label. * * @param change * @throws Exception */ public boolean syncFiles(String label, Populate populate) throws Exception { log("SCM Task: syncing files at label: " + label); // build file revision spec List<IFileSpec> files; String revisions = "//...@" + label; log("... sync " + revisions); // Sync files files = FileSpecBuilder.makeFileSpecList(revisions); return syncFiles(files, populate); } private boolean syncFiles(List<IFileSpec> files, Populate populate) throws Exception { boolean success = true; // sync options SyncOptions syncOpts = new SyncOptions(); syncOpts.setForceUpdate(populate.isForce()); syncOpts.setClientBypass(!populate.isHave()); log("... force update " + populate.isForce()); log("... bypass have " + !populate.isHave()); List<IFileSpec> syncMsg = iclient.sync(files, syncOpts); success &= validateFileSpecs(syncMsg, "file(s) up-to-date."); return success; } /** * Cleans up the Perforce workspace after a previous build. Removes all * pending and abandoned files (equivalent to 'p4 revert -w'). * * @throws Exception */ public boolean tidyWorkspace(Populate populate) throws Exception { boolean success = true; log("SCM Task: cleanup workspace: " + iclient.getName()); // relies on workspace view for scope. List<IFileSpec> files; files = FileSpecBuilder.makeFileSpecList("//..."); if (populate instanceof AutoCleanImpl) { // remove all pending files within workspace success &= tidyPending(files); // remove extra files within workspace if (((AutoCleanImpl) populate).isDelete()) { success &= tidyDelete(files); } // replace any missing/modified files within workspace if (((AutoCleanImpl) populate).isReplace()) { success &= tidyReplace(files); } } if (populate instanceof ForceCleanImpl) { // remove all files from workspace String root = iclient.getRoot(); File unlink = new File(root); unlink.delete(); } return success; } private boolean tidyPending(List<IFileSpec> files) throws Exception { boolean success = true; log("SCM Task: reverting all pending and shelved revisions."); // revert all pending and shelved revisions RevertFilesOptions rOpts = new RevertFilesOptions(); log("... [list] = revert //..."); List<IFileSpec> list = iclient.revertFiles(files, rOpts); success &= validateFileSpecs(list, "not opened on this client"); // check for added files and remove... log("... rm [list] | ABANDONED"); for (IFileSpec file : list) { if (file.getAction() == FileAction.ABANDONED) { String path = depotToLocal(file); if (path != null) { File unlink = new File(path); unlink.delete(); } } } return success; } private boolean tidyReplace(List<IFileSpec> files) throws Exception { boolean success = true; log("SCM Task: restoring all missing and changed revisions."); // check status - find all missing or changed ReconcileFilesOptions statusOpts = new ReconcileFilesOptions(); statusOpts = new ReconcileFilesOptions(); statusOpts.setNoUpdate(true); statusOpts.setUseWildcards(true); log("... [list] = reconcile -n //..."); List<IFileSpec> update = iclient.reconcileFiles(files, statusOpts); success &= validateFileSpecs(update, "also opened by", "no file(s) to reconcile", "must sync/resolve", "exclusive file already opened"); // force sync to update files only if "no file(s) to reconcile" is not // present. if (validateFileSpecs(update, true, "also opened by", "must sync/resolve", "exclusive file already opened")) { SyncOptions syncOpts = new SyncOptions(); syncOpts.setForceUpdate(true); log("... sync -f [list]"); List<IFileSpec> syncMsg = iclient.sync(update, syncOpts); success &= validateFileSpecs(syncMsg, "file(s) up-to-date.", "file does not exist"); } // force sync any files missed due to INFO messages e.g. exclusive files for (IFileSpec spec : update) { if (spec.getOpStatus() != FileSpecOpStatus.VALID) { String msg = spec.getStatusMessage(); if (msg.contains("exclusive file already opened")) { String rev = msg.substring(0, msg.indexOf(" - can't ")); List<IFileSpec> f = FileSpecBuilder.makeFileSpecList(rev); SyncOptions syncOpts = new SyncOptions(); syncOpts.setForceUpdate(true); log("... sync -f " + rev); List<IFileSpec> syncMsg = iclient.sync(f, syncOpts); success &= validateFileSpecs(syncMsg, "file(s) up-to-date.", "file does not exist"); } } } return success; } private boolean tidyDelete(List<IFileSpec> files) throws Exception { boolean success = true; log("SCM Task: removing all non-versioned files."); // check status - find all extra files ReconcileFilesOptions statusOpts = new ReconcileFilesOptions(); statusOpts.setOutsideAdd(true); statusOpts.setNoUpdate(true); statusOpts.setUseWildcards(true); log("... [list] = reconcile -n -a //..."); List<IFileSpec> extra = iclient.reconcileFiles(files, statusOpts); success &= validateFileSpecs(extra, "- no file(s) to reconcile", "instead of", "empty, assuming text"); // remove added files log("... rm [list]"); for (IFileSpec e : extra) { String path = depotToLocal(e); if (path != null) { File unlink = new File(path); unlink.delete(); } } return success; } /** * Workaround for p4java bug. The 'setLocalSyntax(true)' option does not * provide local syntax, so I have to use 'p4 where' to translate through * the client view. * * @param fileSpec * @return * @throws Exception */ private String depotToLocal(IFileSpec fileSpec) throws Exception { String depotPath = fileSpec.getDepotPathString(); if (depotPath == null) { depotPath = fileSpec.getOriginalPathString(); } if (depotPath == null) { return null; } List<IFileSpec> dSpec = FileSpecBuilder.makeFileSpecList(depotPath); List<IFileSpec> lSpec = iclient.where(dSpec); String path = lSpec.get(0).getLocalPathString(); return path; } private void printFile(String rev) throws Exception { byte[] buf = new byte[1024 * 64]; List<IFileSpec> file = FileSpecBuilder.makeFileSpecList(rev); GetFileContentsOptions printOpts = new GetFileContentsOptions(); printOpts.setNoHeaderLine(true); InputStream ins = connection.getFileContents(file, printOpts); String localPath = depotToLocal(file.get(0)); File target = new File(localPath); if (target.exists()) { target.setWritable(true); } FileOutputStream outs = new FileOutputStream(target); BufferedOutputStream bouts = new BufferedOutputStream(outs); int len; while ((len = ins.read(buf)) > 0) { bouts.write(buf, 0, len); } ins.close(); bouts.close(); } /** * Unshelve review into workspace. Workspace is sync'ed to head first then * review unshelved. * * @param review * @throws Exception */ public boolean unshelveFiles(int review) throws Exception { boolean success = true; log("SCM Task: unshelve review: " + review); // build file revision spec List<IFileSpec> files; files = FileSpecBuilder.makeFileSpecList("//..."); // Sync workspace to head SyncOptions syncOpts = new SyncOptions(); log("... sync //..."); List<IFileSpec> syncMsg = iclient.sync(files, syncOpts); success &= validateFileSpecs(syncMsg, "file(s) up-to-date."); // Unshelve change for review List<IFileSpec> shelveMsg; log("... unshelve -f -s " + review + " //..."); shelveMsg = iclient.unshelveChangelist(review, files, 0, true, false); success &= validateFileSpecs(shelveMsg, "also opened by", "no such file(s)", "exclusive file already opened"); // force sync any files missed due to INFO messages e.g. exclusive files for (IFileSpec spec : shelveMsg) { if (spec.getOpStatus() != FileSpecOpStatus.VALID) { String msg = spec.getStatusMessage(); if (msg.contains("exclusive file already opened")) { String rev = msg.substring(0, msg.indexOf(" - can't ")); printFile(rev); log("... print " + rev); } } } // Remove opened files from have list. RevertFilesOptions rOpts = new RevertFilesOptions(); rOpts.setNoUpdate(true); log("... revert -k //..."); List<IFileSpec> rvtMsg = iclient.revertFiles(files, rOpts); success &= validateFileSpecs(rvtMsg, "file(s) not opened on this client"); return success; } /** * Get the change number for the last change within the scope of the * workspace view. * * @return * @throws Exception */ public int getClientHead() throws Exception { // build file revision spec String ws = "//" + iclient.getName() + "/..."; List<IFileSpec> files = FileSpecBuilder.makeFileSpecList(ws); GetChangelistsOptions opts = new GetChangelistsOptions(); opts.setMaxMostRecent(1); List<IChangelistSummary> list = connection.getChangelists(files, opts); int change = 0; if (!list.isEmpty() && list.get(0) != null) { change = list.get(0).getId(); } return change; } /** * Gets the Changelist (p4 describe -s); shouldn't need a client, but * p4-java throws an exception if one is not set. * * @param id * @return * @throws Exception */ public Changelist getChange(int id) throws Exception { return (Changelist) connection.getChangelist(id); } /** * Fetches a list of changes needed to update the workspace to head. * * @return * @throws Exception */ public List<Object> listChanges() throws Exception { String fileSpec = "//..."; return listChanges(fileSpec); } /** * Fetches a list of changes needed to update the workspace to the specified * limit. The limit could be a Perforce change number or label. * * @param limit * @return * @throws Exception */ public List<Object> listChanges(int changeLimit) throws Exception { String fileSpec = "//...@" + changeLimit; return listChanges(fileSpec); } private List<Object> listChanges(String fileSpec) throws Exception { List<Object> changes = new ArrayList<Object>(); Map<String, Object>[] map; map = connection.execMapCmd("cstat", new String[] { fileSpec }, null); for (Map<String, Object> entry : map) { String status = (String) entry.get("status"); if (status.startsWith("need")) { String value = (String) entry.get("change"); int change = Integer.parseInt(value); changes.add(change); } else if (status.startsWith("partial")) { String value = (String) entry.get("change"); int change = Integer.parseInt(value); changes.add(change); } } return changes; } public Label getLabel(String id) throws Exception { return (Label) connection.getLabel(id); } public void setLabel(Label label) throws Exception { // connection.createLabel(label); String user = connection.getUserName(); label.setOwnerName(user); connection.updateLabel(label); } public List<IFileSpec> getTaggedFiles(String label) throws Exception { String ws = "//" + iclient.getName() + "/...@" + label; List<IFileSpec> spec = FileSpecBuilder.makeFileSpecList(ws); List<IFileSpec> tagged = connection.getDepotFiles(spec, false); return tagged; } public List<IFileSpec> loadShelvedFiles(int id) throws Exception { String cmd = CmdSpec.DESCRIBE.name(); String[] args = new String[] { "-s", "-S", "" + id }; List<Map<String, Object>> resultMaps; resultMaps = connection.execMapCmdList(cmd, args, null); List<IFileSpec> list = new ArrayList<IFileSpec>(); if (resultMaps != null) { if ((resultMaps.size() > 0) && (resultMaps.get(0) != null)) { Map<String, Object> map = resultMaps.get(0); if (map.containsKey("shelved")) { for (int i = 0; map.get("rev" + i) != null; i++) { FileSpec fSpec = new FileSpec(map, connection, i); fSpec.setChangelistId(id); list.add(fSpec); } } } } return list; } public ClientView getClientView() { return iclient.getClientView(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#148 | 29870 | Sandeep Kumar |
Merge pull request #194 from kjs104901/bugfix JENKINS-72098: Cant sync global libraries on Windows |
||
#147 | 29869 | Sandeep Kumar |
Move test from PerforceSCMSourceTest. Ignore NoSuchFileException As newer release of commons.io will use this exception when file is not found. |
||
#146 | 29848 | Sandeep Kumar |
Merge pull request #195 from jenkinsci/StreamAtChange Support StreamAtChange for ManualWorkspace. |
||
#145 | 29440 | Paul Allen |
Merge pull request #172 from skumar7322/ReconcileWithT Add '-t' flag to reconcile command. JENKINS-59922 This flag was suppoerted by p4d after 2019.1 release(#1726148 (Job #51996) ), so set it in p4jenkins for this or later versions. |
||
#144 | 28805 | Paul Allen |
Merge pull request #145 from joel-f-brown/master Allow option to not detect changelists for build, JENKINS-68516 |
||
#143 | 28508 | Paul Allen |
Cache P4TICKET in session. Session cache now keyed on Credential ID and stores: User, Expiry time and Ticket. |
||
#142 | 28464 | Paul Allen |
Formalise user session cache. Added Jelly options to Global Configuration. User cache is disabled by default. Ticket Minimum life is set to 30 minutes. JENKINS-60141 |
||
#141 | 28460 | Paul Allen |
Session cache to track ticket time. Initial design to reduce 'p4 login -s' calls with user session cache to track ticket time. |
||
#140 | 28021 | Paul Allen |
Alternative cleanup option. In some situations (Windows) we need to individually set the file to be writable and then delete. JENKINS-66089 |
||
#139 | 27924 | Paul Allen |
Merge pull request #128 from bsmoyers/poll-at-counter allow polling scm when populate options in job are set to pin to counter name in addition to changelist or label |
||
#138 | 27175 | Paul Allen |
Prevent dormant multi branch project continiously building. JENKINS-63494 and JENKINS-64193 When scanning a multi branch project if the history of changes is outside of the `Head change query limit` then no changes are found. The old behaviour used the latest change and triggered a build; continuously triggering dormant projects with each new submit. The new behaviour uses the last build change if no changes are found (preventing a triggered build) or if there was no previous builds (in the case of new projects) then the latest changes is used to triggering a build. |
||
#137 | 26603 | Paul Allen |
Merge pull request #119 from joel-f-brown/master Add virtual stream detection for MultiBranch pipeline. JENKINS-62699 |
||
#136 | 26601 | Paul Allen | Code cleanup for getHead and getLowestHead. | ||
#135 | 26122 | Paul Allen |
Added additional login to resolve parallel connection issue. Includes test case for parallel stages. JENKINS-52806 |
||
#134 | 26099 | Paul Allen |
Prevent infinite polling when last build and current are pinned to a label. Added test to verify support for static lables. JENKINS-58149 |
||
#133 | 26094 | Paul Allen |
Merge pull request #105 from jenkinsci/publishFilter Publish path filter for reconcile JENKINS-56501 |
||
#132 | 25826 | Paul Allen |
Global option to limit change query. By default 'Head change query limit' is set to 0 (no limit) and the plugin will query all changes when looking within a workspace view. For large servers set the value to a range based on commit rate and job queue duration. e.g. 200 global commits/hour and jobs are queued for no longer than 10 hours, so 2000 change query limit (200*10). JENKINS-58116 JENKINS-57870 |
||
#131 | 25760 | Paul Allen | FindBugs: Removed unused processParameters | ||
#130 | 25759 | matthew_smeeth |
Use iclient.reconcileFiles over old execMap method. Added extra logging to reconcile |
||
#129 | 25668 | Paul Allen |
Merge pull request #94 from lystor/bug-56414 JENKINS-56414: Support of Reconcile with Modtime in P4Publish |
||
#128 | 25651 | Paul Allen |
Merge pull request #100 from stuartrowe/JENKINS-57534 Limit buildChange to the next highest change number within the client's view |
||
#127 | 25437 | Paul Allen |
Skip build if polling finds no/null change. JENKINS-55075 |
||
#126 | 25115 | Paul Allen |
Merge pull request #91 from p4charu/jenkinsci-master Fixed JENKINS-39107 and JENKINS-55826 |
||
#125 | 25056 | Paul Allen |
Check for duplicate syncIDs and test polling after failed build. JENKINS-55075 |
||
#124 | 25018 | Paul Allen |
Merge pull request #88 from p4charu/jenkinsci-master. Fixed JENKINS-55430 and better credential error reporting |
||
#123 | 24987 | Paul Allen |
Diff client object before save to reduce unnecessary spec changes. JENKINS-52590 |
||
#122 | 24969 | Paul Allen |
Tidy up imports. TODO: throw AbortException from clientLogin(). |
||
#121 | 24968 | Paul Allen |
Merge pull request #85 from DrakkenWulf/master Fix ability to do Replay in Pipelines. JENKINS-55107 |
||
#120 | 24944 | Paul Allen |
Merge pull request #86 from p4charu/jenkinsci-master JENKINS-51632 and minor code cleanup |
||
#119 | 24940 | Paul Allen |
Skip sync when PreviewSync is used with quiet option `p4 sync -q -n`. JENKINS-54153 |
||
#118 | 24842 | Paul Allen | Add logging for Client View field on Workspace update. | ||
#117 | 24826 | Paul Allen | Update Perforce Server Unicode check. | ||
#116 | 24805 | Paul Allen |
Tidy up connection methods. Cache TagAction calls to getTicket() when adding P4_TICKET to the Environment. JENKINS-54222 |
||
#115 | 24492 | Paul Allen |
Initial work for MultiBranch Event trigger. JENKINS-52066 (Triggered Events and not Polling per change) |
||
#114 | 24487 | Paul Allen | Perforce Connection Refactor. | ||
#113 | 24359 | Paul Allen | Support ServerID on client for Edge type serves. | ||
#112 | 23821 | Paul Allen |
Raise Submit errors in Publish step. JENKINS-49825 |
||
#111 | 23620 | Paul Allen |
Merge pull request #69 from jfperusse-bhvr/master Fix issue unshelving move/delete of locked files |
||
#110 | 23589 | Paul Allen |
Remove forced clobber and set default clobber option to true. JENKINS-49041 |
||
#109 | 23327 | Paul Allen | Use client less connection when scanning MultiBranch. | ||
#108 | 23324 | Paul Allen | Use short lived temporary client when scanning MultiBranch. | ||
#107 | 23258 | Paul Allen | Clean up a few minor warnings. | ||
#106 | 23239 | Paul Allen |
Add configuration parameter for choosing whether to allow auto-submission of config changes to perforce. This can avoid creating floods of changelists at the cost of requiring a manual changelist submit. A scheduled task may be alleviate the need to manually submit the updated changes while still reducing the number of changelists created. @Tsaukpaetra https://swarm.workshop.perforce.com/reviews/23186 |
||
#105 | 22999 | Paul Allen |
Fix sync options on FlushOnly and CheckOnly. JENKINS-46352 |
||
#104 | 22914 | Paul Allen | (minor) Update Unshelve step from int to long. | ||
#103 | 22893 | Paul Allen |
Merge pull request #56 from jfperusse-bhvr/fix-unshelve-delete-exclusive. Manually delete exclusively locked files for reviews. JENKINS-47141 |
||
#102 | 22861 | Paul Allen | Use long for change number. | ||
#101 | 22808 | Paul Allen |
Create directories as required when printing locked file. JENKINS-37868 |
||
#100 | 22807 | Paul Allen |
Merge pull request #52 from jfperusse-bhvr/fix-unshelve-exclusive
Fix unshelving of exclusively checked out files. JENKINS-46599 |
||
#99 | 22683 | Paul Allen | Implement a FlushOnly sync for "Populate Options" (abbec) | ||
#98 | 22537 | Paul Allen |
Use Decoded URL path for local delete. Local client syntax uses URL @ encoding, but the local filesystem needs the decoded path. JENKINS-45339 |
||
#97 | 22532 | Paul Allen |
Return empty list on error for listRepos() JENKINS-45420 |
||
#96 | 22514 | Paul Allen | Raise Errors from StreamingCallbacks. | ||
#95 | 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 |
||
#94 | 22349 | Paul Allen |
Parallel Sync using P4Java. Update to P4Java 2017.2; using RPC level parallel sync and threaded within the JVM. Native parallel sync no longer requires a 'p4d' binary. |
||
#93 | 22315 | Paul Allen |
Pending change cleanup for unshelve. Unshelve would leave files open for add/edit/delete, the 'tidy' option will 'revert -k' the files leaving the content in the workspace, but removing the 'have' list data. Unshelve can now specify a Credential and Workspace, important for situations where more than one sync occurs in a pipeline script. JENKINS-43430 |
||
#92 | 22257 | Paul Allen |
Streaming Asynchronous Callback for Submit. JENKINS-44427 |
||
#91 | 22231 | Paul Allen |
Fixed 'No such file(s)' on unshelve check. JENKINS-43430 |
||
#90 | 22128 | Paul Allen |
Helix Graph support for Jenkins. JENKINS-40354 |
||
#89 | 21923 | Paul Allen |
Added old ClientHelper constructor and mark Deprecated. ClientHelper constructor breaking change introduced in 1.3.6 #26 |
||
#88 | 21794 | Paul Allen |
Merge pull request #39 from Dohbedoh/JENKINS-34825 Jenkins 34825 |
||
#87 | 21758 | Paul Allen |
Merge pull request #38 from jenkinsci/dev scm-api 2.0.2 updates |
||
#86 | 21163 | Paul Allen | Add P4HOST to parallel sync. | ||
#85 | 21077 | Paul Allen |
Switch polling back to build.xml Change in Polling behaviour; use last build details in the build.xml file. It gathers 'last' change details on the master thread and not a slave thread. JENKINS-37462 - updated and improved test case |
||
#84 | 20986 | Paul Allen |
Ground work for MultiJob support. Pushed validate up to ConnectionHelper and added new Perforce functions. |
||
#83 | 20954 | Paul Allen |
Add purge -S<n> option for the Submit stage of Publish. If a value is provided it will set the purge option on all files found as part of the reconcile (ADD/EDIT). It will not remove the purge option once set. JENKINS-36112 |
||
#82 | 20897 | Paul Allen |
Report all P4Java errors on validate Ignore 'no such file' warning on populate, caused by empty file list on sync -k. |
||
#81 | 20873 | Paul Allen | Support Pin to a change in a counter. | ||
#80 | 20820 | Paul Allen | Find bug fix for null checking on Jenkins.getInstance() | ||
#79 | 20818 | Paul Allen |
Global limits for changes and files. Max number of change lists to show for a build (default 10) Max number of files to list in a change (default 50) |
||
#78 | 20788 | Paul Allen | Fix for findbugs | ||
#77 | 20787 | Paul Allen |
Polling Fix for use with quiet period. Switched all uses of change/label to P4Revision object and implemented Comparable. The changes to build are now calculated at build time (after the quiet period) not during the polling phase. JENKINS-36883 #review-20780 |
||
#76 | 20620 | Paul Allen |
Change 'now' to the latest change at the point of sync. JENKINS-36883 |
||
#75 | 20208 | Paul Allen |
Parallel sync for SSL connections. JENKINS-37476 |
||
#74 | 20179 | Paul Allen | Javadoc fixes for java 8 builds. | ||
#73 | 20015 | Paul Allen |
Force sort order for 'p4 cstat' and 'p4 changes'. Resolve issue for Polling. JENKINS-37124 |
||
#72 | 19918 | Paul Allen |
Use StreamingCallback for Reconcile. Reduce memory for servers 14.1 and above. |
||
#71 | 19790 | Paul Allen |
Add a propagate delete option to Publish. Originally only add/edits were permitted to prevent users deleting files with incorrect View maps, but this option allows deletes if enabled. JENKINS-27885 |
||
#70 | 19593 | Paul Allen | More minor fixes to satisfy FindBugs Analysis. | ||
#69 | 19581 | Paul Allen | Minor fixes to satisfy FindBugs Analysis. | ||
#68 | 19431 | Paul Allen |
Raise failed submit as Exception and mark build as failed. JENKINS-34770 |
||
#67 | 19374 | Paul Allen |
Poll on Master (without workspace) New Polling Filter ‘Poll on Master using Last Build’. Only polls on the master and fetches it change from the last Build. Note that 0 is assumed if no previous build is found. JENKINS-32814 |
||
#66 | 19365 | Paul Allen |
Track syncs with a 'Change' field in the Workspace Description. Polling used ‘p4 cstat’ to determine the last sync’ed change in a workspace. However, if the have list is empty (such as in the Force Clean Populate mode) it would appear as if no changes have been synced. JENKINS-32518 JENKINS-32523 |
||
#65 | 19324 | Paul Allen |
Added Parallel Sync. An Advanced Populate option. Must specify the PATH to the ‘p4’ executable as parallel sync is not supported by p4java. JENKINS-29228 |
||
#64 | 19090 | Paul Allen |
Revert files before deleting a Workspace. JENKINS-24070 Jenkins Log (successful delete): Apr 21, 2016 10:08:20 PM org.jenkinsci.plugins.p4.PerforceScm processWorkspaceBeforeDeletion INFO: processWorkspaceBeforeDeletion Apr 21, 2016 10:08:20 PM org.jenkinsci.plugins.p4.tasks.RemoveClientTask invoke INFO: Task: remove client. Apr 21, 2016 10:08:20 PM org.jenkinsci.plugins.p4.tasks.RemoveClientTask invoke INFO: P4: unsyncing client: jenkins-master-open Apr 21, 2016 10:08:20 PM org.jenkinsci.plugins.p4.tasks.RemoveClientTask invoke INFO: P4: remove client: jenkins-master-open Apr 21, 2016 10:08:20 PM org.jenkinsci.plugins.p4.PerforceScm processWorkspaceBeforeDeletion INFO: clean: true |
||
#63 | 18889 | Paul Allen |
Asynchronous sync operation. To avoid memory issues with very large sync operations. #review-18773 |
||
#62 | 18723 | Paul Allen |
Add a revert option to SyncOnly Populate mode. Remove the revert -k option from unshelve task and leave it to the Populate cleanup step. |
||
#61 | 18616 | mjoubert |
@pallen Unable to get current change: com.perforce.p4java.exception.RequestException: Can't use a pending changelist number for this command. FATAL: null java.lang.NullPointerException Fix for critial bug |
||
#60 | 18440 | Paul Allen |
Prevent Delete actions on the Publish step. Limit reconcile to -ae (add/edit) JENKINS-28448 |
||
#59 | 16836 | Paul Allen |
Versioning for Jenkins configuration pages. Add credential, depot path location and client workspace name, everything else should be automatic. JENKINS-25145 |
||
#58 | 16815 | Paul Allen |
Enable early binding for CHARSET Expose CHARSET to AbstractTask to allow the charset to be set at the point the client workspace is set as current in ClientHelper. |
||
#57 | 16722 | Paul Allen |
Enable Unicode Support for workspace. Originally hardcoded to UTF8 for *nix systems and web browsers. |
||
#56 | 16530 | Paul Allen | Skip unshelve task if change is 0 or less. | ||
#55 | 16529 | Paul Allen |
DSL for Unshelve task. DSL example: p4unshelve resolve: 'at', shelf: '10831' |
||
#54 | 16514 | Paul Allen |
Unshelve and resolve build step. Implements a classic Jenkins Build step (i.e. not Workflow). Must provide a shelf change number and resolve options. The shelf change number supports variable expansion ${VAR}. |
||
#53 | 16404 | Paul Allen |
Fix flags used during have list cleanup. Flags were inherited from Populate options and being used in the cleanup stage, when they should only be applied to the populate stage. |
||
#52 | 16397 | Paul Allen |
Fix for Force Clean with sync -p Fixed sync to use ...#0 (#none) to remove the have list as part of the cleanup. |
||
#51 | 16389 | Paul Allen |
Fix for Force Clean sync flags. You cannot use `-f` and `-p` together. |
||
#50 | 16325 | Paul Allen |
Enable 'Populate have list' to function in all modes. Previously if 'Populate have list' was unselected in Force Clean mode it would have no effect. @ksong |
||
#49 | 16272 | Paul Allen |
Filter reported changelists. Remove -1 and duplicate changes. |
||
#48 | 16086 | Paul Allen | Fix to enable -m on reconcile. | ||
#47 | 15866 | Paul Allen |
Abort if unshelve fails. JENKINS-30525 |
||
#46 | 15750 | Paul Allen |
Use a P4Revision object and not int/String as Object. In sure that there is no ambiguity with the revision specifier. Should fix change summary when using the Workflow plugin. JENKINS-30425 |
||
#45 | 15656 | Paul Allen |
Updated credentials to extend BaseStandardCredentials. Allows users to set the ID at creation. JENKINS-29702 |
||
#44 | 15489 | Paul Allen | (tidyup) formating. | ||
#43 | 15470 | mjoubert |
@pallen Fix typo |
||
#42 | 14173 | Paul Allen |
Support P4D 15.1 'reconcile -m'. Client workspace MODTIME option is no longer required with -m. |
||
#41 | 13700 | Paul Allen | minor tidy up. | ||
#40 | 13681 | Paul Allen |
Abstracted Expand class from Workspace. Added support for Label variable expansion in the name and description. |
||
#39 | 13676 | Paul Allen |
Added support for `p4 clean`. If the Perforce server is 14.1 or greater then the `-w` flag is used (p4 clean), otherwise the original auto clean up code. |
||
#38 | 13604 | Paul Allen | Improved error handling and fixed test case issue. | ||
#37 | 13603 | Paul Allen | Improved Error for Publish step when connection is down. | ||
#36 | 12977 | Paul Allen | Quiet option for Populate. | ||
#35 | 12976 | Paul Allen | Improved logging to include 'actual' Perforce command. | ||
#34 | 12953 | Paul Allen |
Update logging to support expand/collapse divs. - Additional Publish logging |
||
#33 | 12932 | Paul Allen |
New Populate CheckOnly Implementation. No tidy or sync steps only a have list update. Intended for use with polling and triggering other Jenkins jobs. #review-12933 @mjoubert |
||
#32 | 12888 | Paul Allen |
Merged Pull#11 @rpocase [JENKINS-28213] Force syncing a workspace that does not exist on the filesystem causes a FileNotFoundException. - Tidy up imports and white space |
||
#31 | 12310 | Paul Allen |
@mjoubert performance/logging Improved performance on validateFileSpecs() Reduce delete logging |
||
#30 | 12298 | Paul Allen | Implement the tidyWorkspace() method with a single reconcile. | ||
#29 | 12212 | Paul Allen |
Log reverted/shelved files. @mjoubert This changes add the files that got reverted and unshelved to the console log. This information is crucial for debugging purposes and allows steps later on to potentially change behaviour by using the console output e.g. do X when file Y is unshelved |
||
#28 | 12180 | Paul Allen |
Fix revert in unshelve step to use `-k` and not `-n`. https://github.com/jenkinsci/p4-plugin/pull/10 |
||
#27 | 11627 | Paul Allen |
Use localSyntax support in p4java 14.1 #review-11590 |
||
#26 | 11561 | Paul Allen |
Avoid writing `null` client root. Added protection to prevent a null client root value being written during polling. The client root is not set during polling as the workspace could be polled from another node. Change also prevents updates to Static workspaces. JENKINS-26589 |
||
#25 | 11452 | Paul Allen |
Push out mjoubert fixes for Force sync. @mjoubert |
||
#24 | 11368 | Paul Allen |
Publish - pre/post pending file cleanup. Pre-cleanup for publish and post-cleanup for shelving files. |
||
#23 | 11334 | Paul Allen |
Remote slave support for Publish Perforce Publish commands need to be executed from the remote slave. - Includes refactoring into task package |
||
#22 | 11331 | Paul Allen |
Publish logging and help pages Added logging details for shelved/submitted files. Added help dialogs for Publish configuration. Added -k option for shelve revert. |
||
#21 | 11258 | Paul Allen |
Minor fix for Publish Asset Set client root for new workspaces. Flush client to populate have list (sync -k) |
||
#20 | 11231 | Paul Allen |
Publish assets to Perforce. New feature to allow Jenkins to shelve or submit the build result to Perforce. Configured as a Post Build Step, the Perforce credential and workspace are required as the asset could be published to a different Perforce instance. |
||
#19 | 11166 | Paul Allen |
Behaviour: remove sync to head for unshelve step Current workflow for review is to: sync the change, or label provided then overrides this with a sync to head, before unshelving the content — forcing the resolve step. Removing the second sync allows users to determine the resolve point, although they might not be able to submit the shelf without a second resolve. Old behaviour can be restored by fixing the review ‘change’ parameter to ‘now’ a Perforce builtin revision. |
||
#18 | 11165 | Paul Allen |
Resolve unshelve issue from edge server. @mjoubert noticed the issue and that removing the path side steps the problem. Looks like a separate issue for P4JAVA. SCM Task: unshelve review: 12345 ... sync c:\jenkins\workspace\proj/... ... unshelve -f -s 12345 c:\jenkins\workspace\proj/... P4JAVA: Path 'c:\jenkins\cryptos\workspace\proj/...' is not under client's root 'c:\jenkins\workspace\proj'. ERROR: Unable to update workspace: hudson.AbortException: P4JAVA: Error(s) |
||
#17 | 10939 | Paul Allen |
Tidy up changes. - Moved duration timings to ClientHelper and measure each task individually. - White space/formatting on P4ChangeEntry. - Temporarily backed-out p4-plugin.properties file (could damage builds - need to understand requirements) |
||
#16 | 10914 | Paul Allen |
SCM Polling Use client path syntax for listing have changes as using a windows path on a linux master will fail. Exit early from polling if a change is found. |
||
#15 | 10853 | Paul Allen |
Latest change for parent builds. Uses the latest change for parent builds that have no real changes within their workspace build. |
||
#14 | 10841 | Paul Allen |
Support for 2014.1 reconcile by MODTIME Feature allows a user check the option ‘Sync with MODTIME for consistency check’ under the ‘Populate’ option to enable reconcile to check files based on MODTIME. Includes test case for MODTIME and minor fix for fetching a Label when there is no previous change. JENKINS-25341 |
||
#13 | 10801 | Paul Allen |
Improvements to SCM Polling Moved change list calculation into a new class CheckoutChanges. Should enable normal build to build every thing and poll to follow polling behaviour: limit based on pin and per-change if set. JENKINS-25300 |
||
#12 | 10525 | Paul Allen |
Update Changelist calculation. Changed the SCM Polling and change listing reporting to calculate the last change based on the highest reported 'have' entry from 'p4 cstat' and then list using 'p4 changes'. JENKINS-24978 JENKINS-24607 |
||
#11 | 10013 | Paul Allen |
Added Client support to sync check https://issues.jenkins-ci.org/browse/JENKINS-24055 |
||
#10 | 9987 | Paul Allen | Better logging for slave connections. | ||
#9 | 9984 | Paul Allen |
Set P4_CHANGELIST to change for Automatic Labels. P4_CHANGELIST is set to a change number or label if defined in Populate as pinned or a build parameter. |
||
#8 | 9980 | Paul Allen |
Changed error reporting to use AbortException. - Use direct access of scm attributes, not via build.getProject().getScm() - Improved logging around labels/changes. |
||
#7 | 9851 | Paul Allen | Merging using p4-jenkins | ||
#6 | 9803 | Paul Allen | Merging using p4-jenkins | ||
#5 | 9787 | Paul Allen | Merging using p4-jenkins | ||
#4 | 9769 | Paul Allen | Copying using p4-jenkins | ||
#3 | 9738 | Paul Allen | Merging using p4-jenkins | ||
#2 | 9722 | Paul Allen | Copying 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/client/ClientHelper.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/client/ClientHelper.java | |||||
#8 | 9429 | Paul Allen |
Fix SCM Polling bug. Client workspace was not set (unless by an earlier build). - Move listChanges method to ClientHelper. |
||
#7 | 9133 | Paul Allen |
Added Workspace mode for versioned Client Specs. Client Spec can be specified by depot path and used to configure workspace for build. - Includes fix for removing header when using p4 print. |
||
#6 | 9125 | Paul Allen | Added cleanup for Force Clean/Sync populate mode. | ||
#5 | 9115 | Paul Allen |
Initial implementation of workspace Cleanup and Sync options. - Includes 3 modes: Automatic Clean/Sync, Force Clean/Sync, Sync Only Automatic Clean/Sync Uses reconcile to clean up workspace and sync changes. Force Clean/Sync Force sync of all files (does not remove files yet...) Sync Only Normal sync with no cleanup TODO: - remove of files in Force Clean/Sync mode - Inline help - Update docs - Add unit/functional tests |
||
#4 | 9069 | Paul Allen |
Adding initial support for tagging Jenkins builds as Perforce Automatic Labels. Only implements TagAction (manual labels); TagNotifier and test cases TODO. |
||
#3 | 9055 | Paul Allen |
Label support. Build at a label using the pram 'label'. This includes adding the label to the ChangeEntry, building the change reports and Browser links to Swarm. (TPI-102) |
||
#2 | 9039 | Paul Allen |
Bug Fix: Array index error. The method getClientHead() will return a change of 0 when trying to sync a stream with no changes. |
||
#1 | 8940 | Paul Allen |
Major refactor for the ConnectionHelper class to simplify serialisation. Fixed remote Jenkins JNLP slave connection issue. ClientHelper now extends ConnectionHelper and takes on all methods that require a client workspace. P4StandardCredentials is sent to the remote node instead of Credentials ID due to an issue accessing the Credentials store over a remote connection. For simplicity Client ID (workspace name) is serialised instead of the Workspace object. |