Skip to content

Commit

Permalink
added better messages around when and how to update docker components
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Apr 10, 2024
1 parent c994e88 commit afdc347
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### New Features

* Added better messages on when and how to update Docker components
* Updated default Docker Compose version to `2.26.1`
* Updated default Docker Desktop version to `4.29.0`
* Updated default Docker Engine version to `26.0.0`
Expand Down
4 changes: 2 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mode: cli
dockerSupportedVersions:
compose:
satisfies: "1.x.x || 2.x.x"
recommendUpdate: "2.24.2"
recommendUpdate: "<=2.24.6"
tested: "<=2.26.1"
link:
linux: https://docs.docker.com/compose/install/#install-compose-on-linux-systems
Expand All @@ -16,7 +16,7 @@ dockerSupportedVersions:
desktop:
satisfies: ">=4.0.0 <5"
tested: "<=4.29.0"
recommendUpdate: "<=4.27.0"
recommendUpdate: "<=4.28.0"
link:
darwin: https://docs.docker.com/desktop/install/mac-install/
win32: https://docs.docker.com/desktop/install/windows-install/
Expand Down
11 changes: 11 additions & 0 deletions hooks/app-check-docker-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ const _ = require('lodash');

module.exports = async (app, lando) => {
_.forEach(_(lando.versions).filter(version => version && version.dockerVersion).value(), thing => {
// handle generic unsupported or untested notices
if (!thing.satisfied) app.addMessage(require('../messages/unsupported-version-warning')(thing));
if (thing.untested) app.addMessage(require('../messages/untested-version-notice')(thing));

// handle docker compose recommend update
if (thing.name === 'compose' && thing.rupdate) {
app.addMessage(require('../messages/update-docker-compose-warning')(thing));
}
// handle docker desktop recommend update
if (thing.name === 'desktop' && thing.rupdate) {
thing.os = process.platform === 'darwin' ? 'mac' : 'windows';
app.addMessage(require('../messages/update-docker-desktop-warning')(thing));
}
});
};
3 changes: 3 additions & 0 deletions lib/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ module.exports = class Engine {
satisfies: data.satisfies || `${data.min} - ${data.max}`,
link: data.link[process.platform],
tested: data.tested || 'x.x.x',
recommendUpdate: data.recommendUpdate || 'x.x.x',
}]))
.fromPairs()
.value();
Expand All @@ -203,8 +204,10 @@ module.exports = class Engine {
link: reqs.link,
satisfied: require('../utils/is-compatible-version')(version, reqs),
untested: !require('../utils/is-compatible-version')(version, {...reqs, satisfies: reqs.tested}),
rupdate: require('../utils/is-compatible-version')(version, {...reqs, satisfies: reqs.recommendUpdate}),
wants: reqs.satisfies,
tested: reqs.tested,
update: reqs.recommendUpdate,
dockerVersion: true,
version: semver.clean(version),
};
Expand Down
13 changes: 13 additions & 0 deletions messages/update-docker-compose-warning.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

// checks to see if a setting is disabled
module.exports = () => ({
type: 'warning',
title: 'Recommend updating DOCKER COMPOSE',
detail: [
'Looks like you might be falling a bit behind on Docker Compose.',
'In order to ensure the best stability and support we recommend you update',
'by running the hidden "lando setup" command.',
],
command: 'lando setup --skip-common-plugins',
});
13 changes: 13 additions & 0 deletions messages/update-docker-desktop-warning.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

// checks to see if a setting is disabled
module.exports = ({os}) => ({
type: 'warning',
title: 'Recommend updating DOCKER DESKTOP',
detail: [
'Looks like you might be falling a bit behind on Docker Desktop.',
'In order to ensure the best stability and support we recommend you update',
'by launching Docker Desktop and updating through their app.',
],
url: `https://docs.docker.com/desktop/settings/${os}/#software-updates`,
});

0 comments on commit afdc347

Please sign in to comment.