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)
Related
I'm setting up some TFS build definitions. I see that once I run a build, the work is done within a subfolder of a subdirectory of /Agent/_work. It appears that the subfolder is the same between different executions of the same build definition, but I see no way to know in advance where I should expect TFS to set its working directory, nor do I see any way of specifying the name of the directory manually.
How does TFS determine what directory to use for the output from a build?
Refer to the documentation on build variables. The base folder can be accessed via the $(Agent.BuildDirectory) variable. The source folder is $(Build.SourcesDirectory).
You can't set this. It's determined by the agent's configuration.
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.
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.
In the Jenkins copy artifacts plugins, it follows ant includes attributes of fileset.
If I give Output/**/*
it copies everything including the Output folder.
How can I tell to copy only everything inside Output folder but not the Output folder iteself.
source: Output/v2.1/xxx/*.*
Destination:v2.1/xxx/*.*
The answer is, its probably not possible in copy artifact plugin.
But the same objective can be reachable by another plugin, called Artifact deployer plugin. In that plugin when you deploy the artifact to local or remote server, you can specify the base directory, so the artifact is copied from the base directory excluding the base directory. In this case if I specify my base directory as Output then it copies what is inside the output directory.
My build cannot pick up some of the projects in my application.
They are stored in their own projects in TFS source control.
I group them together in the Edit Build workspace;
These are the mappings:
The Build Agent folder does not let me simply put $(SourceDir). What is the impact of appending a folder name at the end as above?
How do I get the Build Agent to pick up the projects from the correct folder locations?
Currently I get these error messages;
8 error(s), 3 warning(s)
$/STAS/Timesheet/Timesheet/Timesheet.sln - 8 error(s), 3 warning(s), View Log File
C:\Builds\4\STAS\Timesheet\Sources\Timesheet\Timesheet.sln.metaproj: The project file "C:\Builds\4\STAS\Timesheet\Sources\Timesheet\..\..\..\..\StandardClassLibrary\StandardClassLibrary\StandardClassLibrary.csproj" was not found.
C:\Builds\4\STAS\Timesheet\Sources\Timesheet\Timesheet.sln.metaproj: The project file "C:\Builds\4\STAS\Timesheet\Sources\Timesheet\..\..\..\EmailMessageRecord\EmailMessageRecord\EmailMessageRecord.csproj" was not found.
This is exactly how the feature is meant to be used. The $(Sourcedir) macro is replaced by the Build Agent path (as configured on the Build Agent):
Whichever path is configured here is placed into $(Sourcedir) and whatever you additionally configure in the mapping is used to create the final destination.
So what happens is that these solutions will all be downloaded to their own sub directory under the build working directory. The only think you'll need to look out for is that relative paths between folders in source control or in your local mapping need to match up with the destination folder structure you choose int he build definition's workspace mapping.