diff --git a/CHANGELOG.md b/CHANGELOG.md index 319c6e015..4cba70c7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) +* Merged in improvements from `@lando/core@v3.23.23` + ## v3.24.0-beta.8 - [December 14, 2024](https://github.com/lando/core/releases/tag/v3.24.0-beta.8) * Merged in improvements from `@lando/core@v3.23.21` @@ -30,6 +32,10 @@ * Fixed bug causing auto setup to not correctly reset the orchestrator binary path * Improved `lando init` so that it can auto setup if needed +## v3.23.23 - [January 14, 2025](https://github.com/lando/core/releases/tag/v3.23.23) + +* Fixed bug causing service script loading collisions + ## v3.23.22 - [December 17, 2024](https://github.com/lando/core/releases/tag/v3.23.22) * Added ability to customize `networkLimit` [#245](https://github.com/lando/core/pull/245) diff --git a/builders/_lando.js b/builders/_lando.js index 3b3855b7a..f8d17e9a7 100644 --- a/builders/_lando.js +++ b/builders/_lando.js @@ -45,6 +45,7 @@ module.exports = { refreshCerts = false, remoteFiles = {}, scripts = [], + scriptsDir = '', sport = '443', ssl = false, sslExpose = true, @@ -70,16 +71,23 @@ module.exports = { console.error(color.yellow(`${type} version ${version} is a legacy version! We recommend upgrading.`)); } + // normalize scripts dir if needed + if (!path.isAbsolute(scriptsDir)) scriptsDir = path.resolve(root, scriptsDir); + + // Get some basic locations + const globalScriptsDir = path.join(userConfRoot, 'scripts'); + const serviceScriptsDir = path.join(userConfRoot, 'helpers', project, type, name); + const entrypointScript = path.join(globalScriptsDir, 'lando-entrypoint.sh'); + const addCertsScript = path.join(globalScriptsDir, 'add-cert.sh'); + const refreshCertsScript = path.join(globalScriptsDir, 'refresh-certs.sh'); + // Move our config into the userconfroot if we have some // NOTE: we need to do this because on macOS and Windows not all host files // are shared into the docker vm if (fs.existsSync(confSrc)) require('../utils/move-config')(confSrc, confDest); - // Get some basic locations - const scriptsDir = path.join(userConfRoot, 'scripts'); - const entrypointScript = path.join(scriptsDir, 'lando-entrypoint.sh'); - const addCertsScript = path.join(scriptsDir, 'add-cert.sh'); - const refreshCertsScript = path.join(scriptsDir, 'refresh-certs.sh'); + // ditto for service helpers + if (fs.existsSync(scriptsDir)) require('../utils/move-config')(scriptsDir, serviceScriptsDir); // Handle Environment const environment = { @@ -98,11 +106,14 @@ module.exports = { // Handle volumes const volumes = [ `${userConfRoot}:/lando:cached`, - `${scriptsDir}:/helpers`, + `${globalScriptsDir}:/helpers`, `${entrypointScript}:/lando-entrypoint.sh`, `${dataHome}:/var/www`, ]; + // add in service helpers if we have them + if (fs.existsSync(serviceScriptsDir)) volumes.push(`${serviceScriptsDir}:/etc/lando/service/helpers`); + // Handle ssl if (ssl) { // also expose the sport diff --git a/examples/tooling/.lando.yml b/examples/tooling/.lando.yml index 54ec51180..6c8a4d02e 100644 --- a/examples/tooling/.lando.yml +++ b/examples/tooling/.lando.yml @@ -10,6 +10,7 @@ services: api: 3 type: lando meUser: node + scriptsDir: scripts services: image: node:16 command: docker-entrypoint.sh tail -f /dev/null @@ -311,6 +312,19 @@ tooling: arg2: describe: Uses arg2 type: string + sdargs: + cmd: /etc/lando/service/helpers/args.sh + service: node + positionals: + arg1: + describe: Uses arg1 + type: string + choices: + - thing + - stuff + arg2: + describe: Uses arg2 + type: string plugins: "@lando/core": ../.. diff --git a/examples/tooling/README.md b/examples/tooling/README.md index 188f5aaa4..83b59cc00 100644 --- a/examples/tooling/README.md +++ b/examples/tooling/README.md @@ -172,6 +172,10 @@ lando everything --help | grep "lando everything \[arg1\] \[arg2\] MORETHINGS" # Should allow for example pasthru in task definition lando everything --help | grep "lando this is just for testing" +# Should be able to access scriptsDir from the landofile +lando exec node -- stat /etc/lando/service/helpers/args.sh +lando sdargs hello there | grep "hello there" + # Should be able to run even if options are empty lando emptyopter diff --git a/examples/tooling/scripts/args.sh b/examples/tooling/scripts/args.sh new file mode 100755 index 000000000..b00e31206 --- /dev/null +++ b/examples/tooling/scripts/args.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "$1 $2" diff --git a/netlify.toml b/netlify.toml index 554d1debf..1c79b4c45 100644 --- a/netlify.toml +++ b/netlify.toml @@ -20,6 +20,7 @@ "https://docs.google.com/document", "https://docs.google.com/forms", "https://github.com", + "https://www.drupal.org/community/events", "/v/" ] skipPatterns = [ diff --git a/release-aliases/3-STABLE b/release-aliases/3-STABLE index 71f6f0f88..ca6ec96f5 100644 --- a/release-aliases/3-STABLE +++ b/release-aliases/3-STABLE @@ -1 +1 @@ -v3.23.22 +v3.23.23 diff --git a/utils/get-config-defaults.js b/utils/get-config-defaults.js index edfa639de..e595e188d 100644 --- a/utils/get-config-defaults.js +++ b/utils/get-config-defaults.js @@ -31,6 +31,7 @@ const defaultConfig = options => ({ home: os.homedir(), isArmed: _.includes(['arm64', 'aarch64'], process.arch), logLevel: 'debug', + networkLimit: 32, node: process.version, os: { type: os.type(),