Jenkins bulid get an error message: error=7, Argument list too long

What’s  occured?

When Jenkins triggered a  build job defines as “Free-Style Project”, a build failed with this error message

[starfish-verify-drd] $ /bin/bash /tmp/

FATAL: command execution failed error=7, Argument list too long

	at java.lang.UNIXProcess.forkAndExec(Native Method)

	at java.lang.UNIXProcess.<init>(

	at java.lang.ProcessImpl.start(

	at java.lang.ProcessBuilder.start(

Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to swfarm-gateuobld17

		at hudson.remoting.Channel.attachCallSiteStackTrace(

		at hudson.remoting.UserResponse.retrieve(


		at hudson.Launcher$RemoteLauncher.launch(

		at hudson.Launcher$ProcStarter.start(

		at hudson.tasks.CommandInterpreter.perform(

		at hudson.tasks.CommandInterpreter.perform(

		at hudson.tasks.BuildStepMonitor$1.perform(

		at hudson.model.AbstractBuild$AbstractBuildExecution.perform(

		at hudson.model.Build$

		at hudson.model.Build$BuildExecution.doRun(

		at hudson.model.AbstractBuild$

		at hudson.model.Run.execute(


		at hudson.model.ResourceController.execute(


Caused: Cannot run program "/bin/bash" (in directory "/vol/users/gatekeeper.tvsw/cerberus_root/starfish-verify-drd"): error=7, Argument list too long

	at java.lang.ProcessBuilder.start(


  • One argument must not be longer than MAX_ARG_STRLEN (131072 bytes)



Jenkins: Make an agent connection to EC2 instance.


  • EC2 instance has no Elastic IP.
  • When an agent has been in idle status for some times, that instance has to be stopped.


set -x
export PATH=/vol/users/gatekeeper.tvsw/.local/bin:$PATH
echo "INFO: Jenkins Url = ${JENKINS_URL}" >&2
echo "INFO: Start EC2 instance - ${ID}" >&2
aws ec2 start-instances --instance-ids ${ID} >&2

echo "INFO: Wait until EC2 ${ID} will be 'Running'" >&2
aws ec2 wait instance-running --instance-ids ${ID} >&2

echo "INFO: Wait for 10 seconds" >&2
sleep 10
echo "INFO: Get ${ID}s PublicIpAddress" >&2
IP=`aws ec2 describe-instances --instance-ids ${ID}|grep PublicIpAddress |sed 's/\ //g'|sed 's/\"//g'|sed 's/\,//g'|awk -F: '{print $2}'`
NETWORKIFID=`aws ec2 describe-instances --instance-ids ${ID}|grep NetworkInterfaceId|sed 's/\ //g'|sed 's/\"//g'|sed 's/\,//g'|awk -F: '{print $2}'`
echo "INFO: ${ID}s PublicIpAddress = ${IP}" >&2
echo "INFO: ${ID}s NetworkInterfaceId= ${NETWORKIFID}" >&2

trap term_action SIGTERM
function term_action() {
echo "INFO: Stop an instance: ${ID}" >&2
aws ec2 stop-instances --instance-ids ${ID} 2>/dev/null
>&2 echo "INFO: Stopped:${ID}"

date >&2
rm -rf slave.jar
wget --auth-no-challenge --no-check-certificate ${JENKINS_URL}/jnlpJars/slave.jar
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null slave.jar ubuntu@${IP}:~/slave.jar >&2
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -n ubuntu@${IP} 'ls -al ~/slave.jar' >&2
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -n ubuntu@${IP} mk_disk_i3 >&2
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -n ubuntu@${IP} mkdir -p ${WORKSPACE} >&2
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -n ubuntu@${IP} 'echo Postech2001! | sudo -b openconnect --juniper -u allessunjoo.park --passwd-on-stdin >> ~/.openconnect_watchdog.log 2>&1 &'
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${IP} 'java -jar ~/slave.jar'
set +x

Configuration on Jenkins

Jenkins Github Plugin Configurations

  1. Install GitHub Plugin
  2. Go to and Click ‘Generate new token’
    Screen Shot 2017-07-21 at 2.54.40 PM
    Screen Shot 2017-07-21 at 2.55.40 PM.png
  3. On Jenkins Site, Go to ‘Manage Jenkins’ > ‘Configure System’ > ‘GitHub section
  4. Select ‘Add GitHub Server > GitHub Server’
    Screen Shot 2017-07-21 at 2.59.55 PM.png
  5. Click ‘Credentials > Add Jenkins’ and Write a generated token from GitHub with additional information
    • Domain: Global credentials
    • Kind: Secret text
    • Scope: Global
    • Secret: Generated token value
    • ID: Distinct text for this credential
      Screen Shot 2017-07-21 at 3.02.06 PM.png
  6. Select a credential you created and Click ‘Test Connection’
    Screen Shot 2017-07-21 at 3.13.35 PM.png
  7. Go to a build job configuration and Change configuration
    • Source Code Management
      Screen Shot 2017-07-21 at 3.35.37 PM.png
    • Build Trigger
      Screen Shot 2017-07-21 at 3.35.51 PM.png