I am currently receiving a REQUEST_RUNNING_TOO_LONG error when using the Force.com Mirgration Tool and Ant with Jenkins. I've read quite a few posts about this error and understand that this is generally due to long running requests such as non-selective SOQL queries, bad practice like SOQL in for loops, and other various items that could cause tests/code to go over the CPU governor limits.
My current setup is as follows:
Using Intellij IDEA Ultimate with the Illuminated Cloud Force.com Plugin to complete development work in a Developer sandbox.
Pushing commits, when ready to a Git feature branch
When the feature is ready, merging the appropriate commits to the QA branch
Jenkins is watching the QA branch for commits and when one comes in it fires off a job to push the metadata to the QA Developer Pro sandbox
The Jenkins job first connects to Git to pull the last commit which works great. It then dynamically builds the Package.xml file via a Bash script, also working great. Finally, Jenkins is calling Ant and the Force.com Migration Tool to push the metadata, which fails.
Build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:sf="antlib:com.salesforce" default="sf" basedir=".">
<target name="Build">
<echo>Continuous Integration Build</echo>
<property file="build.QA.properties"/>
<property environment="env" />
<echo>${build.cmd}</echo>
<antcall target="${build.cmd}" />
</target>
<target name="DeployAndCheckOnly">
<echo>Deploy Code CheckOnly in Org with username: ${sf.username}</echo>
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="C:\Program Files (x86)\Jenkins\jobs\QA Git Branch to QA Salesforce Org\workspace" logType="Detail" checkOnly="${sf.checkOnly}" />
</target>
<target name="DeployAndRunAllTests">
<echo>Deploy and RunAllTests in Org with username: ${sf.username}</echo>
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="C:\Program Files (x86)\Jenkins\jobs\QA Git Branch to QA Salesforce Org\workspace" logType="Detail" runallTests="${sf.runallTests}"/>
</target>
</project>
build.QA.properties:
## build.properties
sf.username = [email protected]
sf.password = supersecretpassword
sf.serverurl = https://test.salesforce.com
## settings to change in branch properties
## copy the build.master.properties to build.[branch].properties
sf.runallTests = false
sf.checkOnly = true
build.cmd = DeployAndCheckOnly
Package.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<name>ApexClass</name>
<members>MyCustomExtension</members>
<members>MyCustomWrapper</members>
<members>MyCustomREST</members>
</types>
<types>
<name>CustomObject</name>
<members>MyCustomGrandchildObject__c</members>
<members>MyCustomChildObject__c</members>
<members>MyCustomObject__c</members>
</types>
<types>
<name>ApexPage</name>
<members>MyCustomPage</members>
</types>
<version>35.0</version>
</Package>
Resulting messages from Jenkins:
[Slaesforce Build Files] $ cmd.exe /C '"ant.bat -file build.xml "-DC=Program Files (x86)JenkinsSlaesforce Build Filesbuild.QA.properties" Build && exit %%ERRORLEVEL%%"'
Buildfile: C:\Program Files (x86)\Jenkins\Slaesforce Build Files\build.xml
Build:
[echo] Continuous Integration Build
[echo] DeployAndCheckOnly
DeployAndCheckOnly:
[echo] Deploy Code CheckOnly in Org with username: [email protected]
[sf:deploy] Request for a deploy submitted successfully.
[sf:deploy] Request ID for the current deploy task: 0Af29000000i0kvCAA
[sf:deploy] Waiting for server to finish processing the request...
[sf:deploy] Request Status: Pending
[sf:deploy] Request Status: InProgress
[sf:deploy] Request Status: InProgress
[sf:deploy] Request Status: Failed
BUILD FAILED
C:\Program Files (x86)\Jenkins\Slaesforce Build Files\build.xml:8: The following error occurred while executing this line:
C:\Program Files (x86)\Jenkins\Slaesforce Build Files\build.xml:12: Failed to process the request successfully. Cause(UNKNOWN_EXCEPTION): REQUEST_RUNNING_TOO_LONG: Your request was running for too long, and has been stopped.
Total time: 1 minute 39 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
With a total run time of 1.5 minutes, of which only a fraction of that was "InProgress" I am not sure what could be running too long. I also do not know how I can troubleshoot this issue further. Anyone have any ideas?