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

add version number generation logic and tests #63

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

zackattack01
Copy link
Contributor

We need to be able to generate an integer value from our semver versioning strings. The value generated will be added to windows registry to assist with intune detection rules. We will add the built version automatically on MSI install, as well as set an additional key on startup with the currently running version after autoupdates.

I imagine we'll want to add this information to flares at some point too, so a helper function to translate the integer version back to a semver string is also included

For additional context see issue here

Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

Tests are thorough 🔥

Copy link

@James-Pickett James-Pickett left a comment

Choose a reason for hiding this comment

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

nice

Comment on lines +101 to +103
majorVersionMultiplier int = 1000000
minorVersionMultiplier int = 1000
patchVersionMultiplier int = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

If we wanted to support a possible future date based form, do these need to have an additional zero?

Counterpoint, maybe not, so that any future 2024, is bigger than a potential 3.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i like the counterpoint here!

// allowing for an easy "upgrade-only" detection configuration within intune.
// Zero is returned for any case where the version cannot be reliably translated
func VersionNum() int {
semverMatch := semverRegexp.FindStringSubmatch(version)
Copy link
Contributor

Choose a reason for hiding this comment

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

This will make it impossible to differentiate between different builds (shas) of a given patch. Maybe that's okay

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I couldn't think of a clean way to handle that, and given the intention felt like this would be alright

Copy link
Contributor Author

Choose a reason for hiding this comment

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

going to merge this for now but happy to iterate if you have any ideas here!

Copy link
Contributor

Choose a reason for hiding this comment

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

unix timestamp :)

I forget... Did the windows functionality include lexigraphical string sorts? I assume not

@zackattack01 zackattack01 merged commit 763ad9e into master Oct 24, 2024
7 of 8 checks passed
@zackattack01 zackattack01 deleted the zack/add_version_num_logic branch November 26, 2024 15:01
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.

4 participants