-
Notifications
You must be signed in to change notification settings - Fork 136
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
don’t lookup systemCredentials to eventually store credentialsId which was initial constructor parameter #82
Conversation
…h was initial constructor parameter Running Configuration-as-Code we inject credentialsId during init, while the credentials store might not be setup yet so it can resolve it to an actual credentials instance. Signed-off-by: Nicolas De Loof <[email protected]>
issue with DockerRule "Failed to build image (100): ff2527313f5c" |
Reading package lists...
Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
openssh-server : Depends: openssh-client (= 1:7.5p1-10) but 1:7.5p1-10ubuntu0.1 is to be installed
Recommends: libpam-systemd but it is not going to be installed
Recommends: ncurses-term but it is not going to be installed
Recommends: xauth but it is not going to be installed
Recommends: ssh-import-id but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt-get update -y && apt-get install -y openssh-server=1:7.5p1-10' returned a non-zero code: 100 |
Signed-off-by: Nicolas De Loof <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 for using an overridden method in the constructor.
@@ -853,7 +863,7 @@ public Boolean call() throws InterruptedException { | |||
final Node node = computer.getNode(); | |||
final String nodeName = node != null ? node.getNodeName() : "unknown"; | |||
if(node != null) { | |||
CredentialsProvider.track(node, credentials); | |||
CredentialsProvider.track(node, getCredentials()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling a non-final getter in the constructor is generally a bad idea. SSHLauncher is extended in several plugins, and this method is overridden: https://github.com/jenkinsci/docker-plugin/blob/5a2a123cd808a9c82d154cbcc22ef906a6a97907/src/main/java/io/jenkins/docker/connector/DockerComputerSSHConnector.java#L417-L434
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not constructor but launch
method body.
Maybe you've been confused by github UI to hardly capture the context with a Callable involved
@reviewbybees tho |
SSHLauncher do receive
credentialsId
but then retrieve matchingCredentials
instance, then storescredentials.getI()
. Proposed change make it just simpler by storing IDinitial reason doing so :
Running Configuration-as-Code we inject credentialsId during init, while the credentials store might not be setup yet so it can resolve it to an actual credentials instance.
Signed-off-by: Nicolas De Loof [email protected]