Move artifacts files and folders to a one (release) folder - jenkins

What is the best approach/ plugin to move multiple files and folders to a new release folder? (I'm using the Jenkinsfile pipeline)
Case:
The next files/ folders need to be available in the release package:
Folder1\\SubFolder1\\bin\\Release\\*.dll
Folder1\\SubFolder1\\bin\\Release\\*.exe"
Folder1\\SubFolder1\\bin\\Release\\Resources\\**\\*.xml
Folder1\\SubFolder1\\bin\\Release\\**\\*.dll
I'm using the 'archiveArtifacts artifacts' command to create the artifacts. This seems to work, but I would like to create one folder which contains above defined files and folders.
Final expected result:
ReleaseFolder
-test1.dll (part of Folder1\\SubFolder1\\bin\\Release\\*.dll)
-test2.dll (part of Folder1\\SubFolder1\\bin\\Release\\*.dll)
-SubXmlFolder (part of Folder1\\SubFolder1\\bin\\Release\\Resources\\**\\*.xml - note: the \\**\\ is the SubXmlFolder)
-test3.xml (part of SubXmlFolder)
-test4.xml (part of SubXmlFolder)
-en-GB (part of Folder1\\SubFolder1\\bin\\Release\\**\\*.dll - note: the \\**\\ is the en-GB folder)
-test5.dll (part of the en-GB folder)

File Operations Plug providing many features for files and folders.
link: https://plugins.jenkins.io/file-operations

Related

Shared library cloned on build history and workspace

I have many jenkins jobs using a shared library
#Library('my_shared_library') _
On the folder of each build of each project using the library, there's a local copy of it, for example:
jenkins/jobs/my_project/jobs/builds/10/libs/my_shared_library
That means, it's copied on each build's history.
Plus, I see it also on the project's workspace, under:
jenkins/workspace/my_project#libs/my_shared_library
On this last directory there's sometimes several copies of this, like :
my_shared_library
my_shared_library#2
my_shared_library#tmp
...
Question is, is there some special way of handling this so that there'll be less copies? Or, why's there a copy on the project's workspace and one on the build history?
This ends up creating lots of files, which caused my jenkins to run out of inodes.

Prevent TFS of detecting packages contents in different folders

I've used .tfignore and Nuget.config solution to prevent tfs of detecting changes in packages folder, at the moment it is not detecting the packages folder changes anymore but whenever I add a new package or update the existing one it will detect the changes in possibly Scripts or Content folders. The problem is I cannot explicitly ignore the Scripts and Content folders because there are some custom scripts that have to be checked-in, what I would prefer is just somehow to ignore the scripts caused by package change?
You can ignore the specify files or include specify files in Scripts and Content folders. For example:
#Ignore .cpp files in the ProjA sub-folder and all its subfolders
ProjA\xxx.cpp
# Do not ignore .dll files in this folder nor in any of its sub-folders
!xxx.dll

Jenkins: Copying Artifact (directory) from one Job to another

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.

Publishing GulpJs minified/concatenated javascript via MSDeploy and Teamcity

Apologies if this question has been asked before. I have found variants on this theme but nothing that seems to fit our particular configuration.
We have developed a custom GulpJS task which parses a .json file located inside our folder assets/javascript. This json file contains an array of relative paths to javascript files (both our own and library) in a specific order for minification. They are then outputted to the folder assets/javascript/build and concatenated. The javascript source files are in the project but the minified and concatenated versions of the scripts, in fact the entire build folder itself, are not included in the Visual Studio project.
Ideally, I would like to have a step in the MSDeploy configuration which would copy all the files in the javascript build folder to the destination. Otherwise I could potentially include another step in Teamcity to do so.
Has anyone successfully instituted a similar build configuration and could share some insight? I tried using the MSBuild copy task but that didn't seem to copy the files to the output location. One option that I am considering is including the minified scripts in the project file but this might potentially trip up other developers who don't have Gulp running in their development environments (hilarious as that might be)

How does the build Agent Folder work on the Edit Build Workspace?

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.

Resources