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

Build and sign Windows installer #1702

Merged
merged 3 commits into from
Oct 11, 2024
Merged

Conversation

sfc-gh-pjob
Copy link
Contributor

@sfc-gh-pjob sfc-gh-pjob commented Oct 10, 2024

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

Based on @sfc-gh-pczajka branch: https://github.com/snowflakedb/snowflake-cli/tree/SNOW-1661610-sign-Windows-intaller

  • Fixes to creation of Windows binaries
    • Fixed version number for dev and rc versions (3.1.0..0 -> 3.1.0.0)
  • Signing of installer and snow.exe with a proper name visible in UAC dialog.
  • Verification of digital signature for installer and snow.exe.
  • Fail .bat script on failure of crucial commands ("goto error").

@@ -17,7 +17,7 @@ def parse_version_for_windows_build() -> list[str]:
case last if "dev" in last:
version = msv + last.split("dev")

return version
return [segment for segment in version if segment]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes double dot error in version (3.1.0..0 -> 3.1.0.0).

@@ -0,0 +1,2 @@
REM DELETE THIS FILE
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can be deleted for target jobs configuration. Signature verification is now in build_installer.bat.

REM snowflake_cli.wixobj ^
REM snowflake_cli_exitdlg.wixobj ^
REM _internal.wixobj
set PATH=C:\Program Files\7-Zip;C:\Users\jenkins\AppData\Local\Programs\Python\Python38;C:\Users\jenkins\AppData\Local\Programs\Python\Python38\Scripts;C:\Program Files (x86)\WiX Toolset v3.11\bin;%PATH%
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Almost all the code is from @sfc-gh-pczajka branch: https://github.com/snowflakedb/snowflake-cli/tree/SNOW-1661610-sign-Windows-intaller

I changed the following:

  • Added || goto :error to crucial commands and added error label section at the end of the file.
  • Added /d "Snowflake CLI" option to signtool sign to present a proper tool name in UAC dialog.
  • Added two invocations of signtool verify - for snow.exe and for installer.
  • Removed hardcoded values for REVISION and RELEASE_TYPE variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO:

  • review
  • cleanup debugs and "echo on"
  • upload MSI to a proper path at a stage (without staging part???)
  • anything else I don't know about

@sfc-gh-mraba sfc-gh-mraba marked this pull request as ready for review October 11, 2024 07:35
@sfc-gh-mraba sfc-gh-mraba requested a review from a team as a code owner October 11, 2024 07:35
@sfc-gh-mraba sfc-gh-mraba merged commit 2a79d80 into main Oct 11, 2024
20 checks passed
@sfc-gh-mraba sfc-gh-mraba deleted the pjob/SNOW-1661610-sign-windows branch October 11, 2024 07:42
sfc-gh-mraba pushed a commit that referenced this pull request Oct 11, 2024
sfc-gh-mraba pushed a commit that referenced this pull request Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants