@synergenius/flowweaver-pack-gitlab-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.
- package/dist/target.d.ts +7 -1
- package/dist/target.js +47 -12
- package/package.json +4 -4
package/dist/target.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ import type { ExportOptions, ExportArtifacts, DeployInstructions } from '@synerg
|
|
|
17
17
|
export declare class GitLabCITarget extends BaseCICDTarget {
|
|
18
18
|
readonly name = "gitlab-ci";
|
|
19
19
|
readonly description = "GitLab CI/CD pipeline (.gitlab-ci.yml)";
|
|
20
|
+
/** Accumulated warnings for the current export run */
|
|
21
|
+
private _warnings;
|
|
20
22
|
readonly deploySchema: {
|
|
21
23
|
runner: {
|
|
22
24
|
type: "string";
|
|
@@ -54,9 +56,13 @@ export declare class GitLabCITarget extends BaseCICDTarget {
|
|
|
54
56
|
*/
|
|
55
57
|
private deriveStages;
|
|
56
58
|
/**
|
|
57
|
-
* Derive default image from @deploy annotations or built-in mappings.
|
|
59
|
+
* Derive default image from @runner annotation, @deploy annotations, or built-in mappings.
|
|
58
60
|
*/
|
|
59
61
|
private deriveDefaultImage;
|
|
62
|
+
/**
|
|
63
|
+
* Map GitHub-style runner labels to Docker images.
|
|
64
|
+
*/
|
|
65
|
+
private mapRunnerToImage;
|
|
60
66
|
/**
|
|
61
67
|
* Convert CI/CD triggers to GitLab CI workflow rules.
|
|
62
68
|
*/
|
package/dist/target.js
CHANGED
|
@@ -20,6 +20,8 @@ import * as path from 'path';
|
|
|
20
20
|
export class GitLabCITarget extends BaseCICDTarget {
|
|
21
21
|
name = 'gitlab-ci';
|
|
22
22
|
description = 'GitLab CI/CD pipeline (.gitlab-ci.yml)';
|
|
23
|
+
/** Accumulated warnings for the current export run */
|
|
24
|
+
_warnings = [];
|
|
23
25
|
deploySchema = {
|
|
24
26
|
runner: { type: 'string', description: 'Default Docker image', default: 'ubuntu:latest' },
|
|
25
27
|
};
|
|
@@ -29,6 +31,7 @@ export class GitLabCITarget extends BaseCICDTarget {
|
|
|
29
31
|
label: { type: 'string', description: 'Step display name' },
|
|
30
32
|
};
|
|
31
33
|
async generate(options) {
|
|
34
|
+
this._warnings = [];
|
|
32
35
|
const filePath = path.resolve(options.sourceFile);
|
|
33
36
|
const outputDir = path.resolve(options.outputDir);
|
|
34
37
|
// Parse the workflow file to get AST
|
|
@@ -64,11 +67,18 @@ export class GitLabCITarget extends BaseCICDTarget {
|
|
|
64
67
|
files.push(this.createFile(outputDir, 'SECRETS_SETUP.md', secretsDoc, 'other'));
|
|
65
68
|
}
|
|
66
69
|
}
|
|
70
|
+
// Warn about @concurrency (no direct GitLab equivalent)
|
|
71
|
+
for (const ast of targetWorkflows) {
|
|
72
|
+
if (ast.options?.cicd?.concurrency) {
|
|
73
|
+
this._warnings.push(`@concurrency: GitLab CI has no direct concurrency group equivalent. Use resource_group for serial execution or interruptible for auto-cancellation.`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
67
76
|
return {
|
|
68
77
|
files,
|
|
69
78
|
target: this.name,
|
|
70
79
|
workflowName: options.displayName || targetWorkflows[0].name,
|
|
71
80
|
entryPoint: files[0].relativePath,
|
|
81
|
+
warnings: this._warnings.length > 0 ? this._warnings : undefined,
|
|
72
82
|
};
|
|
73
83
|
}
|
|
74
84
|
getDeployInstructions(_artifacts) {
|
|
@@ -182,10 +192,15 @@ export class GitLabCITarget extends BaseCICDTarget {
|
|
|
182
192
|
return stages;
|
|
183
193
|
}
|
|
184
194
|
/**
|
|
185
|
-
* Derive default image from @deploy annotations or built-in mappings.
|
|
195
|
+
* Derive default image from @runner annotation, @deploy annotations, or built-in mappings.
|
|
186
196
|
*/
|
|
187
|
-
deriveDefaultImage(
|
|
188
|
-
// Check
|
|
197
|
+
deriveDefaultImage(ast, jobs) {
|
|
198
|
+
// Check @runner annotation first
|
|
199
|
+
const runner = ast.options?.cicd?.runner;
|
|
200
|
+
if (runner) {
|
|
201
|
+
return this.mapRunnerToImage(runner);
|
|
202
|
+
}
|
|
203
|
+
// Fall back to NODE_ACTION_MAP step images
|
|
189
204
|
for (const job of jobs) {
|
|
190
205
|
for (const step of job.steps) {
|
|
191
206
|
const mapping = this.resolveActionMapping(step, 'gitlab-ci');
|
|
@@ -195,6 +210,17 @@ export class GitLabCITarget extends BaseCICDTarget {
|
|
|
195
210
|
}
|
|
196
211
|
return undefined;
|
|
197
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Map GitHub-style runner labels to Docker images.
|
|
215
|
+
*/
|
|
216
|
+
mapRunnerToImage(runner) {
|
|
217
|
+
const imageMap = {
|
|
218
|
+
'ubuntu-latest': 'ubuntu:latest',
|
|
219
|
+
'ubuntu-22.04': 'ubuntu:22.04',
|
|
220
|
+
'ubuntu-20.04': 'ubuntu:20.04',
|
|
221
|
+
};
|
|
222
|
+
return imageMap[runner] || runner;
|
|
223
|
+
}
|
|
198
224
|
/**
|
|
199
225
|
* Convert CI/CD triggers to GitLab CI workflow rules.
|
|
200
226
|
*/
|
|
@@ -250,20 +276,29 @@ export class GitLabCITarget extends BaseCICDTarget {
|
|
|
250
276
|
}
|
|
251
277
|
// stage (use explicit stage from @stage assignment, or fall back to job ID)
|
|
252
278
|
jobObj.stage = job.stage || job.id;
|
|
253
|
-
// image (from runner
|
|
254
|
-
if (job.runner
|
|
255
|
-
|
|
256
|
-
'ubuntu-latest': 'ubuntu:latest',
|
|
257
|
-
'ubuntu-22.04': 'ubuntu:22.04',
|
|
258
|
-
'ubuntu-20.04': 'ubuntu:20.04',
|
|
259
|
-
};
|
|
260
|
-
const image = imageMap[job.runner] || job.runner;
|
|
261
|
-
jobObj.image = image;
|
|
279
|
+
// image (from per-job runner override via @job X runner=Y)
|
|
280
|
+
if (job.runner) {
|
|
281
|
+
jobObj.image = this.mapRunnerToImage(job.runner);
|
|
262
282
|
}
|
|
263
283
|
// tags (from @job tags or @tags)
|
|
264
284
|
if (job.tags && job.tags.length > 0) {
|
|
265
285
|
jobObj.tags = job.tags;
|
|
266
286
|
}
|
|
287
|
+
// matrix strategy (parallel: matrix:)
|
|
288
|
+
if (job.matrix) {
|
|
289
|
+
const matrixEntries = [];
|
|
290
|
+
if (job.matrix.dimensions && Object.keys(job.matrix.dimensions).length > 0) {
|
|
291
|
+
matrixEntries.push(job.matrix.dimensions);
|
|
292
|
+
}
|
|
293
|
+
if (job.matrix.include) {
|
|
294
|
+
for (const inc of job.matrix.include) {
|
|
295
|
+
matrixEntries.push(Object.fromEntries(Object.entries(inc).map(([k, v]) => [k, [v]])));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (matrixEntries.length > 0) {
|
|
299
|
+
jobObj.parallel = { matrix: matrixEntries };
|
|
300
|
+
}
|
|
301
|
+
}
|
|
267
302
|
// needs (for DAG mode instead of stage-based ordering)
|
|
268
303
|
if (job.needs.length > 0) {
|
|
269
304
|
jobObj.needs = job.needs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synergenius/flowweaver-pack-gitlab-ci",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "GitLab CI/CD export target for Flow Weaver",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"flowweaver-marketplace-pack",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"prepublishOnly": "npm run build"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
38
|
+
"@synergenius/flow-weaver": "^0.17.4",
|
|
39
|
+
"@types/node": "^20.0.0",
|
|
40
|
+
"typescript": "^5.0.0"
|
|
41
41
|
},
|
|
42
42
|
"license": "SEE LICENSE IN LICENSE",
|
|
43
43
|
"repository": {
|