-
Notifications
You must be signed in to change notification settings - Fork 46
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
Enable OS Updates to pre-release versions of higher base semver #1398
Conversation
85a9481
to
ded8ea6
Compare
536b6dc
to
b77818b
Compare
src/models/os.ts
Outdated
$filter: { | ||
is_final: true, | ||
...(filterOptions !== 'include_draft' && { is_final: true }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe filterOptions === 'default'
is more clear?
src/models/os.ts
Outdated
@@ -392,6 +397,7 @@ const getOsModel = function ( | |||
* @memberof balena.models.os | |||
* | |||
* @param {String|String[]} deviceTypes - device type slug or array of slugs | |||
* @param {Boolean} [includeDraft=false] - Whether pre-releases should be included in the results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could make more sense as an options object so that it can also cover the potential cases of production vs draft vs old/legacy vs known issues, etc without having to add a bunch of individual arguments
5af99af
to
83f65f3
Compare
src/models/os.ts
Outdated
async (deviceTypes: string[], listedByDefault: boolean | null) => { | ||
async ( | ||
deviceTypes: string[], | ||
filterOptions: 'default' | 'include_draft' | 'all', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
authDependentMemoizer
is atm using primitive: true
and doesn't expose a normalizer, so I've left it for the next time we need to add an extra property for getAvailableOsVersions
.
…se semver Change-type: minor Depends-on: balena-io/balena-sdk#1398 See: https://balena.fibery.io/Work/Task/cli-Enable-OS-Updates-to-pre-release-OS-versions-1751
…se semver Change-type: minor Depends-on: balena-io/balena-sdk#1398 See: https://balena.fibery.io/Work/Task/cli-Enable-OS-Updates-to-pre-release-OS-versions-1751
os_version: osVersion, | ||
os_variant: osVariant, | ||
}, | ||
'2.29.2-1704382618288+rev1.prod', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please have comments on why these specific OS versions were chosen? Same on line 3999 and 3960 (and anywhere else where we put a specific OS version)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
B/c that's the only one atm on prod that is draft, and since it's old enough I don't expect it to become finalized ever :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ends up the versions in this file are random, so I added a comment about that right at the start of the describe()
.
[['balenaOS 2.28.0+rev1', 'prod']].forEach(function ([ | ||
osVersion, | ||
osVariant, | ||
]) { | ||
expect(() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using an array and forEach when it's just one item?
[['balenaOS 2.28.0-1704382553234', 'prod']].forEach(function ([ | ||
osVersion, | ||
osVariant, | ||
]) { | ||
expect(() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using an array and forEach when it's just one item?
[['balenaOS 2.28.0-1704382553234', 'prod']].forEach(function ([ | ||
osVersion, | ||
osVariant, | ||
]) { | ||
expect(() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using an array and forEach when it's just one item?
src/models/os.ts
Outdated
filterOptions: 'default' | 'include_draft' | 'all', | ||
) => { | ||
return await _getAllOsVersions( | ||
deviceTypes, | ||
listedByDefault | ||
? { | ||
filterOptions === 'all' | ||
? undefined | ||
: { | ||
$filter: { | ||
is_final: true, | ||
...(filterOptions === 'default' && { is_final: true }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer either a comment pointing out that default
is finalized only or to replace default
with finalized
to make it clearer. (tbh I prefer replacing default
with finalized
most for clarity)
@@ -404,13 +411,14 @@ const getOsModel = function ( | |||
*/ | |||
async function getAvailableOsVersions( | |||
deviceTypes: string[] | string, | |||
options?: { includeDraft?: boolean }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this and line 900 should be the options that _memoizedGetAllOsVersions
expects for its second parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See: #1398 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moreover _memoizedGetAllOsVersions
is used by both getAvailableOsVersions
& getAllOsVersions
.
Till now I couldn't find a nice way to combine them :(
typings/pinejs-client-core.d.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing changed? Just reformatted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes :)
tests/integration/models/os.spec.ts
Outdated
expect(draftVersions).to.have.lengthOf(0); | ||
}); | ||
|
||
it('should include draft OS versions when the respective flag is not used [string device type argument]', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should include draft OS versions when the respective flag is not used [string device type argument]', async () => { | |
it('should include draft OS versions when the respective flag is used [string device type argument]', async () => { |
…se semver Change-type: minor Depends-on: balena-io/balena-sdk#1398 See: https://balena.fibery.io/Work/Task/cli-Enable-OS-Updates-to-pre-release-OS-versions-1751
Pull request was converted to draft
LGTM |
Change-type: minor
Update balena-hup-action-utils from 5.0.0 to 6.1.0 Change-type: minor
…ases Change-type: minor
Change-type: patch
…se semver Change-type: minor Depends-on: balena-io/balena-sdk#1398 See: https://balena.fibery.io/Work/Task/cli-Enable-OS-Updates-to-pre-release-OS-versions-1751
Depends-on: balena-io-modules/balena-hup-action-utils#34
Depends-on: https://github.com/balena-io/balena-proxy/pull/1098
Update balena-hup-action-utils from 5.0.0 to 6.1.0
Change-type: minor
Resolves: #
HQ:
See:
Depends-on:
Change-type: major|minor|patch
Contributor checklist