Skip to content

Commit

Permalink
ci: cache Arsenal Image Mounter files
Browse files Browse the repository at this point in the history
This commits add logic to cache files used to create a Windows RAM disk to avoid extra HTTP requests.
  • Loading branch information
alan-agius4 committed Jun 13, 2022
1 parent 595cefe commit 7293ccf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ jobs:
key: *cache_key_win
paths:
- ~/.cache/yarn
# Path where Arsenal Image Mounter files are downloaded.
# Must match path in .circleci/win-ram-disk.ps1
- ./aim
# Run partial e2e suite on PRs only. Release branches will run the full e2e suite.
- run:
name: Execute E2E Tests
Expand Down
34 changes: 19 additions & 15 deletions .circleci/win-ram-disk.ps1
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# Download AIM Drivers and validate hash
Invoke-WebRequest "https://github.com/ArsenalRecon/Arsenal-Image-Mounter/raw/988930e4b3180ec34661504e6f9906f98943a022/DriverSetup/DriverFiles.zip" -OutFile "aim_drivers.zip" -UseBasicParsing
$aimDriversDownloadHash = (Get-FileHash aim_drivers.zip -a sha256).Hash
If ($aimDriversDownloadHash -ne "1F5AA5DD892C2D5E8A0083752B67C6E5A2163CD83B6436EA545508D84D616E02") {
throw "aim_drivers.zip hash is ${aimDriversDownloadHash} which didn't match the known version."
}
Expand-Archive -Path "aim_drivers.zip"
$aimContents = './aim';

if (-not (Test-Path -Path $aimContents)) {
# Download AIM Drivers and validate hash
Invoke-WebRequest "https://github.com/ArsenalRecon/Arsenal-Image-Mounter/raw/988930e4b3180ec34661504e6f9906f98943a022/DriverSetup/DriverFiles.zip" -OutFile "aim_drivers.zip" -UseBasicParsing
$aimDriversDownloadHash = (Get-FileHash aim_drivers.zip -a sha256).Hash
If ($aimDriversDownloadHash -ne "1F5AA5DD892C2D5E8A0083752B67C6E5A2163CD83B6436EA545508D84D616E02") {
throw "aim_drivers.zip hash is ${aimDriversDownloadHash} which didn't match the known version."
}
Expand-Archive -Path "aim_drivers.zip" -DestinationPath $aimContents/drivers

# Download AIM CLI and validate hash
Invoke-WebRequest "https://github.com/ArsenalRecon/Arsenal-Image-Mounter/raw/988930e4b3180ec34661504e6f9906f98943a022/Command%20line%20applications/aim_ll.zip" -OutFile "aim_ll.zip" -UseBasicParsing
$aimCliDownloadHash = (Get-FileHash aim_ll.zip -a sha256).Hash
If ($aimCliDownloadHash -ne "9AD3058F14595AC4A5E5765A9746737D31C219383766B624FCBA4C5ED96B20F3") {
throw "aim_ll.zip hash is ${aimCliDownloadHash} which didn't match the known version."
# Download AIM CLI and validate hash
Invoke-WebRequest "https://github.com/ArsenalRecon/Arsenal-Image-Mounter/raw/988930e4b3180ec34661504e6f9906f98943a022/Command%20line%20applications/aim_ll.zip" -OutFile "aim_ll.zip" -UseBasicParsing
$aimCliDownloadHash = (Get-FileHash aim_ll.zip -a sha256).Hash
If ($aimCliDownloadHash -ne "9AD3058F14595AC4A5E5765A9746737D31C219383766B624FCBA4C5ED96B20F3") {
throw "aim_ll.zip hash is ${aimCliDownloadHash} which didn't match the known version."
}
Expand-Archive -Path "aim_ll.zip" -DestinationPath $aimContents/cli
}
Expand-Archive -Path "aim_ll.zip"

# Install AIM drivers
./aim_ll/x64/aim_ll.exe --install ./aim_drivers
./aim/cli/x64/aim_ll.exe --install ./aim/drivers

# Setup RAM disk mount. Same parameters as ImDisk
# See: https://support.circleci.com/hc/en-us/articles/4411520952091-Create-a-windows-RAM-disk
./aim_ll/x64/aim_ll.exe -a -s 5G -m X: -p "/fs:ntfs /q /y"
./aim/cli/x64/aim_ll.exe -a -s 5G -m X: -p "/fs:ntfs /q /y"

0 comments on commit 7293ccf

Please sign in to comment.