Skip to content
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

#322: comma path test #328

Merged
merged 4 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/pr-core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
leia-test:
- badname
- build
- c,o,m,m,a
- cache
- certs
- config
Expand Down Expand Up @@ -93,7 +94,7 @@ jobs:
- name: Install pkg dependencies
run: npm clean-install --prefer-offline --frozen-lockfile --production
- name: Package into node binary
uses: lando/pkg-action@v5
uses: lando/pkg-action@v6
id: pkg-action
with:
entrypoint: bin/lando
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-docs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Install pkg dependencies
run: npm clean-install --prefer-offline --frozen-lockfile --production
- name: Package into node binary
uses: lando/pkg-action@v5
uses: lando/pkg-action@v6
id: pkg-action
with:
entrypoint: bin/lando
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-setup-linux-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Install pkg dependencies
run: npm clean-install --prefer-offline --frozen-lockfile --production
- name: Package into node binary
uses: lando/pkg-action@v5
uses: lando/pkg-action@v6
id: pkg-action
with:
entrypoint: bin/lando
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-setup-macos-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install pkg dependencies
run: npm clean-install --prefer-offline --frozen-lockfile --production
- name: Package into node binary
uses: lando/pkg-action@v5
uses: lando/pkg-action@v6
id: pkg-action
with:
entrypoint: bin/lando
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-setup-windows-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Install pkg dependencies
run: npm clean-install --prefer-offline --frozen-lockfile --production
- name: Package into node binary
uses: lando/pkg-action@v5
uses: lando/pkg-action@v6
id: pkg-action
with:
entrypoint: bin/lando
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

* Fixed bug where an app’s services were inadvertently reaped if the app’s path included a comma [#322](https://github.com/lando/core/issues/322)

## v3.23.25 - [January 18, 2025](https://github.com/lando/core/releases/tag/v3.23.25)

* Fixed bug causing `--accept-license` flag to not work when installing Docker Desktop on macOS
Expand Down
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ module.exports = async (app, lando) => {
BITNAMI_DEBUG: 'true',
},
labels: {
'io.lando.landofiles': app.configFiles.map(file => path.basename(file)).join(','),
'io.lando.root': app.root,
'io.lando.src': app.configFiles.join(','),
'io.lando.http-ports': '80,443',
},
Expand Down
3 changes: 3 additions & 0 deletions builders/lando-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,10 @@ module.exports = {
const labels = merge({}, app.labels, {
'dev.lando.container': 'TRUE',
'dev.lando.id': lando.config.id,
'dev.lando.landofiles': app.configFiles.map(file => path.basename(file)).join(','),
'dev.lando.root': app.root,
'dev.lando.src': app.root,
'io.lando.http-ports': '80,443',
}, config.labels);

// add it all 2getha
Expand Down
23 changes: 23 additions & 0 deletions examples/c,o,m,m,a/.lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: commapp
services:
defaults:
type: lando
services:
image: nginx:1.22.1
command: /docker-entrypoint.sh nginx -g "daemon off;"
ports:
- 80
volumes:
- ./:/usr/share/nginx/html:ro

defaults-v4:
api: 4
type: l337
image: nginx:1.22.1
ports:
- 80
volumes:
- ./:/usr/share/nginx/html:ro

plugins:
"@lando/core": "../.."
35 changes: 35 additions & 0 deletions examples/c,o,m,m,a/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# C,O,M,M,A Example

This example exists primarily to test the following:

* [Issue #322](https://github.com/lando/core/issues/322)

## Start up tests

Run the following commands to get up and running with this example.

```bash
# Should start up successfully
lando poweroff
lando start
```

## Verification commands

Run the following commands to validate things are rolling as they should.

```bash
# Should serve from the app root by default
lando exec defaults -- curl http://localhost | grep ROOTDIR
lando exec defaults-v4 -- curl http://localhost | grep ROOTDIR
```

## Destroy tests

Run the following commands to trash this app like nothing ever happened.

```bash
# Should be destroyed with success
lando destroy -y
lando poweroff
```
1 change: 1 addition & 0 deletions examples/c,o,m,m,a/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ROOTDIR
2 changes: 2 additions & 0 deletions examples/lando-v4/.lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ services:
# build
# files

# check labels

# appmount
# support appMount but prefer app-mount
# project-mount: /project how does this work?
Expand Down
18 changes: 16 additions & 2 deletions utils/to-lando-container.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
'use strict';

module.exports = ({Labels, Id, Status}, separator = '_') => {
const path = require('path');

module.exports = ({Labels, Id, Status}, separator = '_', src = []) => {
// Get name of docker container.
const app = Labels['com.docker.compose.project'];
const service = Labels['com.docker.compose.service'];
const num = Labels['com.docker.compose.container-number'];
const lando = Labels['io.lando.container'];
const special = Labels['io.lando.service-container'];

// if we have io.lando.root and io.lando.
if (Labels['io.lando.root'] && Labels['io.lando.landofiles']) {
src = Labels['io.lando.landofiles'].split(',').map(landofile => path.join(Labels['io.lando.root'], landofile));

// or legacy support for Labels['io.lando.src']
} else if (Labels['io.lando.src']) {
src = Labels['io.lando.src'].split(',');

// or its just unknown
} else src = 'unknown';

// Build generic container.
return {
id: Id,
service: service,
name: [app, service, num].join(separator),
app: (special !== 'TRUE') ? app : '_global_',
src: (Labels['io.lando.src']) ? Labels['io.lando.src'].split(',') : 'unknown',
kind: (special !== 'TRUE') ? 'app' : 'service',
lando: (lando === 'TRUE') ? true : false,
instance: Labels['io.lando.id'] || 'unknown',
status: Status,
src,
};
};
Loading