@otwld/nx-argo 0.0.14-staging.0 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/executors.json +4 -34
- package/generators.json +4 -14
- package/package.json +9 -8
- package/src/executors/validate.d.ts +3 -0
- package/src/executors/validate.js +131 -0
- package/src/executors/validate.js.map +1 -0
- package/src/executors/validate.schema.json +6 -0
- package/src/generators/register.d.ts +9 -0
- package/src/generators/register.js +162 -0
- package/src/generators/register.js.map +1 -0
- package/src/generators/register.schema.json +16 -0
- package/src/index.d.ts +4 -21
- package/src/index.js +4 -25
- package/src/index.js.map +1 -1
- package/src/names.d.ts +11 -0
- package/src/names.js +88 -0
- package/src/names.js.map +1 -0
- package/src/plugin.d.ts +2 -0
- package/src/plugin.js +27 -0
- package/src/plugin.js.map +1 -0
- package/CHANGELOG.md +0 -68
- package/README.md +0 -38
- package/src/executors/copy-image-lock/copy-image-lock.d.ts +0 -5
- package/src/executors/copy-image-lock/copy-image-lock.js +0 -15
- package/src/executors/copy-image-lock/copy-image-lock.js.map +0 -1
- package/src/executors/copy-image-lock/schema.d.ts +0 -19
- package/src/executors/copy-image-lock/schema.json +0 -48
- package/src/executors/copy-source-revision/copy-source-revision.d.ts +0 -5
- package/src/executors/copy-source-revision/copy-source-revision.js +0 -30
- package/src/executors/copy-source-revision/copy-source-revision.js.map +0 -1
- package/src/executors/copy-source-revision/schema.d.ts +0 -19
- package/src/executors/copy-source-revision/schema.json +0 -41
- package/src/executors/image-lock.d.ts +0 -16
- package/src/executors/image-lock.js +0 -54
- package/src/executors/image-lock.js.map +0 -1
- package/src/executors/set-source-revision/schema.d.ts +0 -15
- package/src/executors/set-source-revision/schema.json +0 -28
- package/src/executors/set-source-revision/set-source-revision.d.ts +0 -5
- package/src/executors/set-source-revision/set-source-revision.js +0 -21
- package/src/executors/set-source-revision/set-source-revision.js.map +0 -1
- package/src/executors/shared.d.ts +0 -28
- package/src/executors/shared.js +0 -113
- package/src/executors/shared.js.map +0 -1
- package/src/executors/source-revision.d.ts +0 -9
- package/src/executors/source-revision.js +0 -31
- package/src/executors/source-revision.js.map +0 -1
- package/src/executors/validate-application/schema.d.ts +0 -7
- package/src/executors/validate-application/schema.json +0 -19
- package/src/executors/validate-application/validate-application.d.ts +0 -5
- package/src/executors/validate-application/validate-application.js +0 -39
- package/src/executors/validate-application/validate-application.js.map +0 -1
- package/src/executors/validate-application-set/schema.d.ts +0 -7
- package/src/executors/validate-application-set/schema.json +0 -20
- package/src/executors/validate-application-set/validate-application-set.d.ts +0 -5
- package/src/executors/validate-application-set/validate-application-set.js +0 -158
- package/src/executors/validate-application-set/validate-application-set.js.map +0 -1
- package/src/executors/validate-image-lock/schema.d.ts +0 -15
- package/src/executors/validate-image-lock/schema.json +0 -36
- package/src/executors/validate-image-lock/validate-image-lock.d.ts +0 -5
- package/src/executors/validate-image-lock/validate-image-lock.js +0 -12
- package/src/executors/validate-image-lock/validate-image-lock.js.map +0 -1
- package/src/executors/write-image-lock/schema.d.ts +0 -21
- package/src/executors/write-image-lock/schema.json +0 -61
- package/src/executors/write-image-lock/write-image-lock.d.ts +0 -5
- package/src/executors/write-image-lock/write-image-lock.js +0 -56
- package/src/executors/write-image-lock/write-image-lock.js.map +0 -1
- package/src/generators/environment-project/environment-project.d.ts +0 -4
- package/src/generators/environment-project/environment-project.js +0 -98
- package/src/generators/environment-project/environment-project.js.map +0 -1
- package/src/generators/environment-project/schema.d.ts +0 -21
- package/src/generators/environment-project/schema.json +0 -55
- package/src/generators/preview-project/preview-project.d.ts +0 -4
- package/src/generators/preview-project/preview-project.js +0 -49
- package/src/generators/preview-project/preview-project.js.map +0 -1
- package/src/generators/preview-project/schema.d.ts +0 -15
- package/src/generators/preview-project/schema.json +0 -42
- package/src/generators/stack-project/schema.d.ts +0 -51
- package/src/generators/stack-project/schema.json +0 -113
- package/src/generators/stack-project/stack-project.d.ts +0 -4
- package/src/generators/stack-project/stack-project.js +0 -516
- package/src/generators/stack-project/stack-project.js.map +0 -1
package/src/executors/shared.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.canonicalImageLockPaths = void 0;
|
|
4
|
-
exports.getProjectRoot = getProjectRoot;
|
|
5
|
-
exports.resolveProjectFile = resolveProjectFile;
|
|
6
|
-
exports.readYamlMapping = readYamlMapping;
|
|
7
|
-
exports.writeYamlMapping = writeYamlMapping;
|
|
8
|
-
exports.isMap = isMap;
|
|
9
|
-
exports.getPath = getPath;
|
|
10
|
-
exports.parsePath = parsePath;
|
|
11
|
-
exports.setPath = setPath;
|
|
12
|
-
exports.isNonEmptyString = isNonEmptyString;
|
|
13
|
-
exports.isDigest = isDigest;
|
|
14
|
-
const node_fs_1 = require("node:fs");
|
|
15
|
-
const node_path_1 = require("node:path");
|
|
16
|
-
const yaml_1 = require("yaml");
|
|
17
|
-
/** Canonical image-lock paths used when a validator or copier omits mappings. */
|
|
18
|
-
exports.canonicalImageLockPaths = {
|
|
19
|
-
repository: 'image.repository',
|
|
20
|
-
digest: 'image.digest',
|
|
21
|
-
service: 'artifact.service',
|
|
22
|
-
sourceRevision: 'artifact.sourceRevision',
|
|
23
|
-
};
|
|
24
|
-
/** Resolves a project root from an executor context. */
|
|
25
|
-
function getProjectRoot(context, project) {
|
|
26
|
-
const projectName = project ?? context.projectName;
|
|
27
|
-
const projectRoot = projectName
|
|
28
|
-
? context.projectsConfigurations?.projects[projectName]?.root
|
|
29
|
-
: undefined;
|
|
30
|
-
if (!projectRoot) {
|
|
31
|
-
throw new Error('[nx-argo] The referenced Nx project does not exist.');
|
|
32
|
-
}
|
|
33
|
-
return (0, node_path_1.resolve)(context.root, projectRoot);
|
|
34
|
-
}
|
|
35
|
-
/** Resolves a required project-local file without permitting path escapes. */
|
|
36
|
-
function resolveProjectFile(root, file, optionName) {
|
|
37
|
-
if (!file?.trim() ||
|
|
38
|
-
(0, node_path_1.isAbsolute)(file) ||
|
|
39
|
-
file.split(/[\\/]+/).includes('..')) {
|
|
40
|
-
throw new Error(`[nx-argo] ${optionName} must stay within the project root.`);
|
|
41
|
-
}
|
|
42
|
-
const filePath = (0, node_path_1.resolve)(root, file);
|
|
43
|
-
const pathFromRoot = (0, node_path_1.relative)(root, filePath);
|
|
44
|
-
if (!pathFromRoot ||
|
|
45
|
-
pathFromRoot === '..' ||
|
|
46
|
-
pathFromRoot.startsWith(`..${node_path_1.sep}`) ||
|
|
47
|
-
(0, node_path_1.isAbsolute)(pathFromRoot)) {
|
|
48
|
-
throw new Error(`[nx-argo] ${optionName} must stay within the project root.`);
|
|
49
|
-
}
|
|
50
|
-
return filePath;
|
|
51
|
-
}
|
|
52
|
-
/** Reads an existing YAML mapping with a domain-specific error label. */
|
|
53
|
-
function readYamlMapping(filePath, label) {
|
|
54
|
-
if (!(0, node_fs_1.existsSync)(filePath)) {
|
|
55
|
-
throw new Error(`[nx-argo] Required ${label} is missing: ${filePath}`);
|
|
56
|
-
}
|
|
57
|
-
const document = (0, yaml_1.parseDocument)((0, node_fs_1.readFileSync)(filePath, 'utf8'));
|
|
58
|
-
if (document.errors.length || !isMap(document.toJS())) {
|
|
59
|
-
throw new Error(`[nx-argo] Invalid ${label}: ${filePath}`);
|
|
60
|
-
}
|
|
61
|
-
return document.toJS();
|
|
62
|
-
}
|
|
63
|
-
/** Writes a YAML mapping using the package's stable formatting. */
|
|
64
|
-
function writeYamlMapping(filePath, value) {
|
|
65
|
-
(0, node_fs_1.writeFileSync)(filePath, (0, yaml_1.stringify)(value, { lineWidth: 0 }));
|
|
66
|
-
}
|
|
67
|
-
/** Narrows a YAML value to a simple mapping. */
|
|
68
|
-
function isMap(value) {
|
|
69
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
70
|
-
}
|
|
71
|
-
/** Reads a nested mapping path without coercing malformed values. */
|
|
72
|
-
function getPath(root, path) {
|
|
73
|
-
let current = root;
|
|
74
|
-
for (const segment of path) {
|
|
75
|
-
if (!isMap(current)) {
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
current = current[segment];
|
|
79
|
-
}
|
|
80
|
-
return current;
|
|
81
|
-
}
|
|
82
|
-
/** Parses a dot-separated mapping path. */
|
|
83
|
-
function parsePath(path, label = 'mapping path') {
|
|
84
|
-
const segments = path.split('.');
|
|
85
|
-
if (segments.some((segment) => !segment.trim())) {
|
|
86
|
-
throw new Error(`[nx-argo] ${label} must not contain empty segments.`);
|
|
87
|
-
}
|
|
88
|
-
return segments;
|
|
89
|
-
}
|
|
90
|
-
/** Sets a mapping path and rejects scalar conflicts on the route. */
|
|
91
|
-
function setPath(root, segments, value) {
|
|
92
|
-
let current = root;
|
|
93
|
-
for (const segment of segments.slice(0, -1)) {
|
|
94
|
-
const child = current[segment];
|
|
95
|
-
if (child === undefined) {
|
|
96
|
-
current[segment] = {};
|
|
97
|
-
}
|
|
98
|
-
else if (!isMap(child)) {
|
|
99
|
-
throw new Error(`[nx-argo] Mapping path conflicts at ${segment}.`);
|
|
100
|
-
}
|
|
101
|
-
current = current[segment];
|
|
102
|
-
}
|
|
103
|
-
current[segments.at(-1)] = value;
|
|
104
|
-
}
|
|
105
|
-
/** Requires a nonempty string scalar. */
|
|
106
|
-
function isNonEmptyString(value) {
|
|
107
|
-
return typeof value === 'string' && Boolean(value.trim());
|
|
108
|
-
}
|
|
109
|
-
/** Validates an immutable SHA-256 image digest. */
|
|
110
|
-
function isDigest(value) {
|
|
111
|
-
return typeof value === 'string' && /^sha256:[a-f0-9]{64}$/.test(value);
|
|
112
|
-
}
|
|
113
|
-
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../../plugins/nx/argo/src/executors/shared.ts"],"names":[],"mappings":";;;AAeA,wCAaC;AAGD,gDA6BC;AAGD,0CAcC;AAGD,4CAKC;AAGD,sBAEC;AAGD,0BAaC;AA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C;AACpC,CAAC;AAED,yCAAyC;AACzC,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,mDAAmD;AACnD,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Identifies an Application source without relying on array positions. */
|
|
2
|
-
export interface SourceSelector {
|
|
3
|
-
repoURL: string;
|
|
4
|
-
chart?: string;
|
|
5
|
-
path?: string;
|
|
6
|
-
ref?: string;
|
|
7
|
-
}
|
|
8
|
-
/** Finds exactly one matching source in an Application spec. */
|
|
9
|
-
export declare function selectSource(application: Record<string, unknown>, selector: SourceSelector): Record<string, unknown>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.selectSource = selectSource;
|
|
4
|
-
const shared_1 = require("./shared");
|
|
5
|
-
/** Finds exactly one matching source in an Application spec. */
|
|
6
|
-
function selectSource(application, selector) {
|
|
7
|
-
if (!(0, shared_1.isNonEmptyString)(selector.repoURL) ||
|
|
8
|
-
![selector.chart, selector.path, selector.ref].some(shared_1.isNonEmptyString)) {
|
|
9
|
-
throw new Error('[nx-argo] repoURL and one of chart, path, or ref are required.');
|
|
10
|
-
}
|
|
11
|
-
const spec = application['spec'];
|
|
12
|
-
if (!(0, shared_1.isMap)(spec)) {
|
|
13
|
-
throw new Error('[nx-argo] Application spec must be a mapping.');
|
|
14
|
-
}
|
|
15
|
-
const sources = [
|
|
16
|
-
...((0, shared_1.isMap)(spec['source']) ? [spec['source']] : []),
|
|
17
|
-
...(Array.isArray(spec['sources']) ? spec['sources'].filter(shared_1.isMap) : []),
|
|
18
|
-
];
|
|
19
|
-
const criteria = {
|
|
20
|
-
repoURL: selector.repoURL,
|
|
21
|
-
chart: selector.chart,
|
|
22
|
-
path: selector.path,
|
|
23
|
-
ref: selector.ref,
|
|
24
|
-
};
|
|
25
|
-
const matches = sources.filter((source) => Object.entries(criteria).every(([key, value]) => value === undefined || source[key] === value));
|
|
26
|
-
if (matches.length !== 1) {
|
|
27
|
-
throw new Error('[nx-argo] Source selector must match exactly one Application source.');
|
|
28
|
-
}
|
|
29
|
-
return matches[0];
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=source-revision.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-revision.js","sourceRoot":"","sources":["../../../../../../plugins/nx/argo/src/executors/source-revision.ts"],"names":[],"mappings":";;AAWA,oCAuCC;AAlDD,qCAAmD;AAUnD,gEAAgE;AAChE,SAAgB,YAAY,CAC1B,WAAoC,EACpC,QAAwB;IAExB,IACE,CAAC,IAAA,yBAAgB,EAAC,QAAQ,CAAC,OAAO,CAAC;QACnC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,yBAAgB,CAAC,EACrE,CAAC;QACD,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,IAAA,cAAK,EAAC,IAAI,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,OAAO,GAAG;QACd,GAAG,CAAC,IAAA,cAAK,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,cAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACzE,CAAC;IACF,MAAM,QAAQ,GAAG;QACf,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,GAAG,EAAE,QAAQ,CAAC,GAAG;KAClB,CAAC;IACF,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CACxC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAC5B,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,KAAK,CAC/D,CACF,CAAC;IACF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Options accepted by the Application validator. */
|
|
2
|
-
export interface ValidateApplicationExecutorSchema {
|
|
3
|
-
/** Application manifest relative to the owning Nx project root. */
|
|
4
|
-
file: string;
|
|
5
|
-
/** Optional basename required at the end of each Helm values list. */
|
|
6
|
-
finalValueFile?: string;
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"version": 2,
|
|
4
|
-
"title": "Validate Argo CD Application",
|
|
5
|
-
"description": "Validate an Application manifest relative to its Nx project root.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"file": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "Application manifest relative to the owning Nx project root."
|
|
11
|
-
},
|
|
12
|
-
"finalValueFile": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"description": "Optional basename required at the end of each declared Helm valueFiles list."
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"required": ["file"],
|
|
18
|
-
"additionalProperties": false
|
|
19
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PromiseExecutor } from '@nx/devkit';
|
|
2
|
-
import type { ValidateApplicationExecutorSchema } from './schema';
|
|
3
|
-
/** Validates an Argo CD Application and an optional final Helm values file. */
|
|
4
|
-
declare const runExecutor: PromiseExecutor<ValidateApplicationExecutorSchema>;
|
|
5
|
-
export default runExecutor;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const shared_1 = require("../shared");
|
|
4
|
-
/** Validates an Argo CD Application and an optional final Helm values file. */
|
|
5
|
-
const runExecutor = async (options, context) => {
|
|
6
|
-
const filePath = (0, shared_1.resolveProjectFile)((0, shared_1.getProjectRoot)(context), options.file, 'Application file');
|
|
7
|
-
const application = (0, shared_1.readYamlMapping)(filePath, 'Argo CD Application');
|
|
8
|
-
if (application['apiVersion'] !== 'argoproj.io/v1alpha1' ||
|
|
9
|
-
application['kind'] !== 'Application' ||
|
|
10
|
-
!(0, shared_1.isMap)(application['spec'])) {
|
|
11
|
-
throw new Error(`[nx-argo] Invalid Argo CD Application: ${filePath}`);
|
|
12
|
-
}
|
|
13
|
-
if (options.finalValueFile) {
|
|
14
|
-
for (const valueFiles of getHelmValueFiles(application)) {
|
|
15
|
-
if (valueFiles.at(-1)?.split('/').at(-1) !== options.finalValueFile) {
|
|
16
|
-
throw new Error(`[nx-argo] ${options.finalValueFile} must be the final Helm values file: ${filePath}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return { success: true };
|
|
21
|
-
};
|
|
22
|
-
/** Returns Helm values lists from every declared Application source. */
|
|
23
|
-
function getHelmValueFiles(application) {
|
|
24
|
-
const spec = application['spec'];
|
|
25
|
-
const sources = [
|
|
26
|
-
...((0, shared_1.isMap)(spec['source']) ? [spec['source']] : []),
|
|
27
|
-
...(Array.isArray(spec['sources']) ? spec['sources'].filter(shared_1.isMap) : []),
|
|
28
|
-
];
|
|
29
|
-
return sources.flatMap((source) => {
|
|
30
|
-
const helm = source['helm'];
|
|
31
|
-
return (0, shared_1.isMap)(helm) && Array.isArray(helm['valueFiles'])
|
|
32
|
-
? [
|
|
33
|
-
helm['valueFiles'].filter((value) => typeof value === 'string'),
|
|
34
|
-
]
|
|
35
|
-
: [];
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
exports.default = runExecutor;
|
|
39
|
-
//# sourceMappingURL=validate-application.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-application.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/argo/src/executors/validate-application/validate-application.ts"],"names":[],"mappings":";;AAEA,sCAKmB;AAInB,+EAA+E;AAC/E,MAAM,WAAW,GAAuD,KAAK,EAC3E,OAAO,EACP,OAAO,EACP,EAAE;IACF,MAAM,QAAQ,GAAG,IAAA,2BAAkB,EACjC,IAAA,uBAAc,EAAC,OAAO,CAAC,EACvB,OAAO,CAAC,IAAI,EACZ,kBAAkB,CACnB,CAAC;IACF,MAAM,WAAW,GAAG,IAAA,wBAAe,EAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IACrE,IACE,WAAW,CAAC,YAAY,CAAC,KAAK,sBAAsB;QACpD,WAAW,CAAC,MAAM,CAAC,KAAK,aAAa;QACrC,CAAC,IAAA,cAAK,EAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAC3B,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,0CAA0C,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;I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AC,OAAO,KAAK,KAAK,QAAQ,CACtD;aACF;YACH,CAAC,CAAC,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Options accepted by the ApplicationSet validator. */
|
|
2
|
-
export interface ValidateApplicationSetExecutorSchema {
|
|
3
|
-
/** ApplicationSet manifest relative to the owning Nx project root. */
|
|
4
|
-
file: string;
|
|
5
|
-
/** Optional staging or GitHub pull-request preview policy to enforce. */
|
|
6
|
-
policy?: 'staging' | 'github-pr-preview';
|
|
7
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"version": 2,
|
|
4
|
-
"title": "Validate Argo CD ApplicationSet",
|
|
5
|
-
"description": "Validate ApplicationSet structure and an optional policy.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"file": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "ApplicationSet manifest relative to the owning Nx project root."
|
|
11
|
-
},
|
|
12
|
-
"policy": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"enum": ["staging", "github-pr-preview"],
|
|
15
|
-
"description": "Optional staging or GitHub pull-request preview policy to enforce."
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"required": ["file"],
|
|
19
|
-
"additionalProperties": false
|
|
20
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PromiseExecutor } from '@nx/devkit';
|
|
2
|
-
import type { ValidateApplicationSetExecutorSchema } from './schema';
|
|
3
|
-
/** Validates ApplicationSet structure and optionally enforces a named policy. */
|
|
4
|
-
declare const runExecutor: PromiseExecutor<ValidateApplicationSetExecutorSchema>;
|
|
5
|
-
export default runExecutor;
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const shared_1 = require("../shared");
|
|
4
|
-
/** Validates ApplicationSet structure and optionally enforces a named policy. */
|
|
5
|
-
const runExecutor = async (options, context) => {
|
|
6
|
-
const filePath = (0, shared_1.resolveProjectFile)((0, shared_1.getProjectRoot)(context), options.file, 'ApplicationSet file');
|
|
7
|
-
const applicationSet = (0, shared_1.readYamlMapping)(filePath, 'Argo CD ApplicationSet');
|
|
8
|
-
const spec = applicationSet['spec'];
|
|
9
|
-
if (applicationSet['apiVersion'] !== 'argoproj.io/v1alpha1' ||
|
|
10
|
-
applicationSet['kind'] !== 'ApplicationSet' ||
|
|
11
|
-
!(0, shared_1.isMap)(spec)) {
|
|
12
|
-
throw new Error(`[nx-argo] Invalid Argo CD ApplicationSet: ${filePath}`);
|
|
13
|
-
}
|
|
14
|
-
if (options.policy) {
|
|
15
|
-
const template = spec['template'];
|
|
16
|
-
const templateSpec = (0, shared_1.isMap)(template) ? template['spec'] : undefined;
|
|
17
|
-
if (!(0, shared_1.isMap)(templateSpec)) {
|
|
18
|
-
throw new Error(`[nx-argo] Invalid ${options.policy} ApplicationSet policy: ${filePath}`);
|
|
19
|
-
}
|
|
20
|
-
if (options.policy === 'staging') {
|
|
21
|
-
validateStaging(spec, templateSpec, filePath);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
validateGithubPrPreview(spec, template, templateSpec, filePath);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return { success: true };
|
|
28
|
-
};
|
|
29
|
-
/** Enforces the generated staging ApplicationSet lifecycle policy. */
|
|
30
|
-
function validateStaging(spec, templateSpec, filePath) {
|
|
31
|
-
if (!containsGitFileGenerator(spec['generators'], 'staging') ||
|
|
32
|
-
!hasTargetRevision(templateSpec, 'staging') ||
|
|
33
|
-
!hasAutomatedSync(templateSpec) ||
|
|
34
|
-
!hasValuesAsFinalValue(templateSpec, 'values-staging.yaml') ||
|
|
35
|
-
(0, shared_1.getPath)(spec, ['syncPolicy', 'preserveResourcesOnDeletion']) === true ||
|
|
36
|
-
(0, shared_1.getPath)(templateSpec, ['syncPolicy', 'preserveResourcesOnDeletion']) ===
|
|
37
|
-
true) {
|
|
38
|
-
throw new Error(`[nx-argo] Invalid staging ApplicationSet policy: ${filePath}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/** Enforces the generated GitHub pull-request preview lifecycle policy. */
|
|
42
|
-
function validateGithubPrPreview(spec, template, templateSpec, filePath) {
|
|
43
|
-
if (!containsPreviewPullRequestGenerator(spec['generators']) ||
|
|
44
|
-
!containsGitFileGenerator(spec['generators'], 'preview/pr-{{ .number }}', /^gitops\/[^/]+\/(?:values-preview|delivery)\.yaml$/) ||
|
|
45
|
-
!hasTargetRevision(templateSpec, 'preview/pr-{{ .number }}') ||
|
|
46
|
-
!hasAutomatedSync(templateSpec) ||
|
|
47
|
-
(0, shared_1.getPath)(spec, ['syncPolicy', 'preserveResourcesOnDeletion']) === true ||
|
|
48
|
-
(0, shared_1.getPath)(templateSpec, ['syncPolicy', 'preserveResourcesOnDeletion']) ===
|
|
49
|
-
true ||
|
|
50
|
-
!hasValuesAsFinalValue(templateSpec, 'values-preview.yaml') ||
|
|
51
|
-
!hasPreviewFinalizer(template) ||
|
|
52
|
-
!hasPreviewParameters(templateSpec)) {
|
|
53
|
-
throw new Error(`[nx-argo] Invalid github-pr-preview ApplicationSet policy: ${filePath}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/** Finds a labelled pull-request generator in generator trees. */
|
|
57
|
-
function containsPreviewPullRequestGenerator(value) {
|
|
58
|
-
if (Array.isArray(value)) {
|
|
59
|
-
return value.some(containsPreviewPullRequestGenerator);
|
|
60
|
-
}
|
|
61
|
-
if (!(0, shared_1.isMap)(value))
|
|
62
|
-
return false;
|
|
63
|
-
const pullRequest = value['pullRequest'];
|
|
64
|
-
if ((0, shared_1.isMap)(pullRequest)) {
|
|
65
|
-
const github = pullRequest['github'];
|
|
66
|
-
const labels = (0, shared_1.isMap)(github) ? github['labels'] : undefined;
|
|
67
|
-
if (Array.isArray(labels) &&
|
|
68
|
-
labels.some((label) => typeof label === 'string' && Boolean(label.trim()))) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return Object.values(value).some(containsPreviewPullRequestGenerator);
|
|
73
|
-
}
|
|
74
|
-
/** Finds a Git file generator for one fixed source branch. */
|
|
75
|
-
function containsGitFileGenerator(value, revision, pathPattern = /^gitops\/[^/]+\/delivery\.yaml$/) {
|
|
76
|
-
if (Array.isArray(value)) {
|
|
77
|
-
return value.some((generator) => containsGitFileGenerator(generator, revision, pathPattern));
|
|
78
|
-
}
|
|
79
|
-
if (!(0, shared_1.isMap)(value))
|
|
80
|
-
return false;
|
|
81
|
-
const git = value['git'];
|
|
82
|
-
if ((0, shared_1.isMap)(git) &&
|
|
83
|
-
git['revision'] === revision &&
|
|
84
|
-
Array.isArray(git['files']) &&
|
|
85
|
-
git['files'].some((file) => (0, shared_1.isMap)(file) &&
|
|
86
|
-
typeof file['path'] === 'string' &&
|
|
87
|
-
pathPattern.test(file['path']))) {
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
return Object.values(value).some((child) => containsGitFileGenerator(child, revision, pathPattern));
|
|
91
|
-
}
|
|
92
|
-
/** Requires every declared source to use the ApplicationSet branch revision. */
|
|
93
|
-
function hasTargetRevision(templateSpec, revision) {
|
|
94
|
-
const sources = getSources(templateSpec);
|
|
95
|
-
return (sources.length > 0 &&
|
|
96
|
-
sources.every((source) => source['targetRevision'] === revision));
|
|
97
|
-
}
|
|
98
|
-
/** Requires automated sync with prune and self-heal enabled. */
|
|
99
|
-
function hasAutomatedSync(templateSpec) {
|
|
100
|
-
const automated = (0, shared_1.getPath)(templateSpec, ['syncPolicy', 'automated']);
|
|
101
|
-
return ((0, shared_1.isMap)(automated) &&
|
|
102
|
-
automated['enabled'] === true &&
|
|
103
|
-
automated['prune'] === true &&
|
|
104
|
-
automated['selfHeal'] === true);
|
|
105
|
-
}
|
|
106
|
-
/** Requires the requested values file as the final Helm values file. */
|
|
107
|
-
function hasValuesAsFinalValue(templateSpec, expectedFile) {
|
|
108
|
-
const sources = getSources(templateSpec);
|
|
109
|
-
return sources.some((source) => {
|
|
110
|
-
const valueFiles = (0, shared_1.getPath)(source, ['helm', 'valueFiles']);
|
|
111
|
-
return (Array.isArray(valueFiles) &&
|
|
112
|
-
typeof valueFiles.at(-1) === 'string' &&
|
|
113
|
-
isNamedValuesFile(valueFiles.at(-1), expectedFile));
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
/** Returns all Application sources from either Argo source shape. */
|
|
117
|
-
function getSources(templateSpec) {
|
|
118
|
-
return [
|
|
119
|
-
...((0, shared_1.isMap)(templateSpec['source']) ? [templateSpec['source']] : []),
|
|
120
|
-
...(Array.isArray(templateSpec['sources'])
|
|
121
|
-
? templateSpec['sources'].filter(shared_1.isMap)
|
|
122
|
-
: []),
|
|
123
|
-
];
|
|
124
|
-
}
|
|
125
|
-
/** Accepts a project-local values path ending in the requested file name. */
|
|
126
|
-
function isNamedValuesFile(valueFile, expectedFile) {
|
|
127
|
-
return (valueFile === expectedFile ||
|
|
128
|
-
valueFile.endsWith(`/${expectedFile}`) ||
|
|
129
|
-
(expectedFile === 'values-staging.yaml' &&
|
|
130
|
-
/{{\s*\.stagingValues\s*}}/.test(valueFile)));
|
|
131
|
-
}
|
|
132
|
-
/** Requires the deletion finalizer used by generated preview Applications. */
|
|
133
|
-
function hasPreviewFinalizer(template) {
|
|
134
|
-
if (!(0, shared_1.isMap)(template) || !(0, shared_1.isMap)(template['metadata']))
|
|
135
|
-
return false;
|
|
136
|
-
const finalizers = template['metadata']['finalizers'];
|
|
137
|
-
return (Array.isArray(finalizers) &&
|
|
138
|
-
finalizers.includes('resources-finalizer.argocd.argoproj.io'));
|
|
139
|
-
}
|
|
140
|
-
/** Requires both preview identity and hostname Helm parameters. */
|
|
141
|
-
function hasPreviewParameters(templateSpec) {
|
|
142
|
-
return getSources(templateSpec).some((source) => {
|
|
143
|
-
const parameters = (0, shared_1.getPath)(source, ['helm', 'parameters']);
|
|
144
|
-
if (!Array.isArray(parameters))
|
|
145
|
-
return false;
|
|
146
|
-
const byName = new Map(parameters
|
|
147
|
-
.filter(shared_1.isMap)
|
|
148
|
-
.map((parameter) => [parameter['name'], parameter['value']]));
|
|
149
|
-
const previewDomain = byName.get('global.previewDomain');
|
|
150
|
-
const previewId = byName.get('global.previewId');
|
|
151
|
-
return (typeof previewId === 'string' &&
|
|
152
|
-
/{{\s*\.number\s*}}/.test(previewId) &&
|
|
153
|
-
typeof previewDomain === 'string' &&
|
|
154
|
-
Boolean(previewDomain.trim()));
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
exports.default = runExecutor;
|
|
158
|
-
//# sourceMappingURL=validate-application-set.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-application-set.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/argo/src/executors/validate-application-set/validate-application-set.ts"],"names":[],"mappings":";;AAEA,sCAMmB;AAInB,iFAAiF;AACjF,MAAM,WAAW,GAEb,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAC7B,MAAM,QAAQ,GAAG,IAAA,2BAAkB,EACjC,IAAA,uBAAc,EAAC,OAAO,CAAC,EACvB,OAAO,CAAC,IAAI,EACZ,qBAAqB,CACtB,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,wBAAe,EAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACpC,IACE,cAAc,CAAC,YAAY,CAAC,KAAK,sBAAsB;QACvD,cAAc,CAAC,MAAM,CAAC,KAAK,gBAAgB;QAC3C,CAAC,IAAA,cAAK,EAAC,IAAI,CAAC,EACZ,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,QAAQ,EAAE,CAAC,CAA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,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;QAC9C,MAAM,UAAU,GAAG,IAAA,gBAAO,EAAC,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;YAAE,OAAO,KAAK,CAAC;QAC7C,MAAM,MAAM,GAAG,IAAI,GAAG,CACpB,UAAU;aACP,MAAM,CAAC,cAAK,CAAC;aACb,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAC/D,CAAC;QACF,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACzD,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QACjD,OAAO,CACL,OAAO,SAAS,KAAK,QAAQ;YAC7B,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC;YACpC,OAAO,aAAa,KAAK,QAAQ;YACjC,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAC9B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** Options accepted by the image-lock validator. */
|
|
2
|
-
export interface ValidateImageLockExecutorSchema {
|
|
3
|
-
/** Image lock file relative to the owning Nx project root. */
|
|
4
|
-
file: string;
|
|
5
|
-
/** Optional repository YAML path. */
|
|
6
|
-
repositoryPath?: string;
|
|
7
|
-
/** Optional digest YAML path. */
|
|
8
|
-
digestPath?: string;
|
|
9
|
-
/** Optional service YAML path. */
|
|
10
|
-
servicePath?: string;
|
|
11
|
-
/** Optional source revision YAML path. */
|
|
12
|
-
sourceRevisionPath?: string;
|
|
13
|
-
/** Whether a fully empty pending lock is valid. */
|
|
14
|
-
allowPending?: boolean;
|
|
15
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"version": 2,
|
|
4
|
-
"title": "Validate image lock",
|
|
5
|
-
"description": "Validate a pending or completed image lock.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"file": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "Image lock file relative to the owning Nx project root."
|
|
11
|
-
},
|
|
12
|
-
"repositoryPath": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"description": "Optional repository YAML path; defaults to image.repository."
|
|
15
|
-
},
|
|
16
|
-
"digestPath": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"description": "Optional digest YAML path; defaults to image.digest."
|
|
19
|
-
},
|
|
20
|
-
"servicePath": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"description": "Optional service YAML path; defaults to artifact.service."
|
|
23
|
-
},
|
|
24
|
-
"sourceRevisionPath": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "Optional source revision YAML path; defaults to artifact.sourceRevision."
|
|
27
|
-
},
|
|
28
|
-
"allowPending": {
|
|
29
|
-
"type": "boolean",
|
|
30
|
-
"default": true,
|
|
31
|
-
"description": "Whether a fully empty pending lock is valid."
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"required": ["file"],
|
|
35
|
-
"additionalProperties": false
|
|
36
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PromiseExecutor } from '@nx/devkit';
|
|
2
|
-
import type { ValidateImageLockExecutorSchema } from './schema';
|
|
3
|
-
/** Validates a project-local pending or completed canonical image lock. */
|
|
4
|
-
declare const runExecutor: PromiseExecutor<ValidateImageLockExecutorSchema>;
|
|
5
|
-
export default runExecutor;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const image_lock_1 = require("../image-lock");
|
|
4
|
-
const shared_1 = require("../shared");
|
|
5
|
-
/** Validates a project-local pending or completed canonical image lock. */
|
|
6
|
-
const runExecutor = async (options, context) => {
|
|
7
|
-
const filePath = (0, shared_1.resolveProjectFile)((0, shared_1.getProjectRoot)(context), options.file, 'Image lock file');
|
|
8
|
-
(0, image_lock_1.validateImageLock)((0, shared_1.readYamlMapping)(filePath, 'image lock'), (0, image_lock_1.getImageLockPaths)(options), filePath, options.allowPending ?? true);
|
|
9
|
-
return { success: true };
|
|
10
|
-
};
|
|
11
|
-
exports.default = runExecutor;
|
|
12
|
-
//# sourceMappingURL=validate-image-lock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-image-lock.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/argo/src/executors/validate-image-lock/validate-image-lock.ts"],"names":[],"mappings":";;AAEA,8CAAqE;AACrE,sCAAgF;AAIhF,2EAA2E;AAC3E,MAAM,WAAW,GAAqD,KAAK,EACzE,OAAO,EACP,OAAO,EACP,EAAE;IACF,MAAM,QAAQ,GAAG,IAAA,2BAAkB,EACjC,IAAA,uBAAc,EAAC,OAAO,CAAC,EACvB,OAAO,CAAC,IAAI,EACZ,iBAAiB,CAClB,CAAC;IACF,IAAA,8BAAiB,EACf,IAAA,wBAAe,EAAC,QAAQ,EAAE,YAAY,CAAC,EACvC,IAAA,8BAAiB,EAAC,OAAO,CAAC,EAC1B,QAAQ,EACR,OAAO,CAAC,YAAY,IAAI,IAAI,CAC7B,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** Options accepted by the image-lock writer. */
|
|
2
|
-
export interface WriteImageLockExecutorSchema {
|
|
3
|
-
/** Image lock file relative to the owning Nx project root. */
|
|
4
|
-
file: string;
|
|
5
|
-
/** Dot-separated YAML path for the image repository. */
|
|
6
|
-
repositoryPath: string;
|
|
7
|
-
/** Dot-separated YAML path for the immutable image digest. */
|
|
8
|
-
digestPath: string;
|
|
9
|
-
/** Dot-separated YAML path for the deployment service identity. */
|
|
10
|
-
servicePath: string;
|
|
11
|
-
/** Dot-separated YAML path for the source revision. */
|
|
12
|
-
sourceRevisionPath: string;
|
|
13
|
-
/** Service identity to write. */
|
|
14
|
-
service: string;
|
|
15
|
-
/** Source revision to write. */
|
|
16
|
-
sourceRevision: string;
|
|
17
|
-
/** Image repository to write. */
|
|
18
|
-
repository: string;
|
|
19
|
-
/** Immutable image digest to write. */
|
|
20
|
-
digest: string;
|
|
21
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"version": 2,
|
|
4
|
-
"title": "Write image lock",
|
|
5
|
-
"description": "Write or verify an immutable image lock.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"file": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "Image lock file relative to the owning Nx project root."
|
|
11
|
-
},
|
|
12
|
-
"repositoryPath": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"description": "Dot-separated YAML path for the image repository."
|
|
15
|
-
},
|
|
16
|
-
"digestPath": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"description": "Dot-separated YAML path for the immutable image digest."
|
|
19
|
-
},
|
|
20
|
-
"servicePath": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"description": "Dot-separated YAML path for the deployment service identity."
|
|
23
|
-
},
|
|
24
|
-
"sourceRevisionPath": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "Dot-separated YAML path for the source revision."
|
|
27
|
-
},
|
|
28
|
-
"service": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"minLength": 1,
|
|
31
|
-
"description": "Service identity to write."
|
|
32
|
-
},
|
|
33
|
-
"sourceRevision": {
|
|
34
|
-
"type": "string",
|
|
35
|
-
"minLength": 1,
|
|
36
|
-
"description": "Source revision to write."
|
|
37
|
-
},
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "string",
|
|
40
|
-
"minLength": 1,
|
|
41
|
-
"description": "Image repository to write."
|
|
42
|
-
},
|
|
43
|
-
"digest": {
|
|
44
|
-
"type": "string",
|
|
45
|
-
"pattern": "^sha256:[a-f0-9]{64}$",
|
|
46
|
-
"description": "Immutable image digest to write."
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"required": [
|
|
50
|
-
"file",
|
|
51
|
-
"repositoryPath",
|
|
52
|
-
"digestPath",
|
|
53
|
-
"servicePath",
|
|
54
|
-
"sourceRevisionPath",
|
|
55
|
-
"service",
|
|
56
|
-
"sourceRevision",
|
|
57
|
-
"repository",
|
|
58
|
-
"digest"
|
|
59
|
-
],
|
|
60
|
-
"additionalProperties": false
|
|
61
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PromiseExecutor } from '@nx/devkit';
|
|
2
|
-
import type { WriteImageLockExecutorSchema } from './schema';
|
|
3
|
-
/** Writes or verifies an immutable image lock for a source revision. */
|
|
4
|
-
declare const runExecutor: PromiseExecutor<WriteImageLockExecutorSchema>;
|
|
5
|
-
export default runExecutor;
|