@leitwerk-dev/process-sdk 0.5.10 → 0.5.12
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/dist/chunk-NXMRKXBU.js +31 -0
- package/dist/chunk-NXMRKXBU.js.map +1 -0
- package/dist/{extension-api-DJCzpYqC.d.ts → extension-api-jLGa33FO.d.ts} +3 -1
- package/dist/extension-api.d.ts +2 -0
- package/dist/extension-api.d.ts.map +1 -1
- package/dist/flow.d.ts +2 -9
- package/dist/flow.d.ts.map +1 -1
- package/dist/git-binary.js +4 -25
- package/dist/git-binary.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +103 -0
- package/dist/index.js.map +1 -1
- package/dist/repository-submodules.d.ts +8 -0
- package/dist/repository-submodules.d.ts.map +1 -0
- package/package.json +6 -6
- package/src/extension-api.ts +2 -0
- package/src/flow.ts +5 -9
- package/src/index.ts +2 -0
- package/src/repository-submodules.ts +121 -0
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveGitBinary
|
|
3
|
+
} from "./chunk-NXMRKXBU.js";
|
|
1
4
|
import {
|
|
2
5
|
RESERVED_INTEGRATION_TOOL_NAMES,
|
|
3
6
|
validatePiBuiltInToolArray
|
|
@@ -3951,6 +3954,7 @@ var FlowProcessBuilder = class extends FlowComponentBuilder {
|
|
|
3951
3954
|
const runtime = {
|
|
3952
3955
|
...capabilities.developmentTools === true ? { developmentTools: true } : {},
|
|
3953
3956
|
...capabilities.docker === true ? { docker: true } : {},
|
|
3957
|
+
...capabilities.repositorySubmodules === "best_effort" ? { repositorySubmodules: capabilities.repositorySubmodules } : {},
|
|
3954
3958
|
...capabilities.repositoryCheckout ? { repositoryCheckout: capabilities.repositoryCheckout } : {}
|
|
3955
3959
|
};
|
|
3956
3960
|
if (Object.keys(runtime).length) this.configuration.runtime = runtime;
|
|
@@ -5158,6 +5162,104 @@ function parseRepositoryIssueCancelledConfig(value) {
|
|
|
5158
5162
|
};
|
|
5159
5163
|
}
|
|
5160
5164
|
|
|
5165
|
+
// src/repository-submodules.ts
|
|
5166
|
+
import { spawn } from "child_process";
|
|
5167
|
+
var preserveLocalWork = [
|
|
5168
|
+
'status=$(git status --porcelain --ignored=matching --untracked-files=normal --ignore-submodules=dirty) && test -z "$status" || exit 1',
|
|
5169
|
+
"head=$(git rev-parse HEAD) || exit 1",
|
|
5170
|
+
// Do not move an unpushed detached commit. A named branch retains its HEAD.
|
|
5171
|
+
'test "$head" = "$sha1" || git symbolic-ref -q HEAD >/dev/null || test -n "$(git for-each-ref --contains "$head" refs/remotes --format="%(refname)")"'
|
|
5172
|
+
].join("; ");
|
|
5173
|
+
async function prepareRepositorySubmodules(projectKey, repoPath, signal) {
|
|
5174
|
+
const deadline = AbortSignal.timeout(3e4);
|
|
5175
|
+
const stop = signal ? AbortSignal.any([signal, deadline]) : deadline;
|
|
5176
|
+
const env = repositoryGitSubprocessEnv(projectKey, { GIT_TERMINAL_PROMPT: "0" });
|
|
5177
|
+
env.GIT_CONFIG_NOSYSTEM = "1";
|
|
5178
|
+
env.GIT_CONFIG_GLOBAL = "/dev/null";
|
|
5179
|
+
const config = [
|
|
5180
|
+
"-c",
|
|
5181
|
+
"protocol.allow=never",
|
|
5182
|
+
"-c",
|
|
5183
|
+
"protocol.https.allow=always",
|
|
5184
|
+
"-c",
|
|
5185
|
+
`protocol.ssh.allow=${env.GIT_SSH ? "always" : "never"}`,
|
|
5186
|
+
"-c",
|
|
5187
|
+
"http.followRedirects=false",
|
|
5188
|
+
"-c",
|
|
5189
|
+
"http.extraHeader=",
|
|
5190
|
+
...env.GIT_CONFIG_COUNT ? [] : ["-c", "credential.helper="]
|
|
5191
|
+
];
|
|
5192
|
+
const run = (args) => new Promise((resolve) => {
|
|
5193
|
+
if (stop.aborted) return resolve({ ok: false, output: "" });
|
|
5194
|
+
const child = spawn(resolveGitBinary(), repositoryGitArgs([...config, ...args]), {
|
|
5195
|
+
cwd: repoPath,
|
|
5196
|
+
env,
|
|
5197
|
+
detached: true,
|
|
5198
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
5199
|
+
});
|
|
5200
|
+
let output = Buffer.alloc(0);
|
|
5201
|
+
let stopped = false;
|
|
5202
|
+
const terminate = () => {
|
|
5203
|
+
stopped = true;
|
|
5204
|
+
try {
|
|
5205
|
+
if (child.pid) process.kill(-child.pid, "SIGKILL");
|
|
5206
|
+
} catch {
|
|
5207
|
+
}
|
|
5208
|
+
};
|
|
5209
|
+
stop.addEventListener("abort", terminate, { once: true });
|
|
5210
|
+
child.stdout.on("data", (chunk) => {
|
|
5211
|
+
if (output.length + chunk.length > 1024 * 1024) terminate();
|
|
5212
|
+
else output = Buffer.concat([output, chunk]);
|
|
5213
|
+
});
|
|
5214
|
+
child.on("error", () => {
|
|
5215
|
+
stopped = true;
|
|
5216
|
+
});
|
|
5217
|
+
child.on("close", (code) => {
|
|
5218
|
+
stop.removeEventListener("abort", terminate);
|
|
5219
|
+
resolve({ ok: !stopped && code === 0, output: output.toString("utf8") });
|
|
5220
|
+
});
|
|
5221
|
+
});
|
|
5222
|
+
const manifest = await run(["ls-files", "--stage", "--", ".gitmodules"]);
|
|
5223
|
+
if (manifest.ok && !manifest.output) return void 0;
|
|
5224
|
+
const safeWarning = (reason) => `Submodules in ${projectKey} are incomplete: ${reason}`;
|
|
5225
|
+
const unavailable = () => safeWarning(
|
|
5226
|
+
deadline.aborted ? "preparation timed out." : "check repository access or transport and run git submodule status --recursive."
|
|
5227
|
+
);
|
|
5228
|
+
if (!manifest.ok) return unavailable();
|
|
5229
|
+
const unmerged = await run(["ls-files", "--unmerged", "-z"]);
|
|
5230
|
+
if (!unmerged.ok) return unavailable();
|
|
5231
|
+
if (unmerged.output) return safeWarning("the checkout has unresolved conflicts.");
|
|
5232
|
+
const staged = await run([
|
|
5233
|
+
"diff",
|
|
5234
|
+
"--cached",
|
|
5235
|
+
"--raw",
|
|
5236
|
+
"--ignore-submodules=none",
|
|
5237
|
+
"--no-renames",
|
|
5238
|
+
"-z"
|
|
5239
|
+
]);
|
|
5240
|
+
const configStatus = await run(["status", "--porcelain", "--", ".gitmodules"]);
|
|
5241
|
+
if (!staged.ok || !configStatus.ok) return unavailable();
|
|
5242
|
+
if (/(?:^|\0):(?:160000 \d{6}|\d{6} 160000) /.test(staged.output) || configStatus.output)
|
|
5243
|
+
return safeWarning("existing submodule configuration was left untouched.");
|
|
5244
|
+
const before = await run(["submodule", "status", "--recursive"]);
|
|
5245
|
+
const incomplete = /^(?:[-+U])/m;
|
|
5246
|
+
if (!before.ok) return unavailable();
|
|
5247
|
+
if (!incomplete.test(before.output)) return void 0;
|
|
5248
|
+
if (!(await run(["submodule", "foreach", "--quiet", "--recursive", preserveLocalWork])).ok)
|
|
5249
|
+
return stop.aborted ? unavailable() : safeWarning("existing submodule work was left untouched.");
|
|
5250
|
+
const update = await run([
|
|
5251
|
+
"submodule",
|
|
5252
|
+
"update",
|
|
5253
|
+
"--init",
|
|
5254
|
+
"--recursive",
|
|
5255
|
+
"--checkout",
|
|
5256
|
+
"--jobs=4"
|
|
5257
|
+
]);
|
|
5258
|
+
const status = await run(["submodule", "status", "--recursive"]);
|
|
5259
|
+
if (!update.ok || !status.ok || incomplete.test(status.output)) return unavailable();
|
|
5260
|
+
return void 0;
|
|
5261
|
+
}
|
|
5262
|
+
|
|
5161
5263
|
// src/scoped-settings.ts
|
|
5162
5264
|
var scopedSettingsCapability = createCapabilityToken("core:scopedSettings");
|
|
5163
5265
|
function repositorySettingsIdentity(origin, repositoryId) {
|
|
@@ -5499,6 +5601,7 @@ export {
|
|
|
5499
5601
|
parseTicketDestinationId,
|
|
5500
5602
|
piServer,
|
|
5501
5603
|
piWorker,
|
|
5604
|
+
prepareRepositorySubmodules,
|
|
5502
5605
|
presentRepositoryIssueWatcherConfig,
|
|
5503
5606
|
projectParameters,
|
|
5504
5607
|
readTriggerFile,
|