effect-ci 0.1.3 → 0.1.4
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.
|
@@ -301,6 +301,15 @@ var setupArtifactsRemote = (root, name, repo, host, branch, log) => {
|
|
|
301
301
|
remote = cf("artifacts", "namespaces", "repos", "create", host.namespace, "--name", repo, "--default-branch", branch).remote;
|
|
302
302
|
log(`Created Artifacts repository ${host.namespace}/${repo}`);
|
|
303
303
|
}
|
|
304
|
+
if (host.queue) subscribeToQueue(host.namespace, host.queue, repo, log);
|
|
305
|
+
execFileSync3("git", ["remote", "add", name, remote], { cwd: root });
|
|
306
|
+
log(`Added Git remote ${name} \u2192 ${remote}`);
|
|
307
|
+
const match = artifactsRemote.exec(remote);
|
|
308
|
+
if (!match) throw new Error("Artifacts returned an unexpected remote URL");
|
|
309
|
+
return { remote, namespace: match[1], repo: match[2] };
|
|
310
|
+
};
|
|
311
|
+
var subscribeToQueue = (namespace, queueName, repo, log) => {
|
|
312
|
+
const host = { namespace, queue: queueName };
|
|
304
313
|
const queue = cf("queues", "list").find((entry) => entry.queue_name === host.queue);
|
|
305
314
|
if (!queue) throw new Error(`Queue ${host.queue} not found; deploy the host first`);
|
|
306
315
|
const subscription = `${host.queue}-${repo}`.slice(0, 64);
|
|
@@ -316,11 +325,6 @@ var setupArtifactsRemote = (root, name, repo, host, branch, log) => {
|
|
|
316
325
|
}));
|
|
317
326
|
log(`Subscribed ${host.namespace}/${repo} pushes to ${host.queue}`);
|
|
318
327
|
}
|
|
319
|
-
execFileSync3("git", ["remote", "add", name, remote], { cwd: root });
|
|
320
|
-
log(`Added Git remote ${name} \u2192 ${remote}`);
|
|
321
|
-
const match = artifactsRemote.exec(remote);
|
|
322
|
-
if (!match) throw new Error("Artifacts returned an unexpected remote URL");
|
|
323
|
-
return { remote, namespace: match[1], repo: match[2] };
|
|
324
328
|
};
|
|
325
329
|
var pushToArtifacts = (root, target, refspecs, token, quiet = false) => spawnSync("git", ["push", ...quiet ? ["--quiet"] : [], target.remote, ...[refspecs].flat()], {
|
|
326
330
|
cwd: root,
|
|
@@ -1193,11 +1197,11 @@ var runPush = async (input, cwd, detected) => {
|
|
|
1193
1197
|
signal: AbortSignal.timeout(15e3)
|
|
1194
1198
|
}).catch(() => void 0);
|
|
1195
1199
|
const host = response?.ok ? (await response.json()).artifacts : void 0;
|
|
1196
|
-
if (typeof host?.namespace !== "string" || typeof host.queue !== "string")
|
|
1200
|
+
if (typeof host?.namespace !== "string" || host.queue !== void 0 && typeof host.queue !== "string")
|
|
1197
1201
|
throw new CliFailure("CI_REMOTE_UNAVAILABLE", ExitCode.providerUnavailable, "This host does not accept Artifacts pushes. Update the host, or add an Artifacts remote yourself.");
|
|
1198
1202
|
const repo = basename(root).toLowerCase().replace(/[^a-z0-9_.-]+/g, "-").replace(/^[^a-z0-9]+/, "").slice(0, 100) || "project";
|
|
1199
1203
|
try {
|
|
1200
|
-
target = setupArtifactsRemote(root, name, repo, { namespace: host.namespace, queue: host.queue }, branch, log);
|
|
1204
|
+
target = setupArtifactsRemote(root, name, repo, { namespace: host.namespace, ...typeof host.queue === "string" ? { queue: host.queue } : {} }, branch, log);
|
|
1201
1205
|
} catch (error) {
|
|
1202
1206
|
throw new CliFailure(
|
|
1203
1207
|
"CI_REMOTE_AUTH_REQUIRED",
|
package/dist/effect-ci.js
CHANGED