Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 install location + re-enable arm64 MSI builds #490

Merged
merged 3 commits into from
Nov 8, 2024

Conversation

philipbalinov
Copy link
Contributor

@philipbalinov philipbalinov commented Oct 31, 2024

after enabling arm64 support for the mondoo.MSI, the install location on amd64 suddenly changed to "Program Files (x64)" which breaks the product.

This change aims to pin the installation path on all platforms to "Program Files"

Changes

  • Fixed amd64 package configuration to install to "Program Files" dir
  • Added a blocking test step before publishing the package that installs the amd64 package and verifies cnspec/cnquery are operational
    • added signature validation for the package
    • run cnquery with simple mql rule
    • login to edge with cnspec and run basic policy

Testing Done

Notes

This reverts and emergency revert that was done; this is the fix compared to the original commit for arm64 support

image

@philipbalinov philipbalinov changed the title Philip/fix install location to be "Program Files" Fix install location to be "Program Files" Oct 31, 2024
@philipbalinov philipbalinov marked this pull request as ready for review October 31, 2024 13:26
@philipbalinov philipbalinov marked this pull request as draft October 31, 2024 15:19
@philipbalinov philipbalinov force-pushed the philip/fix-install-location-to-be-programfiles branch 15 times, most recently from 8b0a8ca to e393b2a Compare October 31, 2024 17:25
@philipbalinov philipbalinov changed the title Fix install location to be "Program Files" re-enable arm64 MSI builds + fix install location to be "Program Files" Oct 31, 2024
@philipbalinov philipbalinov marked this pull request as ready for review October 31, 2024 17:36
@philipbalinov philipbalinov force-pushed the philip/fix-install-location-to-be-programfiles branch 4 times, most recently from d63164d to 8eb0c59 Compare November 1, 2024 09:50
if (-not $match) {
exit 1
}
- name: Run a basic cnquery sanity check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to test cnspec here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, fixed in #491

@@ -0,0 +1,17 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets not add /DS_Store files. We should add this one to gitignore to prevent this from future commits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops - added those two patterns to .gitignore

Copy link
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement @philipbalinov

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

curl -sL --head --fail https://github.com/mondoohq/cnquery/releases/download/v${{ steps.version.outputs.version }}/cnquery_${{ steps.version.outputs.version }}_windows_amd64.zip \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice simplification

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
mkdir -p dist/${{ matrix.arch }} && cd dist/${{ matrix.arch }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the matrix here

& 'C:\Program Files\Mondoo\cnquery.exe' run -c "os.base.packages.where(name == 'Mondoo') { name }"
- name: Login to edge with cnspec
run: |
& 'C:\Program Files\Mondoo\cnspec.exe' login -t "${{ secrets.INSTALL_TEST_MONDOO_REGISTRATION_TOKEN }}" --config C:\ProgramData\Mondoo\mondoo.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! I think we should also run the logout.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added logout

@@ -6,13 +6,23 @@

<?define UpgradeCodeStandard = "b0fee933-ccd2-467c-8fe4-bb0ac6a099c8" ?>
<?define UpgradeCodeEnterprise = "4ABDD5C7-E1E1-41A6-8119-DCE65634A6CC" ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required as this PR but we should remove the enterprise package since that is something we do not do anymore. Essentially we have the same package, just for amd64 and arm64. From what I see in the build pipeline we do not even build enterprise anymore.

Copy link
Contributor Author

@philipbalinov philipbalinov Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note on this - we need to at least keep the UpgradeCodeEnterprise and OtherSKU logic, as that protects us from installing the standard package side-by-side with the enterprise one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea.

<?if $(var.arch) = "arm64"?>
<?define UpgradeCode = "$(var.UpgradeCodeArm64)"?>
<?define InstallerVersion="500"?>
<?define ProductName = "Mondoo"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the product name in the if condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved all common elements out of the conditional block.

<?define UpgradeCodeArm64 = "090cfb7d-c00c-4d36-94fe-f649a4b29c91" ?>
<?if $(var.arch) = "arm64"?>
<?define UpgradeCode = "$(var.UpgradeCodeArm64)"?>
<?define InstallerVersion="500"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add comment what installer version 500 / 200 mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comments with the meaning of these versions

@@ -3,9 +3,12 @@

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@philipbalinov philipbalinov force-pushed the philip/fix-install-location-to-be-programfiles branch from 373d298 to a3382cc Compare November 1, 2024 14:55
Copy link
Contributor

@afiune afiune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't test but it looks good to me.

@afiune afiune changed the title re-enable arm64 MSI builds + fix install location to be "Program Files" 🐛 install location + re-enable arm64 MSI builds Nov 5, 2024
- Revert "Revert "Build arm64 MSI packages additionally to the current amd64 ones (#482)" (#486)"
    - This reverts commit 843a783.

- Revert the `Platform` attribute in the Package definition, as that
appears to dictate which install location the package should use
i.e. "Program Files" vs "Program Files (x64)"

- Some minor improvements
@philipbalinov philipbalinov force-pushed the philip/fix-install-location-to-be-programfiles branch from e3b39e8 to a9b0ecd Compare November 5, 2024 14:35
@philipbalinov philipbalinov merged commit 1af15a5 into main Nov 8, 2024
16 checks passed
@philipbalinov philipbalinov deleted the philip/fix-install-location-to-be-programfiles branch November 8, 2024 12:38
@github-actions github-actions bot locked and limited conversation to collaborators Nov 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants