jenkinsci / openstack-cloud-plugin

Provision nodes from OpenStack on demand
https://plugins.jenkins.io/openstack-cloud
MIT License
47 stars 84 forks source link

How to change the username and userhome for the VM #292

Closed Xeuhua closed 4 years ago

Xeuhua commented 4 years ago

Hallo @olivergondza,

I am using the OpenStack Cloud Plugin 2.51 to launch instance automatically with a Windows Server 2019 image. It works no problem with the Maschine provisioning and connection with Jenkins automatically.

The problem is that this machine should connect to the network drive with a certain credential so that the Jenkins Jobs necessary data are possible with svn to check out. But my Jenkins Jobs failed always because the network drive cannot be reached with the current username: cloudbase-init.

Actually I have already in the image set up for a local user with name and credential. But it seems like that through this plugin generated new machine used default the username cloudbase-init and user.home is also C:\Users\cloudbase-init. I have also checked the other parameter on the Jenkins agent system information page. Under the list of the environment variables, I see the following Infos:

TEMP| C:\Users\CLOUDB~1\AppData\Local\Temp TMP | C:\Users\CLOUDB~1\AppData\Local\Temp UATDATA | C:\Windows\CCM\UATData\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77 USERDOMAIN | WORKER-1 USERNAME | cloudbase-init USERPROFILE | C:\Users\cloudbase-init

Do you know how can I change all of these default settings with cloud and cloudbase to my local user? Perhaps code in the UserData file? I have no idea about it and am looking forward to your reply.

olivergondza commented 4 years ago

@Xeuhua, I am quite far from a windows expert, please bare that in mind.

HTH

Xeuhua commented 4 years ago

Hi @olivergondza, Thank you so much for your reply! I have read the troubleshooting part in the readme.txt about userData and the link you have send.

Sincerely yours

olivergondza commented 4 years ago

@Xeuhua, this plugin (and even OpenStack to the best of my knowledge) is agnostic of the content of the "user data". The cloudbase-init is required inside the image to read and interpret it. I might be wrong, but I think windows cloudbase-init does not support #cloud-config userdata "dialect" (same as the one for linux would likely not support PowerShell, etc.).

Xeuhua commented 4 years ago

Hallo @olivergondza, #cloud-config userdata for windows are supported by the OpenStack Dashboard that I used. But this may be just a special case. Anyway, I solved the problem with Bach command net use with a pipeline. Thanks a lot for the answer.