jenkins-swarm-slave-docker
jenkins-swarm-slave-docker copied to clipboard
Multiple labels cause failure in launching the agent
It seems that the label flag is not working when it has space separated values like
-labels "dedicated fast faster"
This is working for me on latest, same command and labels, with the multiple labels being reflected on the jenkins side. Is the plugin up-to-date in jenkins?
Or perhaps it is updated, but your local container image is outdated?
Experiencing the same issue with the image, using Swarm plugin 3.15 on the master.
Feb 22, 2019 2:56:08 AM hudson.plugins.swarm.Client main
SEVERE: CmdLineException occurred during parseArgument
org.kohsuke.args4j.CmdLineException: No argument is allowed: staging
at org.kohsuke.args4j.CmdLineParser.parseArgument(CmdLineParser.java:509)
at hudson.plugins.swarm.Client.main(Client.java:46)
If I take the command that the entry point scripts tells me it is going to run and run it myself on the shell, it works. Something funky is happening when you set LABELS="foo bar"
as an environment variable for the container.
Same issue here: Apparently the next if statements are not working:
if [ ! -z "$CANDIDATE_TAG"]; then
PARAMS="$PARAMS -candidateTag $CANDIDATE_TAG"
fi
if [ "${DELETE_EXISTING_CLIENTS}x" = "truex"]; then
PARAMS="$PARAMS -deleteExistingClients"
fi
if [ "${DISABLE_CLIENTS_UNIQUE_ID}x" = "truex"]; then
PARAMS="$PARAMS -disableClientsUniqueId"
fi
if [ "${DISABLE_SSL_VERIFICATION}x" = "truex"]; then
PARAMS="$PARAMS -disableSslVerification"
fi
Anyway, it is a trivial fix
Perhaps you forgot to quote the labels before using them?
LABELS="foo bar"
swarm-client.jar -labels "${LABELS}"