I am trying to pull a repository using Jenkins, by default Jenkins create a long and unreadable workspace name. I am getting this error because of that :
Caused by: com.microsoft.tfs.core.exceptions.TECoreException: The
specified path, file name, or both are too long. The fully qualified
file name must be less than 260 characters, and the directory name must
be less than 248 characters.
Could any one please help me how can I resolve this issue, does adding any parameter in config file will help?
Found the solution, just add this argument in jenkins.xml and restart jenkins and issue will be resolved.
-Djenkins.branch.workspaceLocatorImpl.PATH_MAX=0
Anecdotal thoughts, but two options would be:
Ensure you check out the repo files 'closer' to the root of the underlying filesystem so the repo can contain longer filenames/paths (e.g. use C:\code and not something like C:\company\project\jenkins...)
Consider anything in your repo that is causing such a long filename - personally I've seen this when using NodeJS and the node_modules folder is tracked in source control, going multiple folders deep
Related
I have directory csv in context directory of docker build. I want to copy it into docker image in all circumstances (for empty directory in host an empty directory inside image is created, for nonempty directory in host it is copied with all content).
The COPY csv/* /csv/ gives COPY failed: no source files were specified error when the directory is empty.
Similar questions I found on SO are differing from my case in either setup or intention (multistage build, copying existing jar, certainly existing file) so I choose Q&A-style here rather than messing question with unrelated answer. This Github issue is also related.
The solution is to use
COPY csv/. /csv/
This question gave me a hint (although the behavior desired by me is unwanted for its OP).
I have changed our Jenkins setup from everything running on one machine to a master-agent/slave setup. Before that everything worked fine, now I am facing issues that some programs I am calling that access files can't find them.
Case 1:
(Pls don't ask why it is so complicated, but the file structure is given and I can't change it)
I am calling a python script, that iself calls a batch file
filepath= os.path.abspath(os.path.join(pamFolder, "run.bat"))
p = subprocess.Popen(filepath, cwd=pamFolder, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
... and the batch file again a jar file with the actual program
java -XX:-UseGCOverheadLimit -cp "../..;../../libs/*" -jar ..\..\myjarfile.jar
Within the jar file there is an access to a file on the disk failing with an error message that the file can't be found:
ERR : The file was not found in the specified path 'U:\somefile.txt'. Please check this path for access and your configuration!
Case 2:
I am calling a batch file from Jenkins that is calling some other exe and in the end trying to open a file in Excel via the COM interface. Here I am getting the following exception (Excel can't access the file):
Unhandled Exception: System.Runtime.InteropServices.COMException: Microsoft Excel kann auf die Datei 'D:\Jenkins\workspace\myJob\someDir\someFile.xlsm' nicht zugreifen.
Question
As previously mentioned, both jobs were working in the previous setup. Both files DO exist.
I suspect that Jenkins / the programs are trying to find the files on the master where they are not available.
Is there any way to tell Jenkins that the called tools are fully executed on the slave node or in some other way tell them where to find these files?
EDIT
The job is already running on the slave. The console shows Running on [slave name] in D:/Jenkins/workspace/xxxxx.
The master is configured in a way that only jobs assigned to it run on the master. So pretty much all jobs should run on the slave.
EDIT2 / SOLUTION
It turned out that the 2 issues are caused by different things.
Case1: Solved this by using the UNC path
Case2: Solved by a mixture of giving the necessary permissions as described here and starting the slave service with a user with admin rights.
From my experience with this issue, usually it has to do with your SCM setup.
But as you stated that the files DO exist I think there might be the possibility that U:\ is a network share? Then consider changing your path to use a UNC path.
If that's not the case check if your jenkins slave as sufficient user rights to access said file.
You can tell Jenkins to run the job on the designated slave as follows:
Under Nodes > [SLAVE] > Configure, specify a label for the slave.
Under [Job] > Configure > Restrict where this project can be run, enter the label.
Now when you build, the console output of the job should read correctly along the lines Running on [SLAVE] (build_agent_01) in C:/jenkins and the files must be accessible.
There's a problem with TFS everywhere plugin for Eclipse if I try to revert or restore a file under a source control and if the folder/file is mapped to a different volume than the actual project.
When I try to restore or revert it, I get an error:
java.io.IOException: Failed to rename /Users/*/*/*/*/.tf1/8/d54f18aa-bdce-4ab7-958a-01eaaf0c36c1.tmp to /Volumes/macOSData/*/*/*/*/*/some_file.cs. Check the file and directory permissions.
Log has additional line:
2018-07-31 12:44:39,814 WARN [ModalContext] (com.microsoft.tfs.util.FileHelpers) Main rename failed (source permissions problem?), trying to rename temp file back
There's no problem while I get specific version of the project, even with overriding existing files, so there permissions are fine, at least for getting files. Also, this does not happen when the file is on the same volume as the local TFS mapping.
Setting all permissions to 777 does fix the problem, but this marks all files with +x making them all "changed", making this solution unacceptable.
I tried mapping the base folder to a second drive (i.e. force creating a .tf folder on a second drive), but this doesn't help. The error will appear when I try to revert stuff on the main volume.
I tried using symlinks so the mapping stays within the same volume, but still no luck.
Is there any way to solve this? Or everything should be on the same volume?
After a whole day of digging around and poking with jshell, this appears to be a bug with File.renameTo() in Java on macOS. renameTo function silently fails without any exception even though there's no permission issue to write to the destination. This happens only when writing to a different volume.
I have submitted a pull request into TFS Everywhere repo on github with a workaround for this issue.
Anyone interested can compile plugin with this changes to get things working:
https://github.com/Microsoft/team-explorer-everywhere/pull/276
In my vNext-build-definition I added a new build step: "cURL Upload Files". After a little while playing around with the syntax of the URL and optional arguments I finally accomplished it to reach my sftp-server in the right target folder - the connection works so far.
But when cURL tries to start the upload the log simply says:
curl: Can't open 'my-Subfolder/Another Subfolder/myfile.txt'!
curl: try 'curl --help' or 'curl --manual' for more information
Unexpected exitcode 26 returned by tool curl.exe
With "buggy" I mean the way of selecting files in the definition of the build step without any assistance for the user: Try 1:I can easily select files over the "..."-button - I can browse the folder-structure of my repository and select a file. Feels very normal. The folder is then written into the textbox "Files" - but without double-quotes although it contains spaces... This runs into an error because cURL does expectedly not understand the folder Name.Try 2:
Then I added the double-quotes by myself, but still I get the error above.Try 3:
Then I tried the syntax **/myfile.txt
Ahaa, this actually works!!... but this uploads all files in all folders that are named myfile.txt (the log tells me something interesting: curl is called by using another syntax with curly brackets: {"complete-path/to/my/filename"})
just in case somebody of the tfs-dev-team reads this: Another senseless link is "More Information" at the bottom of the step definition. It leads to a topic "Deploy: Azure PowerShell" - that has nothing to do with FTP-Uploads and it´s content is just "This topic hasn't been written yet.." :-(
So, I ended up now with the following possibilities:
1. Use the syntax **/filename (if you can live with the drawback that all files in all subfolders of the repo with the same filename will be uploaded, so better keep your filenames unique!)
2. Use another build step before and copy or move the file into the root folder of the repo, in order to use the file name only in the "Files"-TextBox without path information.
3. Forget cURL-build-steps: Use WinSCP with a temporary script and run it with a batch-script-step(http://winscp.net/eng/docs/guide_automation) :-)
(The above mentioned syntax with curly brackets is useless for me because it forces me to have the whole path on the build agent included, I cannot use a relative path within my repo.)
Any better ideas?
I could reproduce your scenario on my side with TFS 2015 update1 + curl 7.47.0:
If the folder contains spaces, like Another Subfolder in your scenario, curl can't recognize it, we'll get error: curl: Can't open 'C:/agent/_work/xx/s/Another'!
If we use syntax **/myfile.txt, we'll get all files in workspace that are named myfile.txt.
But if we put the files under the folder whose name doesn't contain spaces, we won't get the error curl: Can't open 'C:/agent/_work/xx/s/Another'!, so you may consider create a new folder like AnotherSubfolder and put the files need to be copied under this folder, then you can use the whole path.
I'm converting my SVN repo into git (bitbucket) following this tutorial: https://www.atlassian.com/git/tutorials/migrating-convert/
But I keep getting this message when runing the command : git svn clone --stdlayout --authors-file=authors.txt --prefix=origin/
The answer is somewhat explained in the comment.
Similar issues are experienced on Windows system due to its
limitations like:
Some of the Windows APIs are limited to 260 symbols for file path name. So git can't create files with names longer than 260 symbols. NTFS file system actually supports longer names (32k).
Windows directory allows Space in between like my folder.
Windows file and folder names that begin or end with the ASCII Space (0x20) are saved without these characters.
Some of the Workarounds are:
Move the git directory closer to the drive, in order to keep the file name within 260 symbols.
Creating the whitespace directory manually using tools like FAR, GnuWinwhich can make a directory
Reference:
Support for Whitespace characters in File and Folder
git svn importing a branch with a trailing space
git checkout error: unable to create file