Jenkins on Windows can't see folder names prefixed with a '.' - windows

So I'm still fairly new to Jenkins (on Windows version 2.10) but and I'm completely lost as to why I'm failing to see folders prefixed with a period. Basically I spent most of my day trying to figure out why script was failing when run from Jenkins but not when I ran it myself and it was failing because it couldn't find a file that clearly exists but was behind a folder with with a . in front of it (ex 'C:\Temp.Tacos').
I've gone to the Jenkins CLI and tried running commands like this
print "cmd /c dir C:\Temp".execute().text
and have it not list the folder despite it listed as expected outside of Jenkins. What's going on here and is there an easy way to fix it?

Related

Maven isn't installing properly

I've tried everything I could find on this topic, yet I'm not able to install Maven.
I'm at the following point:
I have java installed
I unzipped the files from the apache website
I have set up environment variables and added requirement parameters to the path (had to use the escape character in the path, because of the space in Program Files folder name: C:\Program^ Files\apache-maven-3.6.3)
what could be the problem?
cmd
From the attached image all requirements are OK. Try one of those two solutions:
Close the CMD window and reopen it (if you didn't this already).
Restart your computer in in order to apply the environment variables you've just added.

All my Jenkins jobs and configs have disappeared after restart of my Mac

After updating macOS to Mojave (10.14.4), my Mac was restarted and upon opening Jenkins (at localhost:8080) it appeared that I've lost all my jobs and the entire system configurations.
There was only 1 user (admin) defined in my installation and my usual password was deemed invalid, when I tried to log back in. So, I tried entering another password I normally used and it was accepted. I then found that all my jobs and configs have disappeared. It looked as if I've just started Jenkins for the first time.
Looking through here on StackOverFlow, there were suggestions to check the JENKINS_HOME variable to find out where the jobs are saved on the disk, but when I typed export $JENKINS_HOME I just get an empty response. So, it looks like I've never configured it during set up.
I then dig through the hard drive and found the folders matching the names of the jobs I created under ~/.jenkins/workspace. However, the contents of all the folders are empty. I was expecting to see the usual files, e.g. build.xml, config.xml, etc.
I then did a global search for build.xml and config.xml on Mac Finder it turned up nothing.
Any idea where my jobs went and what could have caused all the contents of the folders of the jobs to be empty?
You can find your Jenkins installation directory in "Manage Jenkins" -> "configure System" --> "Home directory". Find what was the Jenkins home before you restart MAC. It looks like your home directory is either deleted by you or you are pointing to new folder now. Set it to earlier folder.
If can help,
I'm having a similar problem.
The curious part is about the new directory after the service restart ".jenkins" directory inside :
'/var/root/'.
And now, the password that Jenkins request me is not from
'/Users/username/.jenkins/secrets/initialAdministratorPassword' but from the newst one with same path pattern.
Simon

Running .bat commands on a Jenkins slave with restricted execution permissions

I am running a Jenkins slave on a restricted environment. This environment will only allow me to execute files in a specific directory.
The problem I have is running simple batch commands.
The slave's java.io.tmpdir being AppData/Local/Temp, jenkins will copy my command in a temp bat file and attempt to run it, like such:
cmd /c call D:\Users\TastyWithPasta\AppData\Local\Temp\hudson8090039221524722157.bat
Here the issue becomes obvious, the command cannot be run due to restriction and the build fails.
Anybody working in a restricted environment and facing the same issues? What would be a good workaround?
Unfortunately, -Djava.io.tmpdir=newpath is not an option since this taps into the Java installation. Maybe there is a way to override it locally?

How to run bat file in jenkins

My jenkins is installed in C:\Program Files (x86)\Jenkins
bat file is located in C:\Users\Admin\workspace\demoWork\run.bat
When i run this bat file from cmd everything works fine. But when i try from jenkins executing batch command as mentioned in Image, Jenkins displays error as
Build step 'Execute Windows batch command' marked build as failure
Also inside jenkins folder automatically workspace folder gets created with Job title name. Can you guys please explain me in detail
Tatkal, you can't execute a command like in your image,
why don't you simply try
C:\users\admin\workspace\demowork\run.bat
or
call "C:\users\admin\workspace\demowork\run.bat"
"Also inside jenkins folder automatically workspace folder gets created with Job title name. Can you guys please explain me in detail" -
Jenkins creates folder with job title name automatically, saves jobs data and other build info... this is how it works. By default in jenkins job you can access your workspace using $WORKSPACE variable
You have put very little detail into this so I'm going by pure guess..
The Execute Windows batch command is to literally execute code, not execute a file.. to execute the file you could use this command :
start cmd.exe /c C:\myprj\mybat.bat
or you could take the contents of the .bat file and rewrite in in that command line..
The way Jenkins works is it creates its own workspace for each job, essentially to sandbox the environment, its a testing framework so it should be used to stage changes to code, which will then be pushed to your live(working) environment. People use it to automate some tasks, but this isnt the primary use of Jenkins.. if the above doesn't help you let me know more details of the error and I can try help you with it.
node {
bat 'D:\\gatling-charts-highcharts-bundle-3.0.2\\bin\\gatling.bat'
}

Doxygen not running when started with the Windows task scheduler

I've started using Doxygen to document my team's project source code (we have C#, Objective-C, and Android/Java projects). I wrote up a Windows batch script which checks out the latest trunk versions of each project and uses the command-line Doxygen to generate HTML documentation sites and publish to a directory on the local file system which IIS 7 already hosts. This batch script works perfectly and does everything it needs to, though it takes 10 - 20 minutes to run completely.
Now I'm trying to automate the process so that it will run at the end of every day. I added a scheduled task which simply runs the batch script. Every part of the script seems to work except for the Doxygen part. I can log into the machine and watch the file system and see that working copies are being checked out with no problem and the cleanup stuff works. However it never generates the Doxygen HTML output. The output/target directories Doxygen is configured to use will stay empty every time. I'm finding no error messages of any kind (in Scheduled Tasks and eventvwr). It doesn't work whether I let the task scheduler start it on its own or I tell it to run the task now. As said earlier, I can double-click the batch file and run it normally and everything works fine that way.
The process is done on our development server, it's an older Dell workstation running Windows Vista Business 32-bit. I have the scheduled task running on the "System" account though I have also tried "Local Service" and my own Active Directory domain account (which is an administrator on this server) and it still doesn't work.
Has anyone else successfully used the task scheduler to automate Doxygen? I have no idea what I'm doing wrong. What should I look for next?
I can post slightly anonymized versions of my batch file and Doxygen config files if necessary.
In your batch file, try adding redirection of the doxygen output to a log file. Then run it through the scheduler and see what output was generated. If doxygen encounters an error when run that way you should see it in the log file.
doxygen doxyfile > doxygen.log 2>&1
Also make sure that your bat file runs correctly, even if invoked from another directory than the one where the doxygen stuff resides. When run through the task scheduler, I think that the current directory will be c:\windows\system32, so try this:
c:\windows\system32>c:\path\to\batchfile\mybatch.bat
If that gives path errors you have to fix them.

Resources