In version 220.127.116.110 of Continua CI, we have added new archiving functionality to the workspace and repository rules.
Builds can generate a lot of output files: binary library files or report files, for example. Copying a large number of these files back to the server at the end of the build can take time. Manually downloading each individual artefact from the server can be a tedious task, so compressing these files into a handy bundle makes sense.
Previously, you would have needed to use actions, such as the Seven Zip action, in your build stages to zip these files. The compression can now be performed as part of the agent-to-server workspace rules.
To compress a set of files in the agent workspace to an archive in the server workspace, specify a file with a zip extension on the left-hand side of a agent-to-server workspace rule.
Libraries.zip < Output/**.dll
Note that the all the usual operators are taken into account when compressing files so, in the above example, the directory structure is preserved. Likewise, using the <- operator will cause all matching files to be flattened into the root folder of the zip file.
Doubling up with the << operator will delete any existing zip file before compressing to a new file. Without the << operator, multiple sets of files can be added to the same archive file.
Reports.zip < Output/**.html
Reports.zip < Output/**.css
You can also compress files into subfolders within the zip file using the new : operator
Reports.zip:/css < Output/**.css
Once files have been compressed at the end of one stage, you may need to access the contents of zip files in the next stage. Additionally, you may wish to unpack a zip file from your repository at the start of a stage. The : operator facilitates the extracting of zip files in server-to-agent workspace rules and repository rules.
To extract a set of files from an archive in the server workspace to a folder in the agent workspace, specify a file with a zip extension on the left-hand side of a server-to-agent workspace rule. Ensure that you follow the ‘zip’ with a : operator, otherwise the zip file will just be copied.
Libraries.zip: > Libraries
This also works for repository rules.
$Source.MyRepo$/Documents.zip: > Docs/Main
Note that the all the usual operators >, >>, -> and --> have the same meaning when extracting files as they have when copying file; signifying whether to preserve the directory structure within the zip file and whether to empty the destination folder.
You can also specify a pattern after the : operator, allowing you to filter the extracted files.
Libraries.zip:/plugins/**.dll > Libraries/Plugins
$Source.MyRepo$/Documents.zip:**.md > Docs/Markdown
See the Workspace Rules documentation for further details on the new archive rules syntax.