Remove hardcoded root path of a jenkins node

It turned out the root path for a jenkins node is hardcoded in
createJenkinsNode method

Change-Id: I668e8847a125f00c566eb495a2fe926cf9d76a7b
This commit is contained in:
nfedotov 2014-09-16 19:04:52 +04:00
parent 34335b5fbf
commit 59961c2d3a
2 changed files with 9 additions and 4 deletions

View File

@ -219,6 +219,7 @@ same name. Example::
setup: prepare_node.sh setup: prepare_node.sh
reset: reset_node.sh reset: reset_node.sh
username: jenkins username: jenkins
user-home: '/home/jenkins'
private-key: /var/lib/jenkins/.ssh/id_rsa private-key: /var/lib/jenkins/.ssh/id_rsa
meta: meta:
key: value key: value
@ -229,6 +230,7 @@ same name. Example::
setup: prepare_node.sh setup: prepare_node.sh
reset: reset_node.sh reset: reset_node.sh
username: jenkins username: jenkins
user-home: '/home/jenkins'
private-key: /var/lib/jenkins/.ssh/id_rsa private-key: /var/lib/jenkins/.ssh/id_rsa
- name: provider2 - name: provider2
username: 'username' username: 'username'
@ -248,13 +250,14 @@ same name. Example::
setup: prepare_node.sh setup: prepare_node.sh
reset: reset_node.sh reset: reset_node.sh
username: jenkins username: jenkins
user-home: '/home/jenkins'
private-key: /var/lib/jenkins/.ssh/id_rsa private-key: /var/lib/jenkins/.ssh/id_rsa
For providers, the `name`, `username`, `password`, `auth-url`, For providers, the `name`, `username`, `password`, `auth-url`,
`project-id`, and `max-servers` keys are required. For images, the `project-id`, and `max-servers` keys are required. For images, the
`name`, `base-image`, and `min-ram` keys are required. The `username` `name`, `base-image`, and `min-ram` keys are required. The `username`,
and `private-key` values default to the values indicated. Nodepool `user-home` and `private-key` values default to the values indicated.
expects that user to exist after running the script indicated by Nodepool expects that user to exist after running the script indicated by
`setup`. `setup` will be used only when not building images `setup`. `setup` will be used only when not building images
using diskimage-builder, in that case settings defined in using diskimage-builder, in that case settings defined in
the ``diskimages`` section will be used instead. See :ref:`scripts` the ``diskimages`` section will be used instead. See :ref:`scripts`

View File

@ -463,7 +463,7 @@ class NodeLauncher(threading.Thread):
host=self.node.ip, host=self.node.ip,
description='Dynamic single use %s node' % self.label.name, description='Dynamic single use %s node' % self.label.name,
executors=1, executors=1,
root='/home/jenkins') root=self.image.user_home)
if not self.target.jenkins_test_job: if not self.target.jenkins_test_job:
args['labels'] = self.label.name args['labels'] = self.label.name
if self.target.jenkins_credentials_id: if self.target.jenkins_credentials_id:
@ -1248,6 +1248,7 @@ class NodePool(threading.Thread):
i.reset = image.get('reset') i.reset = image.get('reset')
i.diskimage = image.get('diskimage', None) i.diskimage = image.get('diskimage', None)
i.username = image.get('username', 'jenkins') i.username = image.get('username', 'jenkins')
i.user_home = image.get('user-home', '/home/jenkins')
i.private_key = image.get('private-key', i.private_key = image.get('private-key',
'/var/lib/jenkins/.ssh/id_rsa') '/var/lib/jenkins/.ssh/id_rsa')
@ -1334,6 +1335,7 @@ class NodePool(threading.Thread):
new_images[k].setup != old_images[k].setup or new_images[k].setup != old_images[k].setup or
new_images[k].reset != old_images[k].reset or new_images[k].reset != old_images[k].reset or
new_images[k].username != old_images[k].username or new_images[k].username != old_images[k].username or
new_images[k].user_home != old_images[k].user_home or
new_images[k].private_key != old_images[k].private_key or new_images[k].private_key != old_images[k].private_key or
new_images[k].meta != old_images[k].meta): new_images[k].meta != old_images[k].meta):
return False return False