Jenkins is placed on remote machine. When I run tests via Jenkins I get error:
System.IO.DirectoryNotFoundException : Could not find a part of the path
But if I run tests on local machine It works ok.
Do you know why it might happened ?
Related
I have setup a Jenkins job to deploy our application to Jenkins. The build step runs a windows batch file on the slave machine which in turn invokes a powershell script to deploy our application to an on premise service fabric cluster. However, the job fails because it doesn't recognize Service Fabric commands. All other command work though.
Here is the content of the batch file that is invoked from Jenkins.
powershell -command "DeployRevCart.ps1 ; exit $LASTEXITCODE"
Below is the exception from slave machine
Running Connect-ServiceFabricCluster
The term 'Connect-ServiceFabricCluster' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Even this simplified batch command fails with same error.
powershell -command "Connect-ServiceFabricCluster"
However, if I run the script directly in the slave machine, everything works fine. So I appreciate any help in resolving the issue.
I'm trying to run kubectl commands inside jenkins pipeline but they are failing. Outside in powershell window they work fine but in the pipeline, they show this when doing:
kubectl cluster-info --v=99
I've tried adding --token $TOKEN (jwt generated) following some other thread's recommendation but didn't work. Anyone know why this is happening and any way to bypass it? All these commands work fine when ran outside the jenkins pipeline.
The problem was jenkins actually uses a different home directory and so even if your kubectl work in command line, it won't run if jenkins runs it from the pipeline as it doesn't have access to the credentials from the user directory.
So find your .kube config folder, usually in C:/users/ and then copy and paste that folder in the $JENKINS_HOME directory. The jenkins home directory can vary depending on how you installed it (for windows installers, it gets put in an obscure location inside System32). Once done, then jenkins will have access to the same certificates you use natively to run kubectl commands and it will have full access.
I already have all e2e tests written and they run successfully on my local machine and on the Codeship.
I want to move our CI from the codeship to Bitbucket pipelines. So I created my own Docker image with testing environment.
When I run docker conatiner in my local workspace, the tests work fine, but when build runs in bitbucket pipelines all the tests fail by timeout saying that angular can't be found on the page.
Server is definitely up and running in the container ant tests also start, but the problem is with pages opening.
Does anyone has any ideas about it?
If any code is required, I'll post everything that is needed.
So I managed to solve my issue.
Not sure if it can be useful to anyone else, but the problem appeared in my environment setup.
I forgot to add starting of webpack service that should generate some required server files and minified files of the server sources.
So server started successfully, but requesting the routes from the browser failed because it wasn't able to find requested files.
I have done the following
Create a slave Node
In the Labels field added Test
Save the node configuration
Created a new Job
Selected the options Restrict where this project can run
In the Label expression field added Test
Save the job
When i build the job, i get the error
java.io.FileNotFoundException: C:\Users\Administrator\Test\src\test\java\test\data\Project Suites.xlsx (The system cannot find the path specified)
Not Sure whats wrong, The folder does not exist in the slave machine but exist in the Master machine.
But if i run it using the master it works fine.
Hmm I dont understand the problem - you said it yourself, the file does not exist in the slave machine, and you're running jenkins on the slave. So of course its not going to find the file?
Just move the file to the slave machine and run the job on the slave?
I would say that my problem rather lack of information and I need some confirmation than a real problem. It seems somebody else had similar question question.
I put together a machine (Windows Server 2012R2) for POC reasons where a Jenkins installed and it executes Selenium UI tests using nunit. The nunit tests are generated by Specflow.
I could do:
install jenkins
jenkins run by a valid user not by Service account
set up jenkins properly
it can pull the source code from TFS-GIT
it can compile the C# solution
it can execute the test project
the test results are correct
Selenium plugin installed on Jenkins but I don't think it is used in this case because the text execution is about executing nunit and it deals with everything else.
At the moment I don't need the capability to delegate test execution to other Jenkins slaves or machines because the Jenkins does have only one compile task. Compiling, executing and test running can go parallel, the machine able to deal with it.
But, when I log in the server where the Jenkins runs and I watch what happens during CI build (compile and test execution) I can't see that the browser (Firefox) starts, however, the test results and the logs show that a browser was executed.
What I did so far:
jenkins runs as service, the account is an existing account
If I remote to the machine with the account which is set up for the service, then I can't see the browser will be executed, however, the log shows that something had happened.
My question is that, what the hack is happening when my tests are executed by Jenkins? If I execute the command which is used by Jenkins from console on the same machine then I can see that Firefox starts, does what is programmed in the tests and the results are in the result.xml. Can I accept the result as valid result? Can I somehow set up Jenkins the way the browser really executed (I can believe it when I see it :) )?
I think this is because you run Jenkins as a service. Services do not show up in desktop. Workaround is to run Jenkins or slave from CMD.
Jenkins windows slave service does not interact with desktop