As part of my build, I want to map a sub folder to a fixed folder on the c:\ drive.
The problem is when I try and map it, I get this :
How can I change the local path on 1 item to not be prefixed with $(build.sourceDirectory)?
A file path input (has ...) defaults to relative paths.(In Mappings, it is Server Path) A relative path is relative to the root of the repo in build and root of artifact downloaded in RM. Build sources directory happens to point to the root of the repo.
So the Local Path is prefixed with $(build.sourceDirectory). It's by designed. You can't change the local path on 1 item to not be prefixed with it.
In your situation, the fixed path clearly should be out of the path on the build agent where your source code files are downloaded. So suggest you to use the copy files Task to achieve what you need. However, you may have to set the fixed path as an UNC shared path.
Update
After go through the extension info, seems the copy task is the only solution for now. And you could add a powershell script, after the first copy , compare the sub folder in TFS server with the fixed path. Then you just need to copy the new add things in the sub folder to the fixed path.
Related
I would like to speed up the process of creating folders, I have a template folder with subdirectories that I use often and every time I have to go there in the path where the template folder is and copy it to start a new project.
The thing is, I thought of creating an environment variable that would do this for me, the variable would execute a command like this robocopy "%~d0\model folder\" "%cd%" /e
That is: copy the contents of the model folder path that is on that same drive and paste it in the folder where this command prompt is open.
Obviously this doesn't work, because if the command prompt is already open in a folder it won't be able to access the source path to make the copy...
Any idea how I could make it work?
In a build, we have Copy files from the task. The problem we have is the source folder itself is copied to the destination. We'd want the contents of the source folder to be copied to the destination folder, not the folder itself. Is there any way to do that?
I tried a wildcard but that doesn't work. It seems it needs a path itself. An issue of this could be that the source is named 'X' but the destination is named 'Y' (it was setup before this build and IIS is pointing to this folder). Can we have the source folder be renamed in the build maybe?
That would be name_of_sourcefolder\**\* for all files and subfolders of just name_of_sourcefolder\* for all files.
This has to be set in the Contents part of the task.
I have TFS2018 server and a separate build server. When I try to build I get the following error during the get sources step:
Exit code 100 returned from process: file name 'tf', arguments 'vc workspace /new /location:local /permission:Public ws_1_1 /collection:https://mydevtfs/tfs/DefaultCollection/ /loginType:OAuth /login:.,****** /noprompt'.
The root mapping looks like this. But all subfolders inside MyProjectFolder are empty. Any idea how to specify the path so the files will be included within the subfolders as well?
Here is a screenshot of the last part of the log
The issue may related to the workspace mapping, doulce check the source mapping of your build definition. You could give a try with solution Error When Setting Clean = True on Windows
Looks like scorch is failing when the root sources folder (e.g.
_work\1\s) is not mapped - i.e. workspace does not contain a root mapping.
One not great workaround is to set a variable build.clean to all.
Another workaround is create a mapping for the root such as $/projectroot/*and keep the Local path field blank. This will only download single level folders as empty below the project root.
update
I have a spec file in Jenkins uploading artifacts to Artifactory repository path test-local/web/develop/web-DEVELOP-12/ where 12 is the build number from Jenkins.
All artifacts are uploaded under web-DEVELOP-XX. I would like this folder to have the same properties as the artifacts such as vcs.revision, build.timestamp, build.name, build.number. Here I only get those properties in the artifact files under web-DEVELOP-XX folder, but I would like to also have those properties to the folder web-DEVELOP-XX.
Is it possible to do this from Jenkins?
you're correct that currently Properties set using a file spec are not set on the root folder.
you can add (at the end of your current set props) a simple curl command to set the properties on the folder.
For ex, this will set a property a=b on "all-my-frogs" folder under my-local-repo repository:
PUT http://rtserver:port/artifactory/api/storage/my-local-repo/all-my-frogs?properties=a=b&recursive=0
note: recursive=1 will set the properties on all files under the folder as well as the folder itself, so you can consider that as your solution (instead of spec)
in Jenkins, I have a job downloadAgents that is responsible of creating a folder and populating it with some files. Then the folder is saved as an artifact with the following folder structure
dev\downloadAgents\target\dependency\ios
Then I need to copy the contents of the ios folder into the workspace of another job (into a specific folder).
I have added the Copy artifacts from another project step. And it does copy the artifacts, but it copies the full path
\dev\downloadIosAgents\target\dependency\ios
How can I tell jenkins to copy only one folder ios and everything that is inside it and, do not copy all folders that are before ios.
Also if there are already files in the destination folder, will it merge the 2 folders?
You can use regex for your copy (under "Artifacts to copy")-
dev\downloadAgents\target\dependency\ios***.*
** - all folders under ios
*.* - all file types
You can also specify the target directory, and you also have a flag for "Flatten directories". This will move all the files without the hierarchy of the folders (flat to your target directory)
Feel free to look at the plugin's home page:
https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin
In CopyArtifacts plugin specify the pattern: \dev\downloadIosAgents\target\dependency\ios\*.* or \dev\downloadIosAgents\target\dependency\ios\** - I don't remember exactly.
That should do the job.