Jenkins: Moving TCL script to a slave job - jenkins

I have move a Jenkins job from a Windows based Master to a system with a Linux Master and Windows slave. In fact, the system that was the master is now the slave, using Swarm. Most of my jobs work fine, but I have a problem executing a tcl script on the slave. I get the following error:
ERROR: Tcl execution failed: couldn't change working directory to "C:\slave2Workspace\workspace\SDB Projects\VE03FW": no such file or directory
Archiving artifacts
Finished: FAILURE
The path certainly exists on the slave. This gives me the impression that the tcl script is executing on the master even though the job is sent to the slave.
How can I get the script to execute on the slave? It does execute when run as the master in the "run tcl script" as the build step. The job configuration was copied from the Windows master to the new Linux master.

Related

The pipeline script written to tranfer the pipeline project from Slave to Master in Jenkins?Master(Windows server) and Slave(windows local)

In Jenkins, I have build a pipeline project on Master and given Agent label Slave in the script where the project is build. I want to transfer this build from Slave to Master. I am not able to find the script to transfer this process as i am using Windows for both master and slave.My Master is on Windows server(i.e. VM) and Slave is on Local Windows machine.Can someone please help me to find this as I am new for the Jenkins.

Jenkins Ranorex plugin not executing test

I am new to Jenkins. I have master and slave configuration done and I have installed Jenkins on my master and want to run my ranorex test on my slave machine. All files needed for running ranorex scripts are present on my slave. When the job from the master runs, it gives error
[2019/11/18 17:04:51.686][Debug ][Logger]: Console logger starting.
[2019/11/18 17:04:51.845][Failure][TestSuite]: This operation requires an interactive window station
[2019/11/18 17:04:51.858][Debug ][Logger]: Console logger stopping.
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
i tried workarounds like going to Jenkins serve and selection option of user interaction.
If i only have bat file on slave of copying one folder to another and if i trigger job from master, it works. So master slave configuration does not have issue. Issue is running Ranorex GUI Test on Slave.
Jenkins needs to be running as an application not a service (which is default). Services cannot show anything with a GUI nor interact with anything with a GUI.
Disable the Jenkins service
Run Jenkins via Command Line java -jar jenkins.war
For a more detailed guide, check out the Infrastructure section of the Ranorex Jenkins integration blog.

How to checkout and run pipeline file from TFS on specific node in Jenkins?

I am trying to run a pipeline job that get its' pipeline file from TFS but the mapping of the workspace and the checkout is done on the Master instead of the Slave.
I have Jenkins-master which is installed on a linux machine and I connected a windows machine as a slave to it. I created a pipeline job with 'Pipeline script from SCM' option selected for TFS.
How can I make the windows slave run that pipeline job?
The master can't run that job because it is running on linux and it fails when it is trying to map a workspace to TFS in order to download the pipeline script and run it.
Even if I create another pipeline job and select to hard-code a script to run my original pipeline job like this:
node('WIN_SLAVE') {
build job: 'My_Pipeline'
}
It doesn't work.
And I can see in the output that the initiali script (above) is in fact running on my windows slave, but when it's building the job 'My_Pipeline' it still tries to map a workspace to the Jenkins-master at it's linux machine path /var/jenkins/... and it fails.
If the initial pipeline script ran at the windows slave, why does the other pipeline script not running on the same node? Why is it trying again to checkout the pipeline file from TFS to the Jenkins-Master?
How can I make the windows slave checkout the pipeline file and run it?
Here are some things to check...
Make sure you disabled the original job, or you are completely redefining it for running on the slave, because you indicated you set up “another job” for the slave. It appears that this other job is just triggering the previous job, rather than defining its own specifications. When the job is ran on the slave, it’s just running whatever settings are in that original job.
Also, If you have the box checked to build when a change is pushed to TFS, then your original job could still be trying to run every time a change is made to TFS.
Verify the slaves Remote root directory is set properly in the slave configuration under Manage Jenkins -> Manage Nodes.
Since this slave job is triggering the other job you originally created on the master, then it will build on the master as expected.
Instead of referencing the My_Pipeline job, change the My_Pipeline job itself to run on the slave. If you are using a declarative Pipeline for the original job, then change that original job to run on the slave within the original job settings. You can do it similarly to how you have indicated above, just define the node in the original job.
If the original job is a freestyle project, there is a checkbox titled Restrict where this project can be run. Check that and include the name of the slave in the Label Expression. When you run the job, it will then be restricted to the slave.
Lastly, posting the My_Pipeline job will be helpful.

Run a windows batch job on jenkins slave

I am a newbie to the jenkins and trying to run a windows batch job in Jenkins slave. I can see the workspace with all the svn code in job but when am trying to access the command from the workspace folder , i am getting an error path not specified. this is because the Jenkins master is having workspace path as [workspace]/[jobname] where as in slave it is [jobname]/[workspace]. How can i identify the workspace path in jenkins master and run from the slave . please help!
Your not supposed to work on the master. You need to tell which slave your working on with the agent{ label 's1'} block. After, go see the Snippet Generator and check the Checkout function for your svn request.

How to copy build XMLs from Master to the Slave node in Jenkins?

I have created a Jenkins job which used to run in the master and I have the build.xml file in the master.
Now I have added a slave node and added the setting Restrict where this project can be run so that my job always runs on a particular slave.
Now my build jobs are failing and I can see:
[EnvInject] - Loading node environment variables.
Building remotely on demo_slave_inst2 (slave1) in workspace /root/slave/workspace/demo_job
FATAL: Unable to find build script at /root/slave/workspace/demo_job/autobvt.xml
Build step 'Invoke Ant' marked build as failure
Recording test results
Finished: FAILURE
This autobvt.xml file already exists in the master. So looks like I need to copy this file over to the slave node manually which does not looks like quite handy.
How I can instruct jenkins to copy this as part of the build?
Use "Copy data to Workspace" http://wiki.jenkins-ci.org/display/JENKINS/Copy+Data+To+Workspace+Plugin using which you can copy the files from master to slave and run them as a part of build process (No manual effort needed!)
I sorted the issue using the Copy to Slave plugin.

Resources