Skip to content

Commit

Permalink
Force a new session to be created after running the init script to pi…
Browse files Browse the repository at this point in the history
…ck up new settings

In scenarios where new shells, groups, user settings or other environmental
changes which are made by the 'Init Script', this patch will ensure that the
launching of the `slave.jar` will pick those changes as part of the launched
Jenkins agent

Fixes JENKINS-40291
  • Loading branch information
R. Tyler Croy authored and clguiman committed Dec 8, 2016
1 parent 4e76677 commit e0c852a
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -159,6 +159,15 @@ && executeRemoteCommand(session, "test -e ~/.azure-agent-init", logger) != 0) {
} else {
LOGGER.info("AzureVMAgentSSHLauncher: launch: init script got executed successfully");
}
/* Create a new session after the init script has executed to
* make sure we pick up whatever new settings have been set up
* for our user
*
* https://issues.jenkins-ci.org/browse/JENKINS-40291
*/
session.disconnect();
session = connectToSsh(agent);

// Create tracking file
executeRemoteCommand(session, "touch ~/.azure-agent-init", logger);
}
Expand Down

0 comments on commit e0c852a

Please sign in to comment.