Skip to content

Build Number in Version File#432

Merged
ExtremeFiretop merged 3 commits intoExtremeFiretop:devfrom
Martinski4GitHub:dev
Mar 26, 2025
Merged

Build Number in Version File#432
ExtremeFiretop merged 3 commits intoExtremeFiretop:devfrom
Martinski4GitHub:dev

Conversation

@Martinski4GitHub
Copy link
Collaborator

Added code to extract a "build number" (IF it exists) from the version file so we can compare different build numbers when the version strings are exactly the same.

Added code to extract a "build number" (IF it exists) from the version file so we can compare different build numbers when the version strings are the same.
@Martinski4GitHub
Copy link
Collaborator Author

Martinski4GitHub commented Mar 25, 2025

@ExtremeFiretop,

This PR implements a method to take into account a "build number" (if found in the version file) when the version strings between the current and downloaded files are the same. This is primarily intended for the 'develop' branch so the script can be automatically updated, but only when the "build number" is found on the 2nd line after the version string and is greater than ZERO, or greater than the previous build number. If the "build number" is not found, the functionality is the same as before.

The "build number" can be any integer greater than ZERO and up to an 8-digit value. For example, at work, we use the following format for development builds, and it's the one I recommend since it is meaningful and easy to remember:

YYMMDDHH = 25032522 = 2025-March-25, 10:00 PM.

@ExtremeFiretop
Copy link
Owner

I'm just wondering how this will work with our GitHub workflow that uses this file for the version detection, tagging and release.

Will review stuff later tonight :)

Grab the 1st line from file.
@Martinski4GitHub
Copy link
Collaborator Author

I'm just wondering how this will work with our GitHub workflow that uses this file for the version detection, tagging and release.

Yes, good point.

Will the following change in the YML file be enough to address those concerns?

NEXT_TAG=$(head -n 1 version.txt)

@ExtremeFiretop
Copy link
Owner

@Martinski4GitHub

Sorry for the delay, we recently bought a new 65 Inch QD-OLED TV and have been rewatching all our fav movies on it over the last few days hahaha

This is great thank you for addressing the workflow!
One last question before we merge, how would you recommend we address releases moving forwards?

Should we up this build number with new production releases? Remove it? Or leave it whatever it is at the time and merge it to production even though it's not a dev build anymore?

I'm just curious how you picture the new workflow

@ExtremeFiretop
Copy link
Owner

ExtremeFiretop commented Mar 26, 2025

I'm just wondering how this will work with our GitHub workflow that uses this file for the version detection, tagging and release.

Yes, good point.

Will the following change in the YML file be enough to address those concerns?

NEXT_TAG=$(head -n 1 version.txt)

Yes it should! Thank you :) it was a side thought I had when I noticed first thing this morning it included changes to the version.txt but I figured it would be an easy solve.

@Martinski4GitHub
Copy link
Collaborator Author

@Martinski4GitHub

Sorry for the delay, we recently bought a new 65 Inch QD-OLED TV and have been rewatching all our fav movies on it over the last few days hahaha

No need to apologize; I understand completely. 😉
As you know, my wife and I are also kind of cinephiles, so anytime we have a chance to watch a good movie or rewatch some of our favorite classics, we pretty much drop everything and sit down with some nice coffee, chocolates or croissants and just chill and relax watching movies.

This is great thank you for addressing the workflow! One last question before we merge, how would you recommend we address releases moving forwards?

Should we up this build number with new production releases? Remove it? Or leave it whatever it is at the time and merge it to production even though it's not a dev build anymore?

I'm just curious how you picture the new workflow

The new "buid number" on the version file (or more appropriately, the "build timestamp" if we follow my recommendation), is really meant only for developments builds where the version string remains the same so that when users are testing the alpha/beta builds they get new updates automatically when we change the timestamp; but, if the timestamp remains the same, the updates are no longer automatic (they must do "force updates"). This allows us to control when we deem the current development branch to be "good enough" for external testing purposes.

For production master releases where the version string is always updated to the next numerical sequence, the "build timestamp" is essentially ignored. IOW, it doesn't hurt if we leave the timestamp in the file when merging, but it will serve no purpose either.

@ExtremeFiretop
Copy link
Owner

@Martinski4GitHub
For production master releases where the version string is always updated to the next numerical sequence, the "build timestamp" is essentially ignored. IOW, it doesn't hurt if we leave the timestamp in the file when merging, but it will serve no purpose either.

This is what I wanted to confirm with you, fantastic!
So to confirm I understand everything correctly; basically the workflow is the same for production releases with an ignored build timestamp.

But dev branch does care about the build timestamp, if the build timestamp is updated in dev, then that triggers automated updates in dev (or update notifications if auto update is disabled), otherwise we can just ignore it and people would continue to do "forceupdate" as required.

We essentially only need to update it, if we expect an important update in dev more or less; for example, the little oopies I made with reformatting the webpage, I could of updated the build number then in dev, and that would of triggered all the dev users to auto-update or get an update notification.

@Martinski4GitHub
Copy link
Collaborator Author

@Martinski4GitHub
For production master releases where the version string is always updated to the next numerical sequence, the "build timestamp" is essentially ignored. IOW, it doesn't hurt if we leave the timestamp in the file when merging, but it will serve no purpose either.

This is what I wanted to confirm with you, fantastic! So to confirm I understand everything correctly; basically the workflow is the same for production releases with an ignored build timestamp.

Correct.

But dev branch does care about the build timestamp, if the build timestamp is updated in dev, then that triggers automated updates in dev (or update notifications if auto update is disabled), otherwise we can just ignore it and people would continue to do "forceupdate" as required.

