@storm-software/k8s-tools 0.25.19 → 0.25.21
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/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/dist/chunk-27DDDFDE.mjs +29 -0
- package/dist/{chunk-RKHT4PWO.js → chunk-2SIDLIM5.js} +47 -31
- package/dist/{chunk-2GAU2GHG.js → chunk-4AADQIGW.js} +35 -102
- package/dist/{chunk-T5WNZJOD.js → chunk-7QVOU2PT.js} +3 -11
- package/dist/{chunk-3OATAJ3B.js → chunk-A7ARE63F.js} +83 -55
- package/dist/chunk-ARIMP3W4.mjs +155 -0
- package/dist/{chunk-TNVATOCF.mjs → chunk-BBY7MXHG.mjs} +93 -54
- package/dist/{chunk-OIKG7EMC.js → chunk-DD5DCADP.js} +32 -16
- package/dist/{chunk-IQYUMTUG.js → chunk-GQUK4O4E.js} +30 -23
- package/dist/{chunk-UC4ZBDTX.mjs → chunk-HGXQ6SSU.mjs} +5 -7
- package/dist/{chunk-LFNGKV6F.js → chunk-JSFRUBG5.js} +1 -8
- package/dist/{chunk-LLSJITI4.mjs → chunk-KVKKT3AU.mjs} +24 -13
- package/dist/{chunk-QKTRYJDT.mjs → chunk-MDGD27YL.mjs} +32 -16
- package/dist/{chunk-A2UL7VJH.mjs → chunk-MKWEGZBN.mjs} +31 -24
- package/dist/{chunk-YY3TH3F7.mjs → chunk-MQZUEUAT.mjs} +26 -21
- package/dist/{chunk-F37JQGEZ.mjs → chunk-MWMS7P7U.mjs} +333 -208
- package/dist/{chunk-X7ALQPYH.js → chunk-NMNRCEUZ.js} +21 -12
- package/dist/{chunk-T3C63ATM.mjs → chunk-NWIIGYA4.mjs} +68 -40
- package/dist/{chunk-NJPZBNWH.mjs → chunk-QHFQ2OBL.mjs} +2 -10
- package/dist/chunk-RECJ3G6F.js +21 -0
- package/dist/{chunk-IOT45LXV.js → chunk-RUPAIXLM.js} +59 -38
- package/dist/chunk-RUROM5AC.mjs +136 -0
- package/dist/{chunk-PDHZDUK3.js → chunk-SGNASGK5.js} +94 -55
- package/dist/{chunk-ARMCUBMY.js → chunk-UWVOFPSW.js} +334 -209
- package/dist/{chunk-RDQRJI4Y.mjs → chunk-VREITNWP.mjs} +36 -20
- package/dist/{chunk-EAQFLLRB.js → chunk-XKOZIQT3.js} +6 -8
- package/dist/{chunk-G7TAEXNU.js → chunk-Y2HMMGO2.js} +28 -23
- package/dist/{chunk-YHT26DWR.mjs → chunk-YXXZO2AJ.mjs} +0 -7
- package/dist/executors.js +10 -10
- package/dist/executors.mjs +9 -9
- package/dist/generators.js +7 -7
- package/dist/generators.mjs +6 -6
- package/dist/index.js +15 -15
- package/dist/index.mjs +14 -14
- package/dist/src/executors/container-publish/executor.js +6 -6
- package/dist/src/executors/container-publish/executor.mjs +5 -5
- package/dist/src/executors/helm-package/executor.js +8 -8
- package/dist/src/executors/helm-package/executor.mjs +7 -7
- package/dist/src/generators/helm-chart/generator.js +6 -6
- package/dist/src/generators/helm-chart/generator.mjs +5 -5
- package/dist/src/generators/helm-dependency/generator.js +6 -6
- package/dist/src/generators/helm-dependency/generator.mjs +5 -5
- package/dist/src/plugins/docker/index.js +5 -5
- package/dist/src/plugins/docker/index.mjs +4 -4
- package/dist/src/types.js +3 -3
- package/dist/src/types.mjs +2 -2
- package/dist/src/utils/client.js +5 -5
- package/dist/src/utils/client.mjs +4 -4
- package/dist/src/utils/ensure-init.js +3 -3
- package/dist/src/utils/ensure-init.mjs +2 -2
- package/dist/src/utils/index.js +6 -6
- package/dist/src/utils/index.mjs +5 -5
- package/dist/src/utils/prettier.js +3 -3
- package/dist/src/utils/prettier.mjs +2 -2
- package/dist/tsup.config.js +3 -8
- package/dist/tsup.config.mjs +3 -8
- package/package.json +1 -1
- package/dist/chunk-3GQAWCBQ.js +0 -13
- package/dist/chunk-5JZUTREX.mjs +0 -134
- package/dist/chunk-L2DHGVS5.mjs +0 -21
- package/dist/chunk-ZNGN7YLH.mjs +0 -203
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkRUPAIXLMjs = require('./chunk-RUPAIXLM.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkDD5DCADPjs = require('./chunk-DD5DCADP.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkUWVOFPSWjs = require('./chunk-UWVOFPSW.js');
|
|
11
|
+
|
|
12
|
+
// src/executors/container-publish/executor.ts
|
|
11
13
|
|
|
12
14
|
|
|
13
|
-
var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
|
|
14
15
|
|
|
15
|
-
// src/executors/container-publish/executor.ts
|
|
16
16
|
var _devkit = require('@nx/devkit');
|
|
17
17
|
|
|
18
18
|
// ../workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
19
|
-
var applyWorkspaceExecutorTokens =
|
|
19
|
+
var applyWorkspaceExecutorTokens = async (option, tokenizerOptions) => {
|
|
20
20
|
let result = option;
|
|
21
21
|
if (!result) {
|
|
22
22
|
return result;
|
|
@@ -44,7 +44,10 @@ var applyWorkspaceExecutorTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(
|
|
|
44
44
|
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
45
45
|
for (const configKey of configKeys) {
|
|
46
46
|
if (result.includes(`{${configKey}}`)) {
|
|
47
|
-
result = result.replaceAll(
|
|
47
|
+
result = result.replaceAll(
|
|
48
|
+
`{${configKey}}`,
|
|
49
|
+
tokenizerOptions.config[configKey]
|
|
50
|
+
);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
}
|
|
@@ -59,10 +62,13 @@ var applyWorkspaceExecutorTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(
|
|
|
59
62
|
result = result.replaceAll("{sourceRoot}", sourceRoot);
|
|
60
63
|
}
|
|
61
64
|
if (result.includes("{workspaceRoot}")) {
|
|
62
|
-
result = result.replaceAll(
|
|
65
|
+
result = result.replaceAll(
|
|
66
|
+
"{workspaceRoot}",
|
|
67
|
+
_nullishCoalesce(tokenizerOptions.workspaceRoot, () => ( _chunkUWVOFPSWjs.findWorkspaceRoot.call(void 0, )))
|
|
68
|
+
);
|
|
63
69
|
}
|
|
64
70
|
return result;
|
|
65
|
-
}
|
|
71
|
+
};
|
|
66
72
|
|
|
67
73
|
// src/executors/container-publish/executor.ts
|
|
68
74
|
var _https = require('https'); var _https2 = _interopRequireDefault(_https);
|
|
@@ -71,33 +77,43 @@ async function* publishExecutor(options, context) {
|
|
|
71
77
|
if (!context.projectName) {
|
|
72
78
|
throw new Error("The executor requires a projectName.");
|
|
73
79
|
}
|
|
74
|
-
console.info(
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
console.info(
|
|
81
|
+
`\u{1F680} Running Storm Container Registry Publish executor on the ${context.projectName} crate`
|
|
82
|
+
);
|
|
83
|
+
const workspaceRoot = _chunkUWVOFPSWjs.findWorkspaceRoot.call(void 0, );
|
|
84
|
+
const config = await _chunkUWVOFPSWjs.getConfig.call(void 0, workspaceRoot);
|
|
77
85
|
const projectConfig = _optionalChain([context, 'access', _2 => _2.projectsConfigurations, 'optionalAccess', _3 => _3.projects, 'access', _4 => _4[context.projectName]]);
|
|
78
86
|
if (!projectConfig) {
|
|
79
|
-
throw new Error(
|
|
87
|
+
throw new Error(
|
|
88
|
+
`The executor requires a valid projectsConfiguration - No configuration found for project ${context.projectName}`
|
|
89
|
+
);
|
|
80
90
|
}
|
|
81
91
|
const projectRoot = _nullishCoalesce(_optionalChain([projectConfig, 'optionalAccess', _5 => _5.root]), () => ( workspaceRoot));
|
|
82
92
|
const sourceRoot = _nullishCoalesce(_optionalChain([projectConfig, 'optionalAccess', _6 => _6.sourceRoot]), () => ( workspaceRoot));
|
|
83
93
|
const projectName = _nullishCoalesce(_optionalChain([projectConfig, 'optionalAccess', _7 => _7.name]), () => ( context.projectName));
|
|
84
94
|
config.workspaceRoot = workspaceRoot;
|
|
85
|
-
const tokenized = await
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
const tokenized = await _chunkDD5DCADPjs.applyWorkspaceTokens.call(void 0,
|
|
96
|
+
options,
|
|
97
|
+
{
|
|
98
|
+
config,
|
|
99
|
+
workspaceRoot,
|
|
100
|
+
projectRoot,
|
|
101
|
+
sourceRoot,
|
|
102
|
+
projectName,
|
|
103
|
+
...projectConfig
|
|
104
|
+
},
|
|
105
|
+
applyWorkspaceExecutorTokens
|
|
106
|
+
);
|
|
93
107
|
tokenized.engine ??= "docker";
|
|
94
108
|
tokenized.registry ??= config.registry.container;
|
|
95
109
|
try {
|
|
96
110
|
if (isDryRun) {
|
|
97
|
-
console.log(
|
|
111
|
+
console.log(
|
|
112
|
+
`Would publish to ${tokenized.registry}, but [dry-run] was set`
|
|
113
|
+
);
|
|
98
114
|
} else {
|
|
99
115
|
console.log(`Published to ${tokenized.registry}`);
|
|
100
|
-
const packageManager =
|
|
116
|
+
const packageManager = _chunkRUPAIXLMjs.getPackageInfo.call(void 0, projectConfig);
|
|
101
117
|
if (packageManager) {
|
|
102
118
|
tokenized["build-args"] ??= [
|
|
103
119
|
"ENVIRONMENT=production",
|
|
@@ -118,25 +134,30 @@ async function* publishExecutor(options, context) {
|
|
|
118
134
|
tokenized["labels"].push(`org.opencontainers.image.version=${version}`);
|
|
119
135
|
const tags = await getRegistryVersion(projectName, config);
|
|
120
136
|
if (tags.length === 0) {
|
|
121
|
-
tokenized["labels"].push(
|
|
137
|
+
tokenized["labels"].push(
|
|
138
|
+
`org.opencontainers.image.created=${(/* @__PURE__ */ new Date()).toISOString()}`
|
|
139
|
+
);
|
|
122
140
|
} else if (tags.includes(version)) {
|
|
123
|
-
console.warn(
|
|
141
|
+
console.warn(
|
|
142
|
+
`Skipped package "${projectName}" because v${version} already exists in ${tokenized.registry}`
|
|
143
|
+
);
|
|
124
144
|
return {
|
|
125
145
|
success: true
|
|
126
146
|
};
|
|
127
147
|
}
|
|
128
148
|
} else {
|
|
129
|
-
console.warn(
|
|
149
|
+
console.warn(
|
|
150
|
+
`No package manager found for project "${projectName}" - Skipping container publishing`
|
|
151
|
+
);
|
|
130
152
|
return {
|
|
131
153
|
success: true
|
|
132
154
|
};
|
|
133
155
|
}
|
|
134
|
-
const { project, target, configuration } = _devkit.parseTargetString.call(void 0,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}, tokenized, context)) {
|
|
156
|
+
const { project, target, configuration } = _devkit.parseTargetString.call(void 0,
|
|
157
|
+
"container",
|
|
158
|
+
context
|
|
159
|
+
);
|
|
160
|
+
for await (const output of await _devkit.runExecutor.call(void 0, { project, target, configuration }, tokenized, context)) {
|
|
140
161
|
if (!output.success) {
|
|
141
162
|
throw new Error("Could not compile application files");
|
|
142
163
|
}
|
|
@@ -155,39 +176,57 @@ async function* publishExecutor(options, context) {
|
|
|
155
176
|
};
|
|
156
177
|
}
|
|
157
178
|
}
|
|
158
|
-
|
|
159
|
-
var getRegistryVersion = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (name, config) => {
|
|
179
|
+
var getRegistryVersion = (name, config) => {
|
|
160
180
|
if (!name) {
|
|
161
|
-
throw new Error(
|
|
181
|
+
throw new Error(
|
|
182
|
+
"The `getRegistryVersion` function requires a container name."
|
|
183
|
+
);
|
|
162
184
|
}
|
|
163
185
|
try {
|
|
164
|
-
const tagsApiUrl = `${config.registry.container}/v2/namespaces/${encodeURIComponent(config.namespace ? config.namespace : "storm-software")}/repositories/${encodeURIComponent(
|
|
186
|
+
const tagsApiUrl = `${config.registry.container}/v2/namespaces/${encodeURIComponent(config.namespace ? config.namespace : "storm-software")}/repositories/${encodeURIComponent(
|
|
187
|
+
name.replace(`${config.namespace}-`, "")
|
|
188
|
+
)}/tags`;
|
|
165
189
|
console.log(`Checking for existing version at ${tagsApiUrl}`);
|
|
166
|
-
return new Promise(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
res.on("data", (data) => {
|
|
172
|
-
if (data) {
|
|
173
|
-
console.log(`Existing versions found at ${tagsApiUrl} - ${data}`);
|
|
174
|
-
const json = JSON.parse(data.toString());
|
|
175
|
-
return resolve(json.results.filter((result) => result.status === "active" && result.name && result.name !== "latest").map((result) => result.name));
|
|
190
|
+
return new Promise(
|
|
191
|
+
(resolve, reject) => _https2.default.get(tagsApiUrl, (res) => {
|
|
192
|
+
if (res.statusCode === 404) {
|
|
193
|
+
console.log(`No existing version found at ${tagsApiUrl}`);
|
|
194
|
+
return resolve([]);
|
|
176
195
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
196
|
+
res.on("data", (data) => {
|
|
197
|
+
if (data) {
|
|
198
|
+
console.log(
|
|
199
|
+
`Existing versions found at ${tagsApiUrl} - ${data}`
|
|
200
|
+
);
|
|
201
|
+
const json = JSON.parse(data.toString());
|
|
202
|
+
return resolve(
|
|
203
|
+
json.results.filter(
|
|
204
|
+
(result) => result.status === "active" && result.name && result.name !== "latest"
|
|
205
|
+
).map((result) => result.name)
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
return reject(
|
|
209
|
+
new Error(
|
|
210
|
+
"No data returned from container registry, expected a 404 if no tags exist"
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
});
|
|
214
|
+
}).on("error", (e) => {
|
|
215
|
+
throw e;
|
|
216
|
+
})
|
|
217
|
+
);
|
|
182
218
|
} catch (error) {
|
|
183
219
|
console.error(`Failed to get version from ${config.registry.container}`);
|
|
184
220
|
console.error(error);
|
|
185
221
|
console.log("");
|
|
186
|
-
throw new Error(
|
|
187
|
-
|
|
188
|
-
|
|
222
|
+
throw new Error(
|
|
223
|
+
`Could not get version from container registry - ${config.registry.container}`,
|
|
224
|
+
{
|
|
225
|
+
cause: error
|
|
226
|
+
}
|
|
227
|
+
);
|
|
189
228
|
}
|
|
190
|
-
}
|
|
229
|
+
};
|
|
191
230
|
|
|
192
231
|
|
|
193
232
|
|