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

don’t lookup systemCredentials to eventually store credentialsId which was initial constructor parameter #82

Merged
merged 2 commits into from
Feb 23, 2018

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented Feb 15, 2018

SSHLauncher do receive credentialsId but then retrieve matching Credentials instance, then stores credentials.getI(). Proposed change make it just simpler by storing ID

initial 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]

…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]>
@ndeloof
Copy link
Contributor Author

ndeloof commented Feb 15, 2018

issue with DockerRule "Failed to build image (100): ff2527313f5c"

@ndeloof
Copy link
Contributor Author

ndeloof commented Feb 15, 2018

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]>
Copy link
Member

@oleg-nenashev oleg-nenashev left a 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());
Copy link
Member

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

Copy link
Contributor Author

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

@oleg-nenashev
Copy link
Member

@reviewbybees tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants