Skip to content

Commit

Permalink
Revert "Build arm64 MSI packages additionally to the current amd64 on…
Browse files Browse the repository at this point in the history
…es (#482)" (#486)

This reverts commit ee25760.
  • Loading branch information
chris-rock authored Oct 30, 2024
1 parent bfde2f9 commit 843a783
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 65 deletions.
69 changes: 29 additions & 40 deletions .github/workflows/pkg_msi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,12 @@ jobs:
echo "trimmed_version=$(echo ${V} | sed 's/-.*//')" >> $GITHUB_OUTPUT
- name: Ensure version of cnquery and cnspec are available
run: |
curl -sL --head --fail https://github.com/mondoohq/cnquery/releases/download/v${{ steps.version.outputs.version }}/cnquery_${{ steps.version.outputs.version }}_windows_amd64.zip \
https://github.com/mondoohq/cnspec/releases/download/v${{ steps.version.outputs.version }}/cnspec_${{ steps.version.outputs.version }}_windows_amd64.zip \
https://github.com/mondoohq/cnquery/releases/download/v${{ steps.version.outputs.version }}/cnquery_${{ steps.version.outputs.version }}_windows_arm64.zip \
https://github.com/mondoohq/cnspec/releases/download/v${{ steps.version.outputs.version }}/cnspec_${{ steps.version.outputs.version }}_windows_arm64.zip
curl -sL --head --fail https://github.com/mondoohq/cnquery/releases/download/v${{ steps.version.outputs.version }}/cnquery_${{ steps.version.outputs.version }}_windows_amd64.zip
curl -sL --head --fail https://github.com/mondoohq/cnspec/releases/download/v${{ steps.version.outputs.version }}/cnspec_${{ steps.version.outputs.version }}_windows_amd64.zip
dist-prepare:
name: 'Prepare Distribution for Packaging'
strategy:
matrix:
arch: ["amd64", "arm64"]
runs-on: ubuntu-latest
needs: setup
steps:
Expand All @@ -74,27 +69,24 @@ jobs:
VERSION: ${{ needs.setup.outputs.version }}
run: |
# TODO: We should check the sums here
mkdir -p dist/${{ matrix.arch }} && cd dist/${{ matrix.arch }}
curl -sSL -O https://github.com/mondoohq/cnspec/releases/download/v${VERSION}/cnspec_${VERSION}_windows_${{ matrix.arch }}.zip
unzip cnspec_${VERSION}_windows_${{ matrix.arch }}.zip
rm cnspec_${VERSION}_windows_${{ matrix.arch }}.zip
curl -sSL -O https://github.com/mondoohq/cnquery/releases/download/v${VERSION}/cnquery_${VERSION}_windows_${{ matrix.arch }}.zip
unzip cnquery_${VERSION}_windows_${{ matrix.arch }}.zip
rm cnquery_${VERSION}_windows_${{ matrix.arch }}.zip
mkdir -p dist && cd dist
curl -sSL -O https://github.com/mondoohq/cnspec/releases/download/v${VERSION}/cnspec_${VERSION}_windows_amd64.zip
unzip cnspec_${VERSION}_windows_amd64.zip
rm cnspec_${VERSION}_windows_amd64.zip
curl -sSL -O https://github.com/mondoohq/cnquery/releases/download/v${VERSION}/cnquery_${VERSION}_windows_amd64.zip
unzip cnquery_${VERSION}_windows_amd64.zip
rm cnquery_${VERSION}_windows_amd64.zip
ls -lh
- name: Upload Distribution
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.arch }}
path: dist/${{ matrix.arch }}
name: dist
path: dist


msi-build:
name: 'Packaging: Windows MSI'
runs-on: windows-latest
strategy:
matrix:
arch: ["amd64", "arm64"]
needs: [ setup, dist-prepare ]
# For Version: ${{ needs.setup.outputs.version }}
steps:
Expand All @@ -103,8 +95,8 @@ jobs:
- name: Download Distribution
uses: actions/download-artifact@v4
with:
name: dist-${{ matrix.arch }}
path: dist/${{ matrix.arch }}
name: dist
path: dist

