Skip to content

Commit 15a488a

Browse files
Add --skip-compose-validation to build command (#472)
* remove composeSafeKeys export and delete params.ts file * remove file not existing * implement skipComposeValidation * add arg
1 parent e156ed9 commit 15a488a

14 files changed

Lines changed: 44 additions & 49 deletions

File tree

src/commands/build/handler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export async function buildHandler({
2222
all_variants: allVariants,
2323
variants_dir_name: variantsDirName = defaultVariantsDirName,
2424
variants,
25+
skip_compose_validation: skipComposeValidation,
2526
// Global options
2627
dir = defaultDir,
2728
compose_file_name: composeFileName = defaultComposeFileName,
@@ -43,6 +44,7 @@ export async function buildHandler({
4344
requireGitData,
4445
deleteOldPins,
4546
variantsDirPath,
47+
skipComposeValidation,
4648
packagesToBuildProps: getPackagesToBuildProps({
4749
allVariants: Boolean(allVariants),
4850
commaSeparatedVariants: variants,

src/commands/build/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export const build: CommandModule<CliGlobalOptions, BuildCommandOptions> = {
5353
alias: "variant",
5454
description: `Specify the package variants to build (only for packages that support it). Defined by comma-separated list of variant names. Example: "variant1,variant2"`,
5555
type: "string"
56+
},
57+
skip_compose_validation: {
58+
alias: "skip-compose-validation",
59+
description: `Skip the Dappnode compose validation step`,
60+
type: "boolean"
5661
}
5762
},
5863

src/commands/build/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface BuildCommandOptions extends CliGlobalOptions {
1212
variants_dir_name?: string;
1313
variants?: string;
1414
all_variants?: boolean;
15+
skip_compose_validation?: boolean;
1516
}
1617

1718
export interface VerbosityOptions {

src/commands/publish/handler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export async function publishHandler({
2727
dappnode_team_preset: dappnode_team_preset,
2828
require_git_data: requireGitData,
2929
delete_old_pins: deleteOldPins,
30+
skip_compose_validation: skipComposeValidation,
3031
// Global options
3132
dir = defaultDir,
3233
compose_file_name: composeFileName = defaultComposeFileName,
@@ -80,6 +81,7 @@ export async function publishHandler({
8081
githubRelease,
8182
verbosityOptions,
8283
variantsDirPath,
84+
skipComposeValidation,
8385
packagesToBuildProps: getPackagesToBuildProps({
8486
allVariants: Boolean(allVariants),
8587
commaSeparatedVariants: variants,

src/commands/publish/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ export const publish: CommandModule<CliGlobalOptions, PublishCommandOptions> = {
8383
alias: "variant",
8484
description: `Specify the package variants to build (only for packages that support it). Defined by comma-separated list of variant names. If not specified, all variants will be built. Example: "variant1,variant2"`,
8585
type: "string"
86+
},
87+
skip_compose_validation: {
88+
alias: "skip-compose-validation",
89+
description: `Skip the Dappnode compose validation step`,
90+
type: "boolean"
8691
}
8792
},
8893

src/commands/publish/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export interface PublishCommandOptions extends CliGlobalOptions {
1616
variants_dir_name?: string;
1717
variants?: string;
1818
all_variants?: boolean;
19+
skip_compose_validation?: boolean;
1920
}

src/files/compose/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ export { parseComposeUpstreamVersion } from "./parseComposeUpstreamVersion.js";
55
export { readCompose } from "./readCompose.js";
66
export { updateComposeImageTags } from "./updateComposeImageTags.js";
77
export { writeCompose } from "./writeCompose.js";
8-
export { composeSafeKeys } from "./params.js";

src/files/compose/params.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/params.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { releaseFiles } from "@dappnode/types";
22
import { ManifestFormat } from "./files/manifest/types.js";
33

4-
export * from "./files/compose/params.js";
5-
64
export class CliError extends Error {}
75
export class YargsError extends Error {}
86

src/tasks/buildAndUpload/getFileValidationTask.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,36 @@ import { getComposePath } from "../../files/index.js";
1111
import { CliError } from "../../params.js";
1212

1313
export function getFileValidationTask({
14-
packagesToBuildProps
14+
packagesToBuildProps,
15+
skipComposeValidation
1516
}: {
1617
packagesToBuildProps: PackageToBuildProps[];
18+
skipComposeValidation?: boolean;
1719
}): ListrTask<ListrContextBuild> {
1820
return {
1921
title: `Validate files`,
20-
task: async () => await validatePackageFiles({ packagesToBuildProps })
22+
task: async () =>
23+
await validatePackageFiles({
24+
packagesToBuildProps,
25+
skipComposeValidation
26+
})
2127
};
2228
}
2329

2430
async function validatePackageFiles({
25-
packagesToBuildProps
31+
packagesToBuildProps,
32+
skipComposeValidation
2633
}: {
2734
packagesToBuildProps: PackageToBuildProps[];
35+
skipComposeValidation?: boolean;
2836
}): Promise<void> {
2937
for (const pkgProps of packagesToBuildProps)
30-
await validateVariantFiles(pkgProps);
38+
await validateVariantFiles(pkgProps, skipComposeValidation);
3139
}
3240

3341
async function validateVariantFiles(
34-
pkgProps: PackageToBuildProps
42+
pkgProps: PackageToBuildProps,
43+
skipComposeValidation?: boolean
3544
): Promise<void> {
3645
const {
3746
manifest,
@@ -57,7 +66,11 @@ async function validateVariantFiles(
5766
);
5867

5968
// Validate compose file specifically for Dappnode requirements
60-
validateDappnodeCompose(compose, manifest);
69+
if (skipComposeValidation) {
70+
console.log(`Skipping Dappnode compose validation for ${manifest.name}`);
71+
} else {
72+
validateDappnodeCompose(compose, manifest);
73+
}
6174

6275
// Validate notifications schema
6376
if (notifications) validateNotificationsSchema(notifications);

0 commit comments

Comments
 (0)