Cache and Artifacts support for PowerShell
Currently the cache and artifacts implementation relies on
curl in order to function correctly. As a consequence of this, the functionality is unavailable on PowerShell.
This is a pretty significant issue for us as most of our work is done targeting Windows and using PowerShell for builds.
tar requirement can be bypassed by making use of Go's built in
archive/tar writers. While you're implementing the writer, it would make sense to implement the reader and extract all of that functionality into its own helper.
You'd then need to add an extract command which would function the same way as the current archive command does, and switch to calling the
gitlab-runner executable instead of
tar for all compression/decompression requirements.
In addition to this, since the
gitlab-runner executable is rarely on the Windows path, it would make sense to use something like
filepath.Abs(os.Args) to get the executing assembly's full path and execute that instead on Windows.
Once that functionality is in place, you should have everything needed for caching support within PowerShell. Artifacts would require you to implement a means of uploading the file on PowerShell, as it doesn't include something analogous to
curl -F firstname.lastname@example.org out of the box. The easiest solution would probably be to change the API to directly accept the data as the body, rather than using multipart form encoding, and then do the following in PowerShell:
$WebClient = New-Object System.Net.WebClient $WebClient.Headers.Add("BUILD-TOKEN", "...") $WebClient.UploadFile($artifactsUploadURL, "POST", "artifacts.tgz")
This represents the following in CURL:
curl --email@example.com -H "BUILD-TOKEN: ..." -X POST