Skip to content
Draft
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
9 changes: 9 additions & 0 deletions packages/backend/src/services/quadlet-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import { isRunError } from '../utils/run-error';
import templates from '../assets/templates.json';
import type { Template } from '/@shared/src/models/template';
import type { PodmanWorker } from '../utils/worker/podman-worker';
import { lt, coerce } from 'semver';

export const QUADLET_MIN_STABLE = '5.3.0';

export class QuadletService extends QuadletHelper implements Disposable, AsyncInit {
#extensionsEventDisposable: Disposable | undefined;
Expand Down Expand Up @@ -192,6 +195,12 @@ export class QuadletService extends QuadletHelper implements Disposable, AsyncIn
`[QuadletService] found quadlet version ${quadletVersion} for connection ${provider.connection.name} of provider ${provider.providerId}`,
);

// warn user depending on quadlet version
const coerced = coerce(quadletVersion);
if (coerced && lt(coerced, QUADLET_MIN_STABLE)) {
console.warn(`connection ${provider.connection.name} uses an old quadlet version: ${quadletVersion}`);
}

// 3. get the quadlets
const quadlets = await this.getPodmanQuadlets({ provider, admin: false });

Expand Down
8 changes: 6 additions & 2 deletions packages/backend/src/utils/parsers/quadlet-dryrun-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ export class QuadletDryRunParser extends Parser<RunResult & { exitCode?: number
const serviceName = match[1].trim();

// parse the quadlet unit
const quadletUnitParser = new QuadletUnitParser(serviceName, match[2].trim());
this.services[serviceName] = quadletUnitParser.parse();
try {
const quadletUnitParser = new QuadletUnitParser(serviceName, match[2].trim());
this.services[serviceName] = quadletUnitParser.parse();
} catch (err: unknown) {
console.error(`cannot parse ${serviceName}`, err);
}
}

this.parsed = true;
Expand Down