- name: Setup Certificate
shell: bash
Expand Down Expand Up @@ -139,19 +131,19 @@ jobs:
run: |
$mondooVersion = ${env:VERSION}
echo "Running build job for version ${mondooVersion}"
Copy-Item .\dist\${{ matrix.arch }}\cnquery.exe .\packages\msi\msi\
Copy-Item .\dist\${{ matrix.arch }}\cnspec.exe .\packages\msi\msi\
Copy-Item .\dist\${{ matrix.arch }}\cnquery.exe .\packages\msi\appx\
Copy-Item .\dist\${{ matrix.arch }}\cnspec.exe .\packages\msi\appx\
Copy-Item .\dist\cnquery.exe .\packages\msi\msi\
Copy-Item .\dist\cnspec.exe .\packages\msi\msi\
Copy-Item .\dist\cnquery.exe .\packages\msi\appx\
Copy-Item .\dist\cnspec.exe .\packages\msi\appx\
# build msi package
echo " - Packaging MSI..."
Set-Location -Path '.\packages\msi\'
./package.ps1 -version $mondooVersion -arch ${{ matrix.arch }}
./package.ps1 -version $mondooVersion
# sign msi package
echo " - Signing MSI..."
Set-Location -Path '.\..\..'
signtool.exe sign /debug /sha1 ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 .\packages\msi\mondoo_${{ matrix.arch }}.msi
Copy-Item '.\packages\msi\mondoo_${{ matrix.arch }}.msi' '.\dist\${{ matrix.arch }}'
signtool.exe sign /debug /sha1 ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 .\packages\msi\mondoo.msi
Copy-Item '.\packages\msi\mondoo.msi' '.\dist\'
- name: Dump Signing Log on Failure
if: failure()
run: |
Expand All @@ -166,20 +158,17 @@ jobs:
- name: Cleanup dist before upload
run: |
Remove-Item -Path .\dist\${{ matrix.arch }}\cnquery.exe -Force
Remove-Item -Path .\dist\${{ matrix.arch }}\cnspec.exe -Force
Remove-Item -Path .\dist\cnquery.exe -Force
Remove-Item -Path .\dist\cnspec.exe -Force
- name: Upload Distribution
uses: actions/upload-artifact@v4
with:
name: msi-${{ matrix.arch }}
path: dist/${{ matrix.arch }}
name: msi
path: dist/

publish:
name: 'Publish: Releases'
strategy:
matrix:
arch: ["amd64", "arm64"]
needs: [setup,msi-build]
if: ${{ ! inputs.skip-publish }}
runs-on: ubuntu-latest
Expand All @@ -189,7 +178,7 @@ jobs:
- name: Download MSI Package
uses: actions/download-artifact@v4
with:
name: msi-${{ matrix.arch }}
name: msi
path: dist
- name: Authenticate with Google Cloud
id: gauth
Expand All @@ -208,10 +197,10 @@ jobs:
VERSION: ${{ needs.setup.outputs.version }}
run: |
cd dist
mv mondoo_${{ matrix.arch }}.msi mondoo_${VERSION}_windows_${{ matrix.arch }}.msi
sha256sum mondoo_${VERSION}_windows_${{ matrix.arch }}.msi >> checksums.windows_${{ matrix.arch }}.txt
gsutil cp checksums.windows_${{ matrix.arch }}.txt gs://releases-us.mondoo.io/mondoo/${VERSION}/checksums.windows_${{ matrix.arch }}.txt
gsutil cp mondoo_${VERSION}_windows_${{ matrix.arch }}.msi gs://releases-us.mondoo.io/mondoo/${VERSION}/mondoo_${VERSION}_windows_${{ matrix.arch }}.msi
mv mondoo.msi mondoo_${VERSION}_windows_amd64.msi
sha256sum mondoo_${VERSION}_windows_amd64.msi >> checksums.windows.txt
gsutil cp checksums.windows.txt gs://releases-us.mondoo.io/mondoo/${VERSION}/checksums.windows.txt
gsutil cp mondoo_${VERSION}_windows_amd64.msi gs://releases-us.mondoo.io/mondoo/${VERSION}/mondoo_${VERSION}_windows_amd64.msi
- name: Reindex folder on releaser.mondoo.com
uses: peter-evans/repository-dispatch@v3
env:
Expand Down
18 changes: 4 additions & 14 deletions packages/msi/msi/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,13 @@

