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

Pirog93 #201

Merged
merged 7 commits into from
Sep 4, 2024
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
49 changes: 48 additions & 1 deletion .github/workflows/pr-docs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
node-version:
- "18"
steps:
# Install deps and cache
- name: Checkout code
uses: actions/checkout@v4
- name: Install node ${{ matrix.node-version }}
Expand All @@ -32,3 +31,51 @@ jobs:
run: npm run lint
- name: Test build
run: npm run docs:build

lando-docs-tests:
runs-on: ${{ matrix.os }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: "@lando/*"
strategy:
matrix:
lando-version:
# - 3-slim
# uncomment to test against edge cli
- 3-edge-slim
# uncomment to test against dev cli
# - 3-dev-slim
os:
- ubuntu-24.04
node-version:
- "18"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile
- name: Bundle Deps
uses: lando/prepare-release-action@v3
with:
lando-plugin: true
version: dev
sync: false
# note that we need a custom auto-setup command because dogfooding core can impact the
# subsequent lando setup
- name: Setup lando ${{ matrix.lando-version }}
uses: lando/setup-lando@v3
with:
auto-setup: lando plugin-add @lando/core@file:${{ github.workspace }} && lando setup
lando-version: ${{ matrix.lando-version }}
telemetry: false
config: |
setup.skipCommonPlugins=true
- name: Lando tests
run: |
lando start
lando vitepress build docs
29 changes: 15 additions & 14 deletions .lando.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
name: core.docs
proxy:
cli:
- core.docs.lndo.site:5173
services:
cli:
api: 3
type: lando
services:
image: node:16
command: sleep infinity
working_dir: /app
ports:
- 8080:8080
build:
- npm install
api: 4
image: node:18
command: sleep infinity
ports:
- 5173:5173/http
scanner: false
ssl: false
sslExpose: false
user: node
build:
app: |
npm install
tooling:
node:
service: cli
vuepress:
service: cli
npm:
service: cli
vitepress:
service: cli
cmd: npx vitepress
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

### New Features

* Updated default Docker Compose version to `2.29.2`
* Updated default Docker Desktop version to `4.34.0`
* Updated default Docker Engine version to `27.2.0`
* Updated tested Docker Desktop range to `<=4.34`
* Updated tested Docker Compose range to `<=2.29.2`

### Bug Fixes

* Fixed bug causing autosetup to still `U Need Setup` after installing new orchestrator on `lando start`y events
* Fixed bug preventing non-boot image build hooks from running
* Fixed bug causing hook files to be `COPY`ed to early in Imagefile
* Fixed bug causing `appMount` to be not correctly added as a `git` `safe.directory`

## v3.22.0-beta.4 - [August 30, 2024](https://github.com/lando/core/releases/tag/v3.22.0-beta.4)

## Bug Fixes
Expand Down
3 changes: 3 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ module.exports = async (app, lando) => {
// v4 parts of the app are ready
app.events.on('ready', 6, async () => await require('./hooks/app-v4-ready')(app, lando));

// this is a gross hack we need to do to reset the engine because the lando 3 runtime has no idea
app.events.on('ready-engine', 1, async () => await require('./hooks/app-reset-orchestrator')(app, lando));

// Discover portforward true info
app.events.on('ready-engine', async () => await require('./hooks/app-set-portforwards')(app, lando));

Expand Down
16 changes: 13 additions & 3 deletions builders/lando-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,24 @@ module.exports = {
}

#setupHooks() {
for (const hook of Object.keys(this._data.groups).filter(group => parseInt(group.weight) <= 100)) {
// filter out early stage hooks
const groups = this?._data?.groups ?? {};
const hooks = Object.keys(this._data.groups)
.filter(group => parseInt(groups?.[group]?.weight ?? 1000) > 100)
.map(group => ([group, groups?.[group]?.user ?? 'root']));

// add hooks for each post boot image build group
for (const [hook, user] of hooks) {
this.addSteps({group: hook, instructions: `
USER root
RUN mkdir -p /etc/lando/build/image/${hook}.d
USER ${user}
RUN /etc/lando/run-hooks.sh image ${hook}
`});
}
}


#setupStorage() {
// add top level volumes
this.tlvolumes = Object.fromEntries(this.storage
Expand Down Expand Up @@ -366,8 +376,8 @@ module.exports = {
// image stage should add directly to the build context
if (stage === 'image') {
this.addContext(
`${file}:/etc/lando/build/image/${hook}.d/${priority}-${path.basename(file)}`,
`${hook}-1000-before`,
`${file}:/etc/lando/build/image/${hook}.d/${path.basename(file)}`,
`${hook}-1-before`,
);

// app context should mount into the app
Expand Down
6 changes: 3 additions & 3 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ dockerSupportedVersions:
compose:
satisfies: "1.x.x || 2.x.x"
recommendUpdate: "<=2.24.6"
tested: "<=2.27.1"
tested: "<=2.29.2"
link:
linux: https://docs.docker.com/compose/install/#install-compose-on-linux-systems
darwin: https://docs.docker.com/desktop/install/mac-install/
win32: https://docs.docker.com/desktop/install/windows-install/
desktop:
satisfies: ">=4.0.0 <5"
tested: "<=4.32.0"
tested: "<=4.34.0"
recommendUpdate: "<=4.28.0"
link:
darwin: https://docs.docker.com/desktop/install/mac-install/
win32: https://docs.docker.com/desktop/install/windows-install/
engine:
satisfies: ">=18 <28"
tested: "<=27.0.3"
tested: "<=27.2.0"
link:
linux: https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script

Expand Down
22 changes: 22 additions & 0 deletions hooks/app-reset-orchestrator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

module.exports = async (app, lando) => {
// if we dont have an orchestrator bin yet then discover it
if (!!!lando.config.orchestratorBin) lando.config.orchestratorBin = require('../utils/get-compose-x')(lando.config);

// because the entire lando 3 runtime was made in a bygone era when we never dreamed of doing stuff like this
// we need this workaround
if (lando._bootstrapLevel >= 3 && !app.engine.composeInstalled) {
app.engine = require('../utils/setup-engine')(
lando.config,
lando.cache,
lando.events,
app.log,
app.shell,
lando.config.instance,
);
}

// log our sitch
app.log.debug('using docker-compose %s', lando.config.orchestratorBin);
};
6 changes: 3 additions & 3 deletions hooks/lando-setup-build-engine-darwin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
const os = require('os');
const path = require('path');
const semver = require('semver');

const {color} = require('listr2');

const buildIds = {
'4.34.0': '165256',
'4.33.0': '160616',
'4.32.0': '157355',
'4.31.0': '153195',
'4.30.0': '149282',
Expand Down Expand Up @@ -44,7 +44,7 @@ const getVersion = version => {
/*
* Helper to get docker compose v2 download url
*/
const getEngineDownloadUrl = (id = '126437') => {
const getEngineDownloadUrl = (id = '165256') => {
const arch = process.arch === 'arm64' ? 'arm64' : 'amd64';
return `https://desktop.docker.com/mac/main/${arch}/${id}/Docker.dmg`;
};
Expand Down
5 changes: 4 additions & 1 deletion hooks/lando-setup-build-engine-win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const {color} = require('listr2');
const {nanoid} = require('nanoid');

const buildIds = {
'4.34.0': '165256',
'4.33.1': '161083',
'4.33.0': '160616',
'4.32.0': '157355',
'4.31.1': '153621',
'4.31.0': '153195',
Expand Down Expand Up @@ -43,7 +46,7 @@ const getVersion = version => {
/*
* Helper to get docker compose v2 download url
*/
const getEngineDownloadUrl = (id = '126437') => {
const getEngineDownloadUrl = (id = '165256') => {
const arch = process.arch === 'arm64' ? 'arm64' : 'amd64';
return `https://desktop.docker.com/win/main/${arch}/${id}/Docker%20Desktop%20Installer.exe`;
};
Expand Down
1 change: 1 addition & 0 deletions hooks/lando-setup-install-ca-win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = async (lando, options) => {

// finish up
task.title = 'Installed Lando Development Certificate Authority (CA)';

return result;
} catch (error) {
throw error;
Expand Down
4 changes: 2 additions & 2 deletions hooks/lando-setup-orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const path = require('path');
/*
* Helper to get docker compose v2 download url
*/
const getComposeDownloadUrl = (version = '2.27.1') => {
const getComposeDownloadUrl = (version = '2.29.2') => {
const mv = version.split('.')[0] > 1 ? '2' : '1';
const arch = process.arch === 'arm64' ? 'aarch64' : 'x86_64';
const toggle = `${process.platform}-${mv}`;
Expand All @@ -30,7 +30,7 @@ const getComposeDownloadUrl = (version = '2.27.1') => {
/*
* Helper to get docker compose v2 download destination
*/
const getComposeDownloadDest = (base, version = '2.27.1') => {
const getComposeDownloadDest = (base, version = '2.29.2') => {
switch (process.platform) {
case 'linux':
case 'darwin':
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ module.exports = async lando => {
// flush update cache if it needs to be
lando.events.on('ready', async () => await require('./hooks/lando-flush-updates-cache')(lando));

// this is a gross hack we need to do to reset the engine because the lando 3 runtime had no idea
// this is a gross hack we need to do to reset the engine because the lando 3 runtime has no idea
lando.events.on('almost-ready', 1, async () => await require('./hooks/lando-reset-orchestrator')(lando));
lando.events.on('post-setup', 1, async () => await require('./hooks/lando-reset-orchestrator')(lando));

// run engine compat checks
lando.events.on('almost-ready', 2, async () => await require('./hooks/lando-get-compat')(lando));
Expand Down
1 change: 1 addition & 0 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ module.exports = class App {
this.shell,
lando.config.instance,
);

this.metrics = require('../utils/setup-metrics')(this.log, lando.config);
this.Promise = lando.Promise;
this.events = new AsyncEvents(this.log);
Expand Down
2 changes: 1 addition & 1 deletion lib/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = class LandoDaemon {
log = new Log(),
context = 'node',
compose = require('../utils/get-compose-x')(),
orchestratorVersion = '2.27.1',
orchestratorVersion = '2.29.2',
userConfRoot = path.join(os.homedir(), '.lando'),
) {
this.cache = cache;
Expand Down
2 changes: 1 addition & 1 deletion lib/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ module.exports = class Shell {
// Return
_.remove(this.running, proc => proc.id === id);

return (code !== 0) ? Promise.reject(new Error(stderr)) : Promise.resolve(stdout);
return (code !== 0) ? Promise.reject(new Error(stderr ?? stdout)) : Promise.resolve(stdout);
});
};

Expand Down
5 changes: 2 additions & 3 deletions packages/git/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ const path = require('path');
module.exports = async service => {
service.addHookFile(path.join(__dirname, 'install-git.sh'), {hook: 'boot'});
service.addHookFile(`
# temp stuff for demo purposes
if command -v git > /dev/null 2>&1; then
git config --global --add safe.directory ${service.appMount}
git config --system --add safe.directory ${service.appMount}
fi
`, {stage: 'app', hook: 'internal-root', id: 'git-safe'});
`, {hook: 'tooling', priority: 0});
};
5 changes: 4 additions & 1 deletion plugins/proxy/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ module.exports = (app, lando) => {
})

// Warn the user if this fails
.catch(error => app.addWarning(require('./messages/cannot-start-proxy-warning')(error.message), error));
.catch(error => {
if (!error.message || error.message === '') error.message = 'UNKNOWN ERROR';
app.addWarning(require('./messages/cannot-start-proxy-warning')(error.message), error);
});
});

// Add proxy URLS to our app info
Expand Down
2 changes: 1 addition & 1 deletion utils/get-compose-x.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const getDockerBin = (bin, base, pathFallback = true) => {
}
};

module.exports = ({orchestratorVersion = '2.27.1', userConfRoot = os.tmpdir()} = {}) => {
module.exports = ({orchestratorVersion = '2.29.2', userConfRoot = os.tmpdir()} = {}) => {
const orchestratorBin = `docker-compose-v${orchestratorVersion}`;
switch (process.platform) {
case 'darwin':
Expand Down
8 changes: 4 additions & 4 deletions utils/get-config-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ const os = require('os');
const getBuildEngineVersion = () => {
switch (process.platform) {
case 'darwin':
return '4.32.0';
return '4.34.0';
case 'linux':
return '27.0.3';
return '27.2.0';
case 'win32':
return '4.32.0';
return '4.34.0';
}
};

// Default config
const defaultConfig = options => ({
orchestratorSeparator: '_',
orchestratorVersion: '2.27.1',
orchestratorVersion: '2.29.2',
configSources: [],
disablePlugins: [],
dockerBin: require('../utils/get-docker-x')(),
Expand Down
Loading