@florianpat/lando-core 3.23.7-compose → 3.23.22-test2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +101 -1
  2. package/bin/lando +2 -0
  3. package/bin/lando.cmd +3 -0
  4. package/builders/_lando.js +2 -1
  5. package/components/l337-v4.js +2 -2
  6. package/config.yml +3 -2
  7. package/hooks/lando-autostart-engine.js +4 -25
  8. package/hooks/lando-run-setup.js +58 -0
  9. package/hooks/lando-setup-build-engine-darwin.js +13 -12
  10. package/hooks/lando-setup-build-engine-linux.js +14 -4
  11. package/hooks/lando-setup-build-engine-win32.js +27 -20
  12. package/hooks/lando-setup-build-engine-wsl.js +210 -0
  13. package/hooks/lando-setup-check.js +19 -0
  14. package/hooks/lando-setup-create-ca-wsl.js +34 -0
  15. package/hooks/lando-setup-create-ca.js +22 -23
  16. package/hooks/lando-setup-install-ca-darwin.js +5 -1
  17. package/hooks/lando-setup-install-ca-linux.js +4 -1
  18. package/hooks/lando-setup-install-ca-win32.js +5 -1
  19. package/hooks/lando-setup-install-ca-wsl.js +145 -0
  20. package/hooks/lando-setup-orchestrator.js +4 -4
  21. package/index.js +18 -12
  22. package/lib/app.js +2 -2
  23. package/lib/art.js +20 -8
  24. package/lib/compose.js +0 -3
  25. package/lib/daemon.js +79 -76
  26. package/lib/docker.js +2 -2
  27. package/lib/engine.js +10 -3
  28. package/lib/lando.js +2 -2
  29. package/lib/metrics.js +5 -3
  30. package/lib/updates.js +12 -2
  31. package/node_modules/nanoid/.devcontainer.json +23 -0
  32. package/node_modules/nanoid/README.md +517 -2
  33. package/node_modules/nanoid/async/index.browser.cjs +37 -2
  34. package/node_modules/nanoid/async/index.browser.js +37 -2
  35. package/node_modules/nanoid/async/index.cjs +38 -2
  36. package/node_modules/nanoid/async/index.js +38 -2
  37. package/node_modules/nanoid/async/index.native.js +33 -2
  38. package/node_modules/nanoid/index.browser.cjs +39 -1
  39. package/node_modules/nanoid/index.browser.js +39 -1
  40. package/node_modules/nanoid/index.cjs +42 -2
  41. package/node_modules/nanoid/index.js +42 -2
  42. package/node_modules/nanoid/non-secure/index.cjs +15 -2
  43. package/node_modules/nanoid/non-secure/index.js +15 -2
  44. package/node_modules/nanoid/package.json +1 -1
  45. package/node_modules/nanoid/url-alphabet/index.cjs +4 -0
  46. package/node_modules/nanoid/url-alphabet/index.js +4 -0
  47. package/package.json +7 -7
  48. package/plugins/networking/app.js +4 -2
  49. package/plugins/networking/index.js +19 -6
  50. package/plugins/proxy/builders/_proxy.js +1 -2
  51. package/release-aliases/3-EDGE +1 -1
  52. package/release-aliases/3-STABLE +1 -1
  53. package/renderers/dc2.js +2 -1
  54. package/scripts/add-to-group.sh +72 -0
  55. package/scripts/docker-engine-start.sh +15 -1
  56. package/scripts/install-docker-desktop.ps1 +11 -12
  57. package/scripts/install-system-ca-win32.ps1 +14 -14
  58. package/scripts/run-elevated.ps1 +2 -2
  59. package/scripts/semcompare.sh +142 -0
  60. package/scripts/wait-for-user.sh +1 -2
  61. package/tasks/destroy.js +3 -0
  62. package/tasks/info.js +2 -1
  63. package/tasks/init.js +35 -30
  64. package/tasks/rebuild.js +2 -8
  65. package/tasks/restart.js +2 -8
  66. package/tasks/setup.js +2 -2
  67. package/tasks/shellenv.js +2 -2
  68. package/tasks/start.js +2 -8
  69. package/tasks/stop.js +3 -0
  70. package/utils/build-config.js +2 -0
  71. package/utils/build-tooling-runner.js +2 -1
  72. package/utils/get-app.js +1 -1
  73. package/utils/get-bin-paths.js +2 -2
  74. package/utils/get-compose-x.js +1 -1
  75. package/utils/get-config-defaults.js +12 -7
  76. package/utils/get-docker-bin-path.js +6 -2
  77. package/utils/get-docker-desktop-x.js +21 -0
  78. package/utils/get-docker-x.js +3 -2
  79. package/utils/get-shellenv.js +1 -2
  80. package/utils/get-system-cas.js +25 -6
  81. package/utils/get-win32-envvar-from-wsl.js +7 -0
  82. package/utils/is-admin-user.js +9 -8
  83. package/utils/is-group-member.js +14 -7
  84. package/utils/is-wsl-interop.js +17 -4
  85. package/utils/run-elevated.js +9 -0
  86. package/utils/run-powershell-script.js +31 -5
  87. package/utils/run-tasks.js +3 -2
  88. package/utils/setup-metrics.js +10 -1
  89. package/utils/shutdown-os.js +8 -3
  90. package/utils/spawn-sync-stringer.js +1 -0
  91. package/utils/update-shell-profile.js +8 -7
  92. package/utils/validate-ca.js +31 -0
  93. package/utils/winpath-2-wslpath.js +6 -0
  94. package/utils/wslpath-2-winpath.js +6 -0
  95. package/hooks/lando-dep-check.js +0 -26
  96. package/lib/checksums.txt +0 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,106 @@
