Skip to content

Instantly share code, notes, and snippets.

@snallami
Last active August 29, 2015 14:05
Show Gist options
  • Save snallami/16bb02ba58e0b79e89db to your computer and use it in GitHub Desktop.
Save snallami/16bb02ba58e0b79e89db to your computer and use it in GitHub Desktop.
Debug JNLP connectivity issues for azure slave plugin
Following tips may help to debug issues with JNLP launch method from Jenkins
for Azure slave plugin.
1) If using custom image, make sure that custom image does not already contain
custom script extension i.e. while creating VM from platform images don’t
enable custom script.
2) Check if custom script got executed or not.
We can check in two ways.
a) Go to C:\Packages\Plugins\Microsoft.Compute.CustomScriptExtension\1.1\Status
and see if there is any error for the recent status.
b) Check for clues for the actions of custom script. i.e. if custom script is
supposed to create folders and download some content,
check if those folders are created or required files are downloaded.
In case of default script, it creates a folder c:\azurecsdir, so check if that
folder is present and also verify date created to verify that Custom script
got executed after new slave is provisioned.
c) Redirect output from script and check.
3) Check if script has any issues using below steps
a) From portal , create virtual machine by selecting platform image or
custom prepared image.
b) Go to manage Jenkins --> manage nodes --> new node --> give any name (e.g. VMTest)
--> select dumb slave and click ok and in next page, for Remote root
directory provide value “c:\jenkins”
click on save
c) Note down Jenkins server URL(Manage jenkins --> configure system -->
Jenkins Location-->Jenkins URL) , suffix forward slash if one is not already present.
Make sure URL is reachable from slave machine.
d) Make sure TCP port for JNLP slave agents is set to fixed.
(Manage Jenkins --> Configure global security --> Enable security
--> For TCP port for JNLP slave agents select fixed).
In case if jenkins master is there in azure, make sure to add endpoint for TCP
port for JNLP slave agents.
e) RDP to newly created virtual machine and
If Jenkins is configured with security take script from
https://gist.github.com/snallami/5aa9ea2c57836a3b3635 and make sure to edit
script to provide values for username and apitoken.
You can get api token in Jenkins by clicking on username --> configure -->
API token --> show API token
else take script from https://gist.github.com/snallami/121a305ab7fd96c516fd
or you can use your own script.
Save script in virtual machine, let’s say slave.ps1
f) Open command prompt in admin mode and execute below command and see if you
are able to connect to master.
powershell -ExecutionPolicy Unrestricted -file <fileName> <jenkinsURL> <vmName>
e.g. powershell -ExecutionPolicy Unrestricted -file slave.ps1 http://jenkinsurl.cloudapp.net/ VMTest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment