@intentius/chant-lexicon-gitlab 0.17.0 → 0.18.0
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/integrity.json +2 -2
- package/dist/manifest.json +1 -1
- package/dist/op/activities/gitlab.d.ts +15 -0
- package/dist/op/activities/gitlab.d.ts.map +1 -0
- package/dist/op/activities/index.d.ts +11 -0
- package/dist/op/activities/index.d.ts.map +1 -0
- package/package.json +8 -3
- package/src/op/activities/gitlab.ts +59 -0
- package/src/op/activities/index.ts +10 -0
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "702fde58d9d4cd38db552ae4388dbce5c944c5cfbf9d25ff12ba971deff2f963",
|
|
5
5
|
"meta.json": "931fc3246a55645b1493080bbeb160e5d205e42349e8bdca96ca243adb5f0da3",
|
|
6
6
|
"types/index.d.ts": "5cd2e99f135a929b72bdd822d00d780d39b1cd407ba0cfb3d511c7ac9d667b58",
|
|
7
7
|
"rules/artifact-no-expiry.ts": "3f3cabf9792cbf8207e53a25f506715466b19ec25e9c3b4d0d77fed6b2eb4542",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"skills/chant-gitlab-migrate.md": "4853d04980560b379e5b0f7267dcb0a1e5d5879cb9e9931681ce76b2a5fe69d8",
|
|
53
53
|
"skills/chant-gitlab-patterns.md": "6d9a44e9e8de4c3820be9d65381b0d2ede4cb3626aaaf0011e21838a9fbf556e"
|
|
54
54
|
},
|
|
55
|
-
"composite": "
|
|
55
|
+
"composite": "807c0b75654c607cf85a006d863940527f41bde5a6ffe07aad4bd9454a9ebc71"
|
|
56
56
|
}
|
package/dist/manifest.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface GitlabPipelineArgs {
|
|
2
|
+
/** GitLab project name or path (e.g. "group/project"). */
|
|
3
|
+
name: string;
|
|
4
|
+
/** Git ref to run the pipeline on. Default: current branch. */
|
|
5
|
+
ref?: string;
|
|
6
|
+
/** Poll interval in ms. Default: 30000. */
|
|
7
|
+
intervalMs?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Trigger a GitLab CI pipeline and wait for it to complete successfully.
|
|
11
|
+
* Requires `glab` CLI authenticated in the environment.
|
|
12
|
+
* Uses longInfra profile — 20m timeout, heartbeat every poll.
|
|
13
|
+
*/
|
|
14
|
+
export declare function gitlabPipeline(args: GitlabPipelineArgs, signal?: AbortSignal): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=gitlab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab.d.ts","sourceRoot":"","sources":["../../../src/op/activities/gitlab.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAsClG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gitlab Op activities — resolved by the core activity registry when a project's
|
|
3
|
+
* `chant.config.ts` lists the `gitlab` lexicon. `gitlabPipeline` triggers a
|
|
4
|
+
* pipeline over the GitLab CLI with heartbeat/retry semantics; relocated from the
|
|
5
|
+
* temporal lexicon (#809) so gitlab's imperative activity lives with its product.
|
|
6
|
+
* The `gitlabPipeline` step builder stays in core, re-exported from the temporal
|
|
7
|
+
* Op-authoring barrel like the other core builders.
|
|
8
|
+
*/
|
|
9
|
+
export { gitlabPipeline } from "./gitlab.js";
|
|
10
|
+
export type { GitlabPipelineArgs } from "./gitlab.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/op/activities/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-gitlab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "GitLab CI lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"types": "./dist/lint/post-synth/index.d.ts",
|
|
45
45
|
"default": "./src/lint/post-synth/index.ts"
|
|
46
46
|
},
|
|
47
|
+
"./op/activities": {
|
|
48
|
+
"development": "./src/op/activities/index.ts",
|
|
49
|
+
"types": "./dist/op/activities/index.d.ts",
|
|
50
|
+
"default": "./src/op/activities/index.ts"
|
|
51
|
+
},
|
|
47
52
|
"./manifest": "./dist/manifest.json",
|
|
48
53
|
"./meta": "./dist/meta.json",
|
|
49
54
|
"./types": "./dist/types/index.d.ts"
|
|
@@ -62,8 +67,8 @@
|
|
|
62
67
|
"typescript": "^5.9.3"
|
|
63
68
|
},
|
|
64
69
|
"peerDependencies": {
|
|
65
|
-
"@intentius/chant": "^0.
|
|
66
|
-
"@intentius/chant-lexicon-github": "^0.
|
|
70
|
+
"@intentius/chant": "^0.18.0",
|
|
71
|
+
"@intentius/chant-lexicon-github": "^0.18.0"
|
|
67
72
|
},
|
|
68
73
|
"peerDependenciesMeta": {
|
|
69
74
|
"@intentius/chant-lexicon-github": {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { exec } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { safeHeartbeat, sleep } from "@intentius/chant/op";
|
|
4
|
+
|
|
5
|
+
const execAsync = promisify(exec);
|
|
6
|
+
|
|
7
|
+
export interface GitlabPipelineArgs {
|
|
8
|
+
/** GitLab project name or path (e.g. "group/project"). */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Git ref to run the pipeline on. Default: current branch. */
|
|
11
|
+
ref?: string;
|
|
12
|
+
/** Poll interval in ms. Default: 30000. */
|
|
13
|
+
intervalMs?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Trigger a GitLab CI pipeline and wait for it to complete successfully.
|
|
18
|
+
* Requires `glab` CLI authenticated in the environment.
|
|
19
|
+
* Uses longInfra profile — 20m timeout, heartbeat every poll.
|
|
20
|
+
*/
|
|
21
|
+
export async function gitlabPipeline(args: GitlabPipelineArgs, signal?: AbortSignal): Promise<void> {
|
|
22
|
+
const ref = args.ref ?? "HEAD";
|
|
23
|
+
const interval = args.intervalMs ?? 30_000;
|
|
24
|
+
|
|
25
|
+
// Trigger
|
|
26
|
+
const { stdout: triggerOut } = await execAsync(
|
|
27
|
+
`glab ci run --project ${args.name} --ref ${ref}`,
|
|
28
|
+
{ signal },
|
|
29
|
+
);
|
|
30
|
+
console.log(triggerOut);
|
|
31
|
+
|
|
32
|
+
// Poll status
|
|
33
|
+
let attempt = 0;
|
|
34
|
+
while (true) {
|
|
35
|
+
if (signal?.aborted) throw new Error("gitlabPipeline aborted");
|
|
36
|
+
attempt++;
|
|
37
|
+
safeHeartbeat({ step: "gitlabPipeline", project: args.name, attempt });
|
|
38
|
+
|
|
39
|
+
const { stdout } = await execAsync(
|
|
40
|
+
`glab ci status --project ${args.name} --format json`,
|
|
41
|
+
{ signal },
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
let status: string | undefined;
|
|
45
|
+
try {
|
|
46
|
+
const parsed = JSON.parse(stdout) as { status?: string }[];
|
|
47
|
+
status = parsed[0]?.status;
|
|
48
|
+
} catch {
|
|
49
|
+
// Non-JSON output — keep polling
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (status === "success") return;
|
|
53
|
+
if (status === "failed" || status === "canceled") {
|
|
54
|
+
throw new Error(`GitLab pipeline for ${args.name} ended with status: ${status}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
await sleep(interval, signal);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gitlab Op activities — resolved by the core activity registry when a project's
|
|
3
|
+
* `chant.config.ts` lists the `gitlab` lexicon. `gitlabPipeline` triggers a
|
|
4
|
+
* pipeline over the GitLab CLI with heartbeat/retry semantics; relocated from the
|
|
5
|
+
* temporal lexicon (#809) so gitlab's imperative activity lives with its product.
|
|
6
|
+
* The `gitlabPipeline` step builder stays in core, re-exported from the temporal
|
|
7
|
+
* Op-authoring barrel like the other core builders.
|
|
8
|
+
*/
|
|
9
|
+
export { gitlabPipeline } from "./gitlab";
|
|
10
|
+
export type { GitlabPipelineArgs } from "./gitlab";
|