Exactly. It is still up to us whether to put the "build timestamp" in the version file, and if and when it gets updated to trigger automatic updates or notifications for development builds.

We essentially only need to update it, if we expect an important update in dev more or less; for example, the little oopies I made with reformatting the webpage, I could of updated the build number then in dev, and that would of triggered all the dev users to auto-update or get an update notification.

Yes, those are good examples where the build timestamp would help to update users automatically, especially for those users who may not visit the SNB Forums regularly after switching to the develop branch so they may miss some important fixes or new features being added.

@ExtremeFiretop ExtremeFiretop merged commit d1ff809 into ExtremeFiretop:dev Mar 26, 2025
1 check passed
@Martinski4GitHub
Copy link
Collaborator Author

@ExtremeFiretop,
Going to have dinner now, so logging out...
I know it's late for you, so have a good night, bud!!

@ExtremeFiretop
Copy link
Owner

@ExtremeFiretop, Going to have dinner now, so logging out... I know it's late for you, so have a good night, bud!!

Goodnight buddy! Enjoy the evening!

@ExtremeFiretop
Copy link
Owner

ExtremeFiretop commented Mar 28, 2025

Just an FYI I noticed this when force updating my router from the existing dev version;
But for some reason my version.txt already had the new build timestamp before I attempted to run the forceupdate tonight.

I'm assuming last night or tonight (interactively) the script ran and downloaded the new version.txt; and just now when I tried to forceupdate; it had the build timestamp in the file but the old script still, causing this.

image

Admin@GT-BE98_Pro:/tmp/home/root# sh /jffs/scripts/MerlinAU.sh forceupdate
Cron job 'MerlinAU_FWUpdate' already exists.
Cron job hook already exists in '/jffs/scripts/services-start' script.

Force downloading latest script version...

[: 1004000
25032500000000: bad number
Downloading latest version [1.4.0
25032500] of MerlinAU
MerlinAU files were successfully updated.

sed: unmatched '/'
sed: unmatched '/'

Cron job 'MerlinAU_FWUpdate' already exists.
Cron job hook already exists in '/jffs/scripts/services-start' script.

@ExtremeFiretop
Copy link
Owner

Once the script was updated though, now I no longer have the errors when running it.

@Martinski4GitHub
Copy link
Collaborator Author

Just an FYI I noticed this when force updating my router from the existing dev version; But for some reason my version.txt already had the new build timestamp before I attempted to run the forceupdate tonight.

I'm assuming last night or tonight (interactively) the script ran and downloaded the new version.txt; and just now when I tried to forceupdate; it had the build timestamp in the file but the old script still, causing this.

Ah, yes, the previous 'develop' script version must have downloaded the "new" version.txt file to do the automatic script update check, and ended up replacing the "old" version file, which was a bug that led to the error for the next check that still uses the "old" script version. Once you have the "new" script installed, the error will no longer happen.

I think I should port the fix for the bug that causes the version.txt to be replaced prematurely onto the 1.3.11 version so that when the time comes for the upgrade to the final 1.4.0 release, the error does not happen.

Great catch!!

@ExtremeFiretop
Copy link
Owner

ExtremeFiretop commented Mar 28, 2025

Just an FYI I noticed this when force updating my router from the existing dev version; But for some reason my version.txt already had the new build timestamp before I attempted to run the forceupdate tonight.
I'm assuming last night or tonight (interactively) the script ran and downloaded the new version.txt; and just now when I tried to forceupdate; it had the build timestamp in the file but the old script still, causing this.

Ah, yes, the previous 'develop' script version must have downloaded the "new" version.txt file to do the automatic script update check, and ended up replacing the "old" version file, which was a bug that led to the error for the next check that still uses the "old" script version. Once you have the "new" script installed, the error will no longer happen.

Exactly what I expierenced yes; I was downgrading my router to the stable release (alpha is causing me issues)
I wanted to use the offline feature, and as soon as I loaded the script noticed those errors, then did the force update and grabbed that screenshot of the errors while it was updating, but now I can no longer re-create the issue.

I think I should port the fix for the bug that causes the version.txt to be replaced prematurely onto the 1.3.11 version so that when the time comes for the upgrade to the final 1.4.0 release, the error does not happen.

Agreed!

Great catch!!

Oh you know; just doing my part; breaking things and whatnot ;)

@ExtremeFiretop
Copy link
Owner

ExtremeFiretop commented Mar 28, 2025

I always thought I would be a good "bug bounty hunter"
I heard that was a gig some companies actually hire for, or pay contracts out for.

@Martinski4GitHub
Copy link
Collaborator Author

Martinski4GitHub commented Mar 28, 2025

Yeah, let me grab a cup of coffee and finish some other "stuff" I was doing before I port the fix over. This will become the next 1.3.12 production version to be issued at some point before the final 1.4.0 release.

Great catch!!

Oh you know; just doing my part; breaking things and whatnot ;)

Always appreciate your great skill at testing and "breaking things" LOL!!!

@ExtremeFiretop
Copy link
Owner

ExtremeFiretop commented Mar 28, 2025

Agreed!

Yeah, let me grab a cup of coffee and finish some other "stuff" I was doing before I port the fix over. This will become the next 1.3.12 production version to be issued at some point before the final 1.4.0 release.

Take your time!

Always appreciate your great skill at testing and "breaking things" LOL!!!

60c87b2a7d7d4

@Martinski4GitHub
Copy link
Collaborator Author

I always thought I would be a good "bug bounty hunter" I heard that was a gig some companies actually hire for, or pay contracts out for.

Yeah, you could make some good money. There are companies that hire independent contractors to do "penetration testing" to find vulnerabilities in s/w applications, systems, or network infrastructure.

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.

2 participants