Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

container stderr: "-slaveLog" is not a valid option #818

Closed
Z9n2JktHlZDmlhSvqc9X2MmL3BwQG7tk opened this issue Nov 11, 2020 · 7 comments · Fixed by #822 or #823
Closed

container stderr: "-slaveLog" is not a valid option #818

Z9n2JktHlZDmlhSvqc9X2MmL3BwQG7tk opened this issue Nov 11, 2020 · 7 comments · Fixed by #822 or #823
Assignees
Labels
bug An issue reporting a bug or a PR fixing one.

Comments

@Z9n2JktHlZDmlhSvqc9X2MmL3BwQG7tk

Agent from last Jenkins versions (remoting-4.6.jar) has no -slaveLog parameter, just -agentLog. Parameter name needs to be replaced.

Versions:

  • docker-plugin 1.2.1
  • jenkins 2.266
  • docker engine 19.03.8
  • docker-plugin connection to container(s) method: Attach Docker container

Error logs:

WARNING i.j.d.c.DockerMultiplexedInputStream#readInternal: Unexpected data on container stderr: "-slaveLog" is not a valid option
WARNING i.j.d.c.DockerMultiplexedInputStream#readInternal: Unexpected data on container stderr: 
java -jar agent.jar [options...]
WARNING i.j.d.c.DockerMultiplexedInputStream#readInternal: Unexpected data on container stderr:  -agentLog FILE                  : Local agent error log destination (overrides
                                   workDir)
 -auth user:pass                 : If your Jenkins is security-enabled, specify
                                   a valid user name and password
......
@pjdarton
Copy link
Member

That looks like it'd be fixed with a straightforward search & replace to change the default arguments (both in the code and the help-text).
...as long as the oldest version of "remoting" that the docker-plugin will encounter supports the -agentLog argument.

I think -agentLog was first supported in https://github.com/jenkinsci/remoting/releases/tag/remoting-3.8

@pjdarton
Copy link
Member

@Z9n2JktHlZDmlhSvqc9X2MmL3BwQG7tk FYI you can workaround this issue by overriding the default "EntryPoint Cmd" field in the "Connect method" section of the "Docker Agent template".

The helptext tells you what the default is, and you'll see the -slaveLog line in there; copy & paste the default into the multi-line text box (expand it first!) and change "slave" to "agent".

@pjdarton pjdarton added the bug An issue reporting a bug or a PR fixing one. label Nov 12, 2020
@mbmarosii
Copy link

FYI: I found this reports also on https://issues.jenkins.io/browse/JENKINS-64251

@pjdarton pjdarton self-assigned this Nov 24, 2020
pjdarton added a commit that referenced this issue Dec 15, 2020
* Jenkins 2.266 upgraded to remoting 4.6
* remoting 4.6 has dropped support for the -slaveLog argument
* we have to use -agentLog now
* see #818 and/or JENKINS-64251
@pjdarton pjdarton reopened this Dec 15, 2020
@pjdarton
Copy link
Member

Well, while fixing this for Jenkins 2.266 is easy, that then breaks it for others, including the unit tests.
I got impatient while waiting for the builds to run, saw some passes and hit the merge button - had I waited and looked more closely, I'd've seen that replacing "slave" with "agent" then broke things completely, depending on which version of Jenkins remoting was in use.
It would appear that while -agentLog support has replaced -slaveLog, there wasn't a sufficiently long length of time where both were supported that we can just switch to agentLog.

@pjdarton
Copy link
Member

It looks like Jenkins 2.60.3, which is what the docker-plugin required as a minimum, uses remoting-3.7 which doesn't support -agentLog but does require -slaveLog for it to work the way we want.

However, bumping to 2.73.3 looked promising as that seems to support both agentLog and slaveLog, so that's what I did in #823
I also made the Attach connection method deal with stderr output from the remoting code much more gracefully - it now removes trailing whitespace before logging it and says which docker node / container it came from to aid debugging.

Overall, I think that should be enough to resolve this issue.

@dkrowl
Copy link

dkrowl commented Jan 13, 2021

@pjdarton
The versions of Jenkins you are listing (and are listed in the plugin page) doesn't make any sense to me. Are you talking about versions 2.260 and 2.273? Or am I missing something?

because this problem still seems to be relevant with the 2.274 version of Jenkins.

@pjdarton
Copy link
Member

You're missing something - the context that was in my head when I wrote that 😉

My previous comment was referring to the "minimum Jenkins version" that the plugin will work with - i.e. very old versions of Jenkins.
I had to bump that from 2.60.3 (which only provided the -slaveLog arg) to 2.73.3 (as that supported both slaveLog and agentLog) in order to enable the plugin to compile & self-test using the "agentLog" argument.

i.e. the plugin code was testing against 2.60.3, and that meant that changing from "slaveLog" to "agentLog" then broke everything as "agentLog" wasn't supported in 2.60.3. Once I'd switched to testing with 2.73.3 the plugin's code (which I'd changed to use "agentLog") started working again.

TL;DR: With this fix, you can't use Jenkins 2.60.3 anymore, you'll need to use 2.73.3 or later ... and anyone using a recent version of Jenkins will be pleased to find that the plugin's default is "agentLog" instead of "slaveLog" so it'll now "just work" again.

...however, as I've not done a docker-plugin release since I merged this, you'll need to use a pre-release build, e.g. from https://repo.jenkins-ci.org/incrementals/io/jenkins/docker/docker-plugin/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue reporting a bug or a PR fixing one.
Projects
None yet
4 participants