TL/DR: In a release step, how do I find a .nupkg file that was definitely created in a build process and copy it to a drop folder for use in a release task?
Using TFS 2018, I am trying to copy a .nupkg file created in a prior Build task to the drop folder.
...In the Build Process...
From the log, I know that the file was created.
Successfully created package
'C:\agent_work\9\a\StaticHelpers.1.0.0.nupkg'.
What I am trying to figure out is how I can find this file and copy it to the drop folder. Using Build Variables for inspiration, I have tried the following. At first, I thought it was successful because of what the log said.
Source Folder: $(Agent.BuildDirectory)
Contents: *\*.nupkg
Target Folder: drop
Result:
found 1 files Copying C:\agent_work\9\a\StaticHelpers.1.0.0.nupkg to
drop\a\StaticHelpers.1.0.0.nupkg
All that means is that I can create a release process that takes that file and copies it in a copy release step, right?
...In the Release Process...
Not right. There is nothing in the drop folder when I created a copy file release task and tried to select the nuget package that was definitely created in the build. What I need to do is take that *.nupkg file created during the Build process and copy it to a network share.
So I tried to hard-code the folder based on what I copied from the build log.
Source Folder: drop\a
The release failed, showing this in the log:
[error]Unhandled: Not found SourceFolder: C:\agent_work\r4\a\drop
Either I am copying the file to the wrong location or I am reading from the wrong location. What folders do I need to use so that I can see the *.nupkg file in my release task?
In your build process, don't use a Copy Files task, use a Publish Artifacts task. That will publish an artifact "attached" to the build that a release will automatically pick up during deployment.
Related
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.
I have a web project that Jenkins is building perfectly and pushing to Octopus Deploy.
I now have an additional folder, with subfolders, e.g. Images, which I need to include.
This is not directly part of the .net build and we used to copy it manually afterward.
Do I need a specific plugin which I can use to select the folder to include?
Which plugin?
Where in the build process does this plugin run?
The build and deploy to octopus is done in one step -
where do I fit in this additional folder to be included in the push to the octopus?
This is not directly part of the .net build and we used to copy it manually afterward.
If your Jenkins server can access that addition folder in a shared path, add a pre-build step which, as an "Executable Windows batch command" step, would copy that folder into the Jenkins workspace.
No plugin needed here.
Once that is done, you would still need to modify Octopus accordingly, to take into account that new copied folder.
See:
"How to add a folder to a nuspec file"
"How to include directories recursively in NuSpec file"
I am new to jenkins and I have tried downloading a zip archive of this workspace in jenkins, but I only get a part of it. Source folders like tensorflow or tools are not present inside the archive. Is this normal ?
If so, how do I get all of them inside a zip file ?
Use Archive Artifact plugin, to add your workspace into archive folder which will make it easily down-loadable.
But be aware that, an artifact in the Jenkins sense is the result of a build - the intended output of the build process.
A common convention is to put the result of a build into a build, target or bin directory.
The Jenkins archiver can use globs (target/*.jar) to easily pick up the right file even if you have a unique name per build.
putting a complete workspace into it will take lot of time.
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.
I have two jobs in my Hudson configuration. Let's call them A and B.
Job A was created specifically to generate a folder application_home. This folder is a ready-to-be-used-in-installations-application-home-folder.
Job B is the "pack-all-together-for-installation-job". It needs to copy the application_home generated by job A to generate the installer. My problem is that after some investigation, I was not able to do this in a simple way.
I could use shell script, but then I would need to know job A path plus where its workspace is to get application_ home folder.
Is there a simpler way to do this?
EDIT
I know Copy Artifact Plugin. The problem is that it only copies artifacts. I need to copy the folder application_ home as it is, because it's already in the structure to be used in the installer. If there's a way to use this plugin to copy only the folder, I haven't found it.
EDIT 2. Answer:
Ok, you can do it using Copy Artifact Plugin. You need to
Set its configuration to "copy from WORKSPACE of latest completed build".
Set Artifacts to copy option the folder like this: target/application_home/**
Set Target directory to where you want to somethine like: installation_bundle_folder/application_home.
and it's done :)
You could try the Copy Artifact Plugin.
Then you could add a build step to "pack-all-together-for-installation-job" that would copy application_home to the packaging directory. There is an option to only include the latest stable build of Project A.
Another alternative is to have a post-build step for a successful Project A build that scripts the copy of the application_home over to where Project B will use it. You can use the WORKSPACE environment variable to get the absolute location. (See here for a list of environmental variables).