I would like to get a zip file with artifacts.
The archiveArtifacts directive in Jenkinsfile will save each artifact,
but when you download it you will get a zip files with original paths in it.
Is it possible to avoid original paths with a directive or am I obliged to
run a script that callects all artifacts in one single folder in the workspace and zip the folder then?
Related
During a Release pipeline I need to download a Storage Table content before deleting the resource, but I don't know which path I can save the files to.
I can't save to another Azure resource, more like a Pipeline output, or like the files generated by the Tests.
I tried saving to something like $(Build.ArtifactStagingDirectory) but no success
You can add a Copy Files task to copy the files to $(Build.ArtifactStagingDirectory) first, then publish them to build artifacts using Publish Build Artifacts task.
You can also copy the files to a file share (UNC path like \\sharefolder) if it's an option.
My build job produces various artifacts, they are based on parameters but not directly computable from them. The artifacts are undetermined until the build steps complete.
Upon build steps completion, the newly created artifacts' file names are located in the designated file (known in advance)
I want to archive the artifacts by specifying their file names in that file. How can I do it?
P.S. From what I know, the "Archive the artifacts" step specs are similar to includes attribute of Ant fileset. I need something like includesfile.
You can read the file with the readFile step, and convert it to the format expected by archiveArtifacts (comma-separated String of items). E.g.:
String artifacts = readFile(file: 'artifacts.txt').split('\n').join(',')
archiveArtifacts artifacts
I was able to workaround the issue:
Add post-build script step (before archiving artifacts). In it: iterate over file names in the file, copy each to the designated (empty) folder
Configure the Archive artifacts step to take all files from that designated folder.
The problem is the folowing:
I have two jenkins jobs A and B.
In the A job, I use the post-build Action: Archive the artifacts, to Archive 4 .jar files: the problem is that, unlike only archiving one file, the folder archive zips: so archive is archive.zip and inside that zip I have the 4 jars.
The in B I use the Copy Artifact Plugin to copy the artifacts from A to B and the error is the folowing:
Unable to access upstream artifacts area C:\***\builds\15\archive. Does source project archive artifacts?
ERROR: Failed to copy artifacts from 1PrepareAndCompileSquemas with filter: *.jar
The *** are folders in the middle.
If I take the archive.zip file, i unzip it and Y put in a folder called archive in the same path, the jobs works correctly so the problem is that when at A I save the artifacts those are saved to a .zip file
there is any way to save this artifacts without ziping the archive folder?
The problem was because I have configurated an option to compress the artifacts at Global confiiguration
I want to copy a complete directory (with all subdirectories) from a workspace in a job a into another job b's workspace.
I try with artifact but I don't find a way to copy all subdirectories and there is no option to preserve directory structure.
For artifact archiving, use **/* to copy all workspace files and subdirectories
For the Copy Artifacts step in other job, you can leave it blank to copy all artifacts, or you can use **/* syntax again
If the directory is very large or has a lot of files, it might be better to archive the source workspace directory using something like zip and archive the resulting zip file. Jenkins is notoriously slow at archiving artifacts, so even though you should be able to do it all with individual files, I myself have found moving a single (often much smaller) zip file has much better performance.
I've just started using Jenkins and need some advice.
After a successful build I would like to have the resulting directory packaged into a zip file and stored in workspace so later I can send to Artifactory.
At the moment I'm using a program that I wrote for that purpose which I run in a batch file as the last step of a build, but I wonder if there is a way of having Jenkins do that.
The file operations plugin has a zip operation.
Used with ${GIT_BRANCH} to create a zip file of the successful build.
https://wiki.jenkins.io/display/JENKINS/File+Operations+Plugin
I you use a pipeline job (wheter that's declarative or scripted) you can use the zipFile step and give it the directory path that you want to be zipped.
https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#zip-create-zip-file