I’ve been working with a RemoteX version of the Continuous Delivery pipeline that is available at github. At RemoteX we have all our deployment done using PowerShell so to maintain as much familiarity as possible between builds and deploys were using the PowerShell plugin for Hudson (Jenkins).
The set up that we are working towards is this. The CI builds creates output. There is a packaging build that takes the CI output and creates a deployable package and that starts the rest of the pipeline. You can see the structure as it is outlined in the github project.
Now from the package I want a zip file as the delivery. It’s suiting to have an archive as an artifact that is tested and added on in the later steps of the pipeline.
The trouble is that PowerShell has no simple available command-line functions for creating and managing zip files. Not out of the box. In fact any archiving would be appreciated.
These are the solutions I looked at for working with zip-archives using PowerShell:
- David Aiken did an article on how to compress zip files in PowerShell using COM interop. - This didn’t work out for. The size and amount of files in our archive was simply to much, a bunch of popup started to popup with read/write access issues to the zip-archive.
- Another example I found was using .Net and ICSharpCode.SharpZipLib to create zip files. - This solution caused a lot of problems when I tried to dot-source the PowerShell files. The path to the dll screwed up and I didn’t want to introduce any hardcoded paths.
- Another solution is to use the Community PowerShell Extensions. These extensions have a lot of options for common tasks, one of them being the handling of zip-files. - This wasn’t an option to us since it would require the entire extension suite to be checked in in source-control. I didn’t want to have our delivery pipeline reference an entire collection of functions for just working with zip files.
Last solution was to introduce 7zip’s command line program for managing zip-files. I tried GZip first but there were issues with file system access on Windows 7. - To us this was a perfect fit. It turned zip-handling into one line commands and there were not issues with dot-sourcing in PowerShell. - I checked it in under hudson/bin to keep a collection of tools that we use with our pipeline.