<?define UpgradeCodeStandard = "b0fee933-ccd2-467c-8fe4-bb0ac6a099c8" ?>
<?define UpgradeCodeEnterprise = "4ABDD5C7-E1E1-41A6-8119-DCE65634A6CC" ?>
<?define UpgradeCodeArm64 = "090cfb7d-c00c-4d36-94fe-f649a4b29c91" ?>
<?if $(var.arch) = "arm64"?>
<?define UpgradeCode = "$(var.UpgradeCodeArm64)"?>
<?define InstallerVersion="500"?>
<?define ProductName = "Mondoo"?>
<?define ServiceInstallStart = "demand" ?>
<?define RegistrationTokenRequired = "0"?>
<?define OtherSKU = "$(var.UpgradeCodeEnterprise)"?>
<?else?>
<?define InstallerVersion="200"?>
<?if $(var.MondooSKU) = "standard"?>
<?if $(var.MondooSKU) = "standard" ?>
<?define UpgradeCode = "$(var.UpgradeCodeStandard)"?>
<?define ProductName = "Mondoo"?>
<?define ServiceInstallStart = "demand" ?>
<?define RegistrationTokenRequired = "0"?>
<?define OtherSKU = "$(var.UpgradeCodeEnterprise)"?>
<?elseif $(var.MondooSKU) = "enterprise"?>
<?elseif $(var.MondooSKU) = "enterprise" ?>
<?define UpgradeCode = "$(var.UpgradeCodeEnterprise)"?>
<?define ProductName = "Mondoo Enterprise"?>
<?define ServiceInstallStart = "auto" ?>
Expand All @@ -31,17 +21,17 @@
<?else?>
<?error MondooSKU must be defined as one of "standard" or "enterprise" ?>
<?endif?>
<?endif?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Name="$(var.ProductName)" Version="$(var.ProductVersion)" Manufacturer="Mondoo, Inc." Language="1033" Codepage="1252" Id="*" UpgradeCode="$(var.UpgradeCode)">
<!-- custom action do not work if its not privileged-->
<Package
Description="Mondoo verifies your system for known vulnerabilities"
Manufacturer="Mondoo, Inc."
InstallerVersion="$(var.InstallerVersion)"
InstallerVersion="200"
Compressed="yes"
Comments="Windows Installer Package"
Platform="x64"
InstallScope="perMachine"
InstallPrivileges="elevated"
/>
Expand Down
16 changes: 5 additions & 11 deletions packages/msi/package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

# use: ./package.ps1 -version 0.32.0
param (
[string]$version = 'x.xx.x',
[string]$arch = 'amd64|arm64'
[string]$version = 'x.xx.x'
)

$platform = $arch -eq "amd64" ? "x64" : $arch

function info($msg) { Write-Host $msg -f white }

# info "build appx package"
Expand All @@ -19,25 +16,22 @@ function info($msg) { Write-Host $msg -f white }

info "build msi package $version"
# delete previous build
Remove-Item ".\mondoo.msi" -ErrorAction Ignore
Remove-Item ".\mondoo_${arch}.msi" -ErrorAction Ignore
Remove-Item .\mondoo.msi -ErrorAction Ignore
cd msi
# delete previous intermediate files
Remove-Item .\Product.wixobj -ErrorAction Ignore
Remove-Item .\mondoo.wixpdb -ErrorAction Ignore
# build package
dir 'C:\Program Files (x86)\'
info "run candle (standard)"
& 'C:\Program Files (x86)\WiX Toolset v3.14\bin\candle' -nologo -dMondooSKU="standard" -darch="$platform" -dProductVersion="$version" -ext WixUtilExtension Product.wxs
& 'C:\Program Files (x86)\WiX Toolset v3.14\bin\candle' -nologo -arch x64 -dMondooSKU="standard" -dProductVersion="$version" -ext WixUtilExtension Product.wxs

info "run light (standard)"

& 'C:\Program Files (x86)\WiX Toolset v3.14\bin\light' -nologo -dcl:high -cultures:en-us -loc en-us.wxl -ext WixUIExtension -ext WixUtilExtension product.wixobj -o "mondoo_${arch}.msi"
& 'C:\Program Files (x86)\WiX Toolset v3.14\bin\light' -nologo -dcl:high -cultures:en-us -loc en-us.wxl -ext WixUIExtension -ext WixUtilExtension product.wixobj -o mondoo.msi

# delete previous intermediate files
Remove-Item .\Product.wixobj -ErrorAction Ignore
Remove-Item .\mondoo.wixpdb -ErrorAction Ignore
cd ..

Move-Item ".\msi\mondoo_${arch}.msi" .

Move-Item .\msi\mondoo.msi .

0 comments on commit 843a783

Please sign in to comment.