1
1
  ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
2
2
 
3
- ## v3.23.7-compose - [November 17, 2024](https://github.com/florianPat/lando-core/releases/tag/v3.23.7-compose)
3
+ ## v3.23.22-test2 - [January 3, 2025](https://github.com/florianPat/lando-core/releases/tag/v3.23.22-test2)
4
+
5
+ ## v3.23.22 - [December 17, 2024](https://github.com/lando/core/releases/tag/v3.23.22)
6
+
7
+ * Added ability to customize `networkLimit` [#245](https://github.com/lando/core/pull/245)
8
+ * Fixed incorrect `-EncodedCommand` fallback detection for `powershell.exe` script execution [#297](https://github.com/lando/core/issues/297)
9
+
10
+ ## v3.23.21 - [December 14, 2024](https://github.com/lando/core/releases/tag/v3.23.21)
11
+
12
+ * Fixed `powershell` scripts from failing when user cannot set `-ExecutionPolicy` to `Bypass` for `Process` scope [#297](https://github.com/lando/core/issues/297)
13
+ * Fixed bug causing error when trying to add a user to a group that does not exist
14
+ * Improved Docker Desktop installation detection to prevent unneeded launch attempts
15
+ * Rebased some `wsl` helper utils on `spawn-sync-stringer` so they do not require `await`
16
+
17
+ ## v3.23.20 - [December 11, 2024](https://github.com/lando/core/releases/tag/v3.23.20)
18
+
19
+ * Simplified `lando shellenv --add` `PATH` modification string to be more universal [#298](https://github.com/lando/core/issues/298)
20
+
21
+ ## v3.23.19 - [December 7, 2024](https://github.com/lando/core/releases/tag/v3.23.19)
22
+
23
+ * Fixed bug causing auto setup to not correctly reset the orchestrator binary path
24
+ * Improved `lando init` so that it can auto setup if needed
25
+
26
+ ## v3.23.18 - [December 6, 2024](https://github.com/lando/core/releases/tag/v3.23.18)
27
+
28
+ * Improved release flow to better accommodate double barrelled development
29
+
30
+ ## v3.23.17 - [December 6, 2024](https://github.com/lando/core/releases/tag/v3.23.17)
31
+
32
+ * Improved release flow to better accommodate double barrelled development
33
+
34
+ ## v3.23.16 - [December 5, 2024](https://github.com/lando/core/releases/tag/v3.23.16)
35
+
36
+ * Fixed bug causing some `run-elevated` commands to fail on older Powershell versions
37
+ * Removed `admin` requirement to install Lando Development CA on `win32` from `wsl`
38
+
39
+ ## v3.23.15 - [December 3, 2024](https://github.com/lando/core/releases/tag/v3.23.15)
40
+
41
+ * Disabled `DOCKER_CLI_HINTS` on `lando`
42
+ * Fixed bug causing some `lando exec` and tooling commands from not inheriting terminal columns and lines correctly [#277](https://github.com/lando/core/issues/277)
43
+ * Fixed bug causing `lando setup` loop on `U Need Setup!`
44
+ * Fixed bug causing failed update message when user needs to relaunch terminal
45
+ * Improved `ux` for `autosetup`
46
+ * Standardized non-TTY renderer selection to the `simple` renderer
47
+
48
+ ## v3.23.14 - [November 27, 2024](https://github.com/lando/core/releases/tag/v3.23.14)
49
+
50
+ ### New Features & Improvements
51
+
52
+ * Added first class support to `lando setup` when run from `wsl` environments, see extended notes below
53
+ * Improved `docker` auto start on `linux` to use `GUI` authentication if available
54
+ * Improved messages and consistency between messages for `lando setup` tasks
55
+ * Improved pending setup task sort order
56
+
57
+ ### Fixes
58
+
59
+ * Fixed bug in `l337` component preventing some context files from being `COPY`ed correclty on `win32`
60
+ * Fixed bug in `docker` launching causing it to not wait until `daemon` can accept connections
61
+ * Fixed bug causing `deferred` tasks to show as `Running` instead of `Deferred`
62
+ * Fixed bug causing case insenstive group membership matching to fail on `win32`
63
+ * Fixed some failures when running in `circleci` by forcing `verbose` renderer
64
+
65
+ ### Internal
66
+
67
+ * Introduced `process.landoPlatform` which is the same as `process.platform` but includes _our_ definition of `wsl` as a platform, see extended notes below
68
+
69
+ ### Extended Notes
70
+
71
+ * Lando considers an environment a `wsl` environment only if `WSL_INTEROP` is on, otherwise it considers it a normal `linux` environment
72
+
73
+ ## v3.23.13 - [November 23, 2024](https://github.com/lando/core/releases/tag/v3.23.13)
74
+
75
+ * Fixed bug causing metrics opt-out to not work in some situations [#277](https://github.com/lando/core/issues/277)
76
+ * Updated default Docker Desktop version to `4.36.0`
77
+ * Updated default Docker Compose version to `2.30.3`
78
+ * Updated tested Docker Desktop range to `<=4.37`
79
+ * Updated tested Docker Compose range to `<=2.31`
80
+
81
+ ## v3.23.12 - [November 21, 2024](https://github.com/lando/core/releases/tag/v3.23.12)
82
+
83
+ * Fixed `lando shellenv` so it doesn't fail when `shell` profile is empty
84
+ * Fixed `lando update` so it removes lingering `lando.exe`s in the update bin directory
85
+ * Improved `lando shellenv` so that it always includes `~/.lando/bin` and includes it first
86
+ * Improved messaging on `lando shellenv --add`
87
+ * Improved messaging on `lando update` for `@lando/cli`
88
+
89
+ ## v3.23.11 - [November 20, 2024](https://github.com/lando/core/releases/tag/v3.23.11)
90
+
91
+ * This release has no new content and is just to test the new modular release flow
92
+
93
+ ## v3.23.10 - [November 20, 2024](https://github.com/lando/core/releases/tag/v3.23.10)
94
+
95
+ * This release has no new content and is just to test the new modular release flow
96
+
97
+ ## v3.23.9 - [November 20, 2024](https://github.com/lando/core/releases/tag/v3.23.9)
98
+
99
+ * This release has no new content and is just to test the new modular release flow
100
+
101
+ ## v3.23.8 - [November 20, 2024](https://github.com/lando/core/releases/tag/v3.23.8)
102
+
103
+ * This release has no new content and is just to test the new modular release flow
4
104
 
5
105
  ## v3.23.7 - [November 13, 2024](https://github.com/lando/core/releases/tag/v3.23.7)
6
106
 
package/bin/lando CHANGED
@@ -12,6 +12,7 @@
12
12
 
13
13
  // set this first for all other downstream concerns
14
14
  const dns = require('dns');
15
+
15
16
  // Set DNS result order to IPv4 first
16
17
  dns.setDefaultResultOrder('ipv4first');
17
18
 
@@ -130,6 +131,7 @@ cli.checkPerms();
130
131
 
131
132
  // Lando cache stuffs
132
133
  process.lando = 'node';
134
+ process.landoPlatform = require(`${COREBASE}/utils/is-wsl-interop`)() ? 'wsl' : process.platform;
133
135
  process.landoTaskCacheName = '_.tasks.cache';
134
136
  process.landoTaskCacheFile = path.join(cli.defaultConfig().userConfRoot, 'cache', process.landoTaskCacheName);
135
137
  process.landoAppCacheFile = !_.isEmpty(appConfig) ? appConfig.composeCache : undefined;
package/bin/lando.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\lando" %*
@@ -120,7 +120,8 @@ module.exports = {
120
120
  }
121
121
 
122
122
  // Add in some more dirz if it makes sense
123
- if (home && _.get(_app, 'config.keys', true)) volumes.push(`${path.join(home, '.ssh')}:/user/.ssh:cached`);
123
+ if (home && _.get(_app, '_config.homeMount', true)) volumes.push(`${home}:/user:cached`);
124
+ else if (home && _.get(_app, 'config.keys', true)) volumes.push(`${path.join(home, '.ssh')}:/user/.ssh:cached`);
124
125
 
125
126
  // Handle cert refresh
126
127
  // @TODO: this might only be relevant to the proxy, if so let's move it there
@@ -310,8 +310,8 @@ class L337ServiceV4 extends EventEmitter {
310
310
  file.instructions = file.url ? ['ADD'] : ['COPY'];
311
311
  if (file.owner) file.instructions.push(`--chown=${file.owner}`);
312
312
  if (file.permissions) file.instructions.push(`--chmod=${file.permissions}`);
313
- file.instructions.push(file.url ?? path.join('.', file.target));
314
- file.instructions.push(process.platform === 'win32' ? file.target : path.resolve('/', file.target));
313
+ file.instructions.push(file.url ?? path.posix.resolve('/', file.target));
314
+ file.instructions.push(path.posix.resolve('/', file.target));
315
315
  file.instructions = file.instructions.join(' ');
316
316
  }
317
317
 
package/config.yml CHANGED
@@ -13,18 +13,19 @@ dockerSupportedVersions:
13
13
  compose:
14
14
  satisfies: "1.x.x || 2.x.x"
15
15
  recommendUpdate: "<=2.24.6"
16
- tested: "<=2.29.2"
16
+ tested: "<=2.30.99"
17
17
  link:
18
18
  linux: https://docs.docker.com/compose/install/#install-compose-on-linux-systems
19
19
  darwin: https://docs.docker.com/desktop/install/mac-install/
20
20
  win32: https://docs.docker.com/desktop/install/windows-install/
21
21
  desktop:
22
22
  satisfies: ">=4.0.0 <5"
23
- tested: "<=4.35.0"
23
+ tested: "<=4.36.99"
24
24
  recommendUpdate: "<=4.34.0"
25
25
  link:
26
26
  darwin: https://docs.docker.com/desktop/install/mac-install/
27
27
  win32: https://docs.docker.com/desktop/install/windows-install/
28
+ wsl: https://docs.docker.com/desktop/install/windows-install/
28
29
  engine:
29
30
  satisfies: ">=18 <28"
30
31
  tested: "<=27.3.1"
@@ -9,38 +9,17 @@ module.exports = async lando => {
9
9
  const tasks = [{
10
10
  title: 'It seems Docker is not running, trying to start it up...',
11
11
  retry: {
12
- tries: 25,
12
+ tries: 5,
13
13
  delay: 1000,
14
14
  },
15
15
  task: async (ctx, task) => {
16
- // Prompt for sudo password if interactive and not Docker Desktop WSL2 integration
17
- if (
18
- process.platform === 'linux'
19
- && lando.config.isInteractive
20
- && !require('../utils/is-wsl-interop')(lando.engine.daemon.docker)
21
- ) {
22
- ctx.password = await task.prompt({
23
- type: 'password',
24
- name: 'password',
25
- message: `Enter computer password for ${lando.config.username} to start docker`,
26
- validate: async (input, state) => {
27
- const options = {debug, ignoreReturnCode: true, password: input};
28
- const response = await require('../utils/run-elevated')(['echo', 'hello there'], options);
29
- if (response.code !== 0) return response.stderr;
30
- return true;
31
- },
32
- onCancel() {
33
- process.emit('SIGINT');
34
- },
35
- });
36
- }
37
-
38
16
  try {
39
- await lando.engine.daemon.up(false, ctx.password);
17
+ await lando.engine.daemon.up(false);
40
18
  await lando.shell.sh([`"${lando.engine.daemon.docker}"`, 'network', 'ls']);
41
19
  } catch (error) {
42
20
  ctx.errors.push(error);
43
- throw error;
21
+ debug('%j', error);
22
+ throw new Error('Could not automatically start Docker. Please manually start it to continue.');
44
23
  }
45
24
  },
46
25
  }];
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ module.exports = async lando => {
4
+ // get the user setup defaults
5
+ const sopts = lando?.config?.setup;
6
+ // skip common plugins for now?
7
+ sopts.skipCommonPlugins = true;
8
+ // we dont need to show the summary here
9
+ sopts.yes = true;
10
+
11
+ // get our setup tasks
12
+ const tasks = await lando.getSetupStatus(sopts);
13
+
14
+ // do we need to install anything?
15
+ // @NOTE: is it right to include CANT INSTALL in here?
16
+ const notInstalled = tasks.filter(task => task.state !== 'INSTALLED');
17
+
18
+ // try to run setup if needed
19
+ if (notInstalled.length > 0) {
20
+ // should we show the header
21
+ const showHeader = notInstalled.find(task => {
22
+ if (task.id === 'setup-build-engine') return true;
23
+ if (task.restart) return true;
24
+ return false;
25
+ });
26
+
27
+ try {
28
+ // if not yes then show full setup banner?
29
+ if (showHeader && lando.cli) console.error(lando.cli.makeArt('runningSetup'));
30
+ // run setup
31
+ await lando.setup(sopts);
32
+ // reload plugins
33
+ await lando.reloadPlugins();
34
+ // reload needed config
35
+ const {orchestratorBin, orchestratorVersion, dockerBin, engineConfig} = require('../utils/build-config')(lando.config);
36
+ // reset needed config
37
+ lando.config = {...lando.config, orchestratorBin, orchestratorVersion, dockerBin, engineConfig};
38
+ // we need to explicitly reset this for some reason
39
+ lando.config.orchestratorBin = require('../utils/get-compose-x')(lando.config);
40
+
41
+ // reload engine
42
+ lando.engine = require('../utils/setup-engine')(
43
+ lando.config,
44
+ lando.cache,
45
+ lando.events,
46
+ lando.log,
47
+ lando.shell,
48
+ lando.config.instance,
49
+ );
50
+
51
+ // @TODO: rerun task?
52
+ } catch (error) {
53
+ if (lando.cli) console.error(lando.cli.makeArt('needsSetup'));
54
+ console.error(error);
55
+ throw Error('Critical dependencies could not be installed!');
56
+ }
57
+ }
58
+ };
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const axios = require('../utils/get-axios')();
4
+ const fs = require('fs');
5
+ const getDockerDesktopBin = require('../utils/get-docker-desktop-x');
4
6
  const os = require('os');
5
7
  const path = require('path');
6
8
  const semver = require('semver');
@@ -8,6 +10,9 @@ const semver = require('semver');
8
10
  const {color} = require('listr2');
9
11
 
10
12
  const buildIds = {
13
+ '4.36.0': '175267',
14
+ '4.35.1': '173168',
15
+ '4.35.0': '172550',
11
16
  '4.34.3': '170107',
12
17
  '4.34.2': '167172',
13
18
  '4.34.0': '165256',
@@ -49,7 +54,7 @@ const getVersion = version => {
49
54
  /*
50
55
  * Helper to get docker compose v2 download url
51
56
  */
52
- const getEngineDownloadUrl = (id = '170107') => {
57
+ const getEngineDownloadUrl = (id = '175267') => {
53
58
  const arch = process.arch === 'arm64' ? 'arm64' : 'amd64';
54
59
  return `https://desktop.docker.com/mac/main/${arch}/${id}/Docker.dmg`;
55
60
  };
@@ -92,21 +97,17 @@ module.exports = async (lando, options) => {
92
97
 
93
98
  // darwin install task
94
99
  options.tasks.push({
95
- title: `Downloading build engine`,
100
+ title: 'Downloading build engine',
96
101
  id: 'setup-build-engine',
97
- description: `@lando/build-engine (docker-desktop)`,
98
- version: `docker-desktop ${install}`,
102
+ description: '@lando/build-engine (docker-desktop)',
103
+ version: `Docker Desktop ${install}`,
99
104
  hasRun: async () => {
100
- // start by looking at the engine install status
101
- // @NOTE: is this always defined?
102
- if (lando.engine.dockerInstalled === false) return false;
105
+ // if we are missing any files we can check then terminate here
106
+ if (lando.engine.dockerInstalled === false || !fs.existsSync(getDockerDesktopBin())) return false;
103
107
 
104
108
  // if we get here let's make sure the engine is on
105
109
  try {
106
- await lando.engine.daemon.up();
107
- const BuildEngine = require('../components/docker-engine');
108
- const bengine = new BuildEngine(lando.config.buildEngine, {debug});
109
- await bengine.info();
110
+ await lando.engine.daemon.up({max: 1, backoff: 1000});
110
111
  return true;
111
112
  } catch (error) {
112
113
  lando.log.debug('docker install task has not run %j', error);
@@ -163,7 +164,7 @@ module.exports = async (lando, options) => {
163
164
  result.download = ctx.download;
164
165
 
165
166
  // finish up
166
- task.title = 'Installed build engine to /Applications/Docker.app';
167
+ task.title = 'Installed build engine (Docker Desktop) to /Applications/Docker.app';
167
168
  return result;
168
169
  } catch (error) {
169
170
  throw error;
@@ -39,11 +39,20 @@ module.exports = async (lando, options) => {
39
39
  title: `Installing build engine`,
40
40
  id: 'setup-build-engine',
41
41
  description: `@lando/build-engine (docker-engine)`,
42
- version: `docker-engine ${version}`,
42
+ version: `Docker Engine ${version}`,
43
43
  hasRun: async () => {
44
44
  // start by looking at the engine install status
45
45
  // @NOTE: is this always defined?
46
- return lando.engine.dockerInstalled;
46
+ if (lando.engine.dockerInstalled === false) return false;
47
+
48
+ // if we get here let's make sure the engine is on
49
+ try {
50
+ await lando.engine.daemon.up({max: 1, backoff: 1000});
51
+ return true;
52
+ } catch (error) {
53
+ lando.log.debug('docker install task has not run %j', error);
54
+ return false;
55
+ }
47
56
  },
48
57
  canRun: async () => {
49
58
  // throw if we cannot resolve a semantic version to a buildid
@@ -93,7 +102,7 @@ module.exports = async (lando, options) => {
93
102
  result.download = ctx.download;
94
103
 
95
104
  // finish up
96
- task.title = 'Installed build engine to /usr/bin/docker';
105
+ task.title = 'Installed build engine (Docker Engine) to /usr/bin/docker';
97
106
  return result;
98
107
  } catch (error) {
99
108
  throw error;
@@ -132,7 +141,8 @@ module.exports = async (lando, options) => {
132
141
  }
133
142
 
134
143
  try {
135
- const command = ['usermod', '-aG', 'docker', lando.config.username];
144
+ const script = path.join(lando.config.userConfRoot, 'scripts', 'add-to-group.sh');
145
+ const command = [script, '--user', lando.config.username, '--group', 'docker'];
136
146
  const response = await require('../utils/run-elevated')(command, {debug, password: ctx.password});
137
147
  task.title = `Added ${lando.config.username} to docker group`;
138
148
  return response;
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const axios = require('../utils/get-axios')();
4
+ const fs = require('fs');
5
+ const getDockerDesktopBin = require('../utils/get-docker-desktop-x');
4
6
  const os = require('os');
5
7
  const path = require('path');
6
8
  const semver = require('semver');
@@ -8,6 +10,9 @@ const {color} = require('listr2');
8
10
  const {nanoid} = require('nanoid');
9
11
 
10
12
  const buildIds = {
13
+ '4.36.0': '175267',
14
+ '4.35.1': '173168',
15
+ '4.35.0': '172550',
11
16
  '4.34.3': '170107',
12
17
  '4.34.2': '167172',
13
18
  '4.34.1': '166053',
@@ -50,7 +55,7 @@ const getVersion = version => {
50
55
  /*
51
56
  * Helper to get docker compose v2 download url
52
57
  */
53
- const getEngineDownloadUrl = (id = '170107') => {
58
+ const getEngineDownloadUrl = (id = '175267') => {
54
59
  const arch = process.arch === 'arm64' ? 'arm64' : 'amd64';
55
60
  return `https://desktop.docker.com/win/main/${arch}/${id}/Docker%20Desktop%20Installer.exe`;
56
61
  };
@@ -93,28 +98,24 @@ module.exports = async (lando, options) => {
93
98
  const version = getVersion(options.buildEngine);
94
99
 
95
100
  // cosmetics
96
- const buildEngine = process.platform === 'linux' ? 'docker-engine' : 'docker-desktop';
97
101
  const install = version ? `v${version}` : `build ${build}`;
98
102
 
103
+ // download url
99
104
  const url = getEngineDownloadUrl(build);
100
105
 
101
106
  // win32 install docker desktop task
102
107
  options.tasks.push({
103
- title: `Downloading build engine`,
108
+ title: 'Downloading build engine',
104
109
  id: 'setup-build-engine',
105
- description: `@lando/build-engine (${buildEngine})`,
106
- version: `${buildEngine} ${install}`,
110
+ description: '@lando/build-engine (docker-desktop)',
111
+ version: `Docker Desktop ${install}`,
107
112
  hasRun: async () => {
108
- // start by looking at the engine install status
109
- // @NOTE: is this always defined?
110
- if (lando.engine.dockerInstalled === false) return false;
113
+ // if we are missing any files we can check then terminate here
114
+ if (lando.engine.dockerInstalled === false || !fs.existsSync(getDockerDesktopBin())) return false;
111
115
 
112
116
  // if we get here let's make sure the engine is on
113
117
  try {
114
- await lando.engine.daemon.up();
115
- const BuildEngine = require('../components/docker-engine');
116
- const bengine = new BuildEngine(lando.config.buildEngine, {debug});
117
- await bengine.info();
118
+ await lando.engine.daemon.up({max: 5, backoff: 1000});
118
119
  return true;
119
120
  } catch (error) {
120
121
  lando.log.debug('docker install task has not run %j', error);
@@ -141,7 +142,7 @@ module.exports = async (lando, options) => {
141
142
  // download the installer
142
143
  ctx.download = await downloadDockerDesktop(url, {ctx, debug, task});
143
144
  // script
144
- const script = [path.join(lando.config.userConfRoot, 'scripts', 'install-docker-desktop.ps1')];
145
+ const script = path.join(lando.config.userConfRoot, 'scripts', 'install-docker-desktop.ps1');
145
146
  // args
146
147
  const args = ['-Installer', ctx.download.dest];
147
148
  if (options.buildEngineAcceptLicense) args.push('-AcceptLicense');
@@ -154,7 +155,7 @@ module.exports = async (lando, options) => {
154
155
 
155
156
  // finish up
156
157
  const location = process.env.ProgramW6432 ?? process.env.ProgramFiles;
157
- task.title = `Installed build engine to ${location}/Docker/Docker!`;
158
+ task.title = `Installed build engine (Docker Desktop) to ${location}/Docker/Docker!`;
158
159
  return result;
159
160
  } catch (error) {
160
161
  throw error;
@@ -176,14 +177,20 @@ module.exports = async (lando, options) => {
176
177
  // check one last time incase this was added by a dependee or otherwise
177
178
  if (require('../utils/is-group-member')('docker-users')) return {code: 0};
178
179
 
179
- try {
180
- const command = ['net', 'localgroup', 'docker-users', lando.config.username, '/ADD'];
181
- const response = await require('../utils/run-elevated')(command, {debug});
182
- task.title = `Added ${lando.config.username} to docker-users`;
183
- return response;
184
- } catch (error) {
180
+ const command = ['net', 'localgroup', 'docker-users', lando.config.username, '/ADD'];
181
+ const {code, stdout, stderr} = await require('../utils/run-elevated')(command, {ignoreReturnCode: true, debug});
182
+
183
+ // fail on anything except 1378 which is user already exists
184
+ if (code !== 0 && (!stderr.includes('1378') || !stderr.includes('already a member'))) {
185
+ const error = new Error(`Error adding ${lando.config.username} to the docker-users group!`);
186
+ error.code = code;
187
+ error.stdout = stdout;
188
+ error.stderr = stderr;
185
189
  throw error;
186
190
  }
191
+
192
+ task.title = `Added ${lando.config.username} to docker-users`;
193
+ return {code, stdout, stderr};
187
194
  },
188
195
  });
189
196
  };