Skip to content

Commit

Permalink
fix(MongoBinaryDownloadUrl): clamp ubuntu-year to highest supported year
Browse files Browse the repository at this point in the history
fixes #846
  • Loading branch information
hasezoey committed Jan 17, 2024
1 parent 9042eb2 commit 9a29af9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/guides/supported-systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ Depends on the distribution, many common ones should just work right out of the

(uses mongodb's `ubuntu` release)<br/>
Lowest supported Distribution version is `1404`<br/>
Highest version is `2204`<br/>
Highest version is `2204` (higher versions will be clamped to this value)<br/>
Default version is `2204`<br/>
Architectures Supported: `x86_64`, `arm64`(`aarch64`)

:::note
Lower Versions than `2004` may be used if mongodb dosnt provide binaries for an lower version of mongodb for an higher version of ubuntu
:::
:::note
Since Mongodb `6.0.4` there are binaries for `2204`, any version before is mapped to `2204` (or earlier) and will require `libssl1.1` to be installed.
Since Mongodb `6.0.4` there are binaries for `2204`, any version before is mapped to `2004` (or earlier) and will require `libssl1.1` to be installed.
See [this mongodb issue](https://jira.mongodb.org/browse/SERVER-62300).
:::

Expand All @@ -71,7 +71,7 @@ See [this mongodb issue](https://jira.mongodb.org/browse/SERVER-62300).

(uses mongodb's `debian` release)<br/>
Lowest supported Distribution version is `71`<br/>
Highest version is `11`<br/>
Highest version is `11` (higher versions will be clamped to this value)<br/>
Default version is `10` (when in `unstable` or `testing`, otherwise none)

### Fedora
Expand All @@ -80,7 +80,7 @@ Default version is `10` (when in `unstable` or `testing`, otherwise none)

(uses mongodb's `rhel` release)<br/>
Lowest supported Distribution version is `6`<br/>
Highest version is `36` (see note)<br/>
Highest version is `36` (see note) (higher versions will be clamped to this value)<br/>
Default version is `34` (when above or equal to `34`, otherwise none)

:::note
Expand All @@ -94,7 +94,7 @@ There are currently no newer mongodb builds that support the newer provided open

(uses mongodb's `rhel` release)<br/>
Lowest supported Distribution version is `5`<br/>
Highest version is `9`<br/>
Highest version is `9` (higher versions will be clamped to this value)<br/>
Default version is `70`<br/>
Architectures Supported: `x86_64`, `arm64`(`aarch64`)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,24 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
return 'ubuntu2004';
}

// base case for higher than mongodb supported ubuntu versions
{
// TODO: try to keep this up-to-date to the latest mongodb supported ubuntu version
/**
* Highest ubuntu year supported by mongodb binaries
* @see https://www.mongodb.com/download-center/community/releases/archive
*/
const highestUbuntuYear = 22; // 22 is the highest supported as of mongodb 7.0.4

if (ubuntuYear > highestUbuntuYear) {
log(
`getUbuntuVersionString: ubuntuYear "${ubuntuYear}" is higher than the currently supported mongodb year of "${highestUbuntuYear}", using highest known`
);

return 'ubuntu2204';
}
}

// the "04" version always exists for ubuntu, use that as default
return `ubuntu${ubuntuYear}04`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,23 @@ describe('MongoBinaryDownloadUrl', () => {
}
});

it('should clamp to highest supported ubuntu year', async () => {
// TODO: try to keep this up-to-date to the latest mongodb supported ubuntu version
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '7.0.4', // highest released mongodb version
os: {
os: 'linux',
dist: 'ubuntu',
release: '23.04', // highest released ubuntu version
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.4.tgz'
);
});

describe('arm64', () => {
it('for ubuntu arm64 4.0.25 (below 4.1.10)', async () => {
const du = new MongoBinaryDownloadUrl({
Expand Down

0 comments on commit 9a29af9

Please sign in to comment.