@intentius/chant-lexicon-gitlab 0.0.13 → 0.0.14

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.
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "algorithm": "xxhash64",
3
3
  "artifacts": {
4
- "manifest.json": "2a9ab90e8dd88933",
4
+ "manifest.json": "fc31254013f297f8",
5
5
  "meta.json": "c663c6c63748a9d0",
6
6
  "types/index.d.ts": "64e65524615be023",
7
7
  "rules/missing-stage.ts": "6d5379e74209a735",
8
8
  "rules/missing-script.ts": "923dde9acb46cc28",
9
9
  "rules/deprecated-only-except.ts": "1f5a8c785777fb03",
10
10
  "rules/artifact-no-expiry.ts": "26874cb6adfbca26",
11
+ "rules/wgl012.ts": "3d188d13fb2236c0",
11
12
  "rules/wgl011.ts": "b6b97e5104d91267",
12
13
  "rules/wgl015.ts": "d7e9e080994f985",
13
- "rules/wgl012.ts": "3d188d13fb2236c0",
14
- "rules/yaml-helpers.ts": "b5416b80369484f2",
15
14
  "rules/wgl010.ts": "1548cad287cdf286",
16
- "rules/wgl014.ts": "6248a852888e8028",
17
15
  "rules/wgl013.ts": "3519c933e23fc605",
16
+ "rules/wgl014.ts": "6248a852888e8028",
17
+ "rules/yaml-helpers.ts": "b5416b80369484f2",
18
18
  "skills/chant-gitlab.md": "4393eb63e0b84b7f"
19
19
  },
20
- "composite": "9af2adcc06f56cf1"
20
+ "composite": "cb4aab25c84e3aa4"
21
21
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitlab",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "GitLab",
6
6
  "intrinsics": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-gitlab",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "files": ["src/", "dist/"],
@@ -22,7 +22,7 @@
22
22
  "prepack": "bun run bundle && bun run validate"
23
23
  },
24
24
  "dependencies": {
25
- "@intentius/chant": "0.0.12"
25
+ "@intentius/chant": "0.0.13"
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "^5.9.3"
@@ -30,7 +30,7 @@ npm install --save-dev @intentius/chant-lexicon-gitlab
30
30
 
31
31
  {{file:docs-snippets/src/quickstart.ts}}
32
32
 
33
- The lexicon provides **3 resources** (Job, Workflow, Default), **13 property types** (Image, Cache, Artifacts, Rule, Environment, Trigger, and more), the \`CI\` pseudo-parameter object for predefined variables, and the \`reference()\` intrinsic for YAML \`!reference\` tags.
33
+ The lexicon provides **3 resources** (Job, Workflow, Default), **16 property types** (Image, Cache, Artifacts, Rule, Environment, Trigger, Need, Service, and more), the \`CI\` pseudo-parameter object for predefined variables, and the \`reference()\` intrinsic for YAML \`!reference\` tags.
34
34
  `;
35
35
 
36
36
  const outputFormat = `The GitLab lexicon serializes resources into **\`.gitlab-ci.yml\` YAML**. Keys are
@@ -130,7 +130,7 @@ build-app:
130
130
 
131
131
  ## Resource types
132
132
 
133
- The lexicon provides 3 resource types and 13 property types:
133
+ The lexicon provides 3 resource types and 16 property types:
134
134
 
135
135
  ### Resources
136
136
 
@@ -156,6 +156,10 @@ The lexicon provides 3 resource types and 13 property types:
156
156
  | \`Parallel\` | Job | Job parallelization (matrix builds) |
157
157
  | \`Release\` | Job | GitLab Release creation |
158
158
  | \`AutoCancel\` | Workflow | Pipeline auto-cancellation settings |
159
+ | \`Need\` | Job | Job dependency for DAG-mode execution |
160
+ | \`Inherit\` | Job | Controls which global defaults a job inherits |
161
+ | \`Service\` | Job, Default | Sidecar service container (e.g. Docker-in-Docker, databases) |
162
+ | \`WorkflowRule\` | Workflow | Conditional rules for pipeline-level execution |
159
163
 
160
164
  ## Shared config
161
165
 
@@ -218,7 +222,7 @@ deploy:
218
222
  when: manual
219
223
  \`\`\`
220
224
 
221
- The \`ifCondition\` property maps to \`if:\` in the YAML (since \`if\` is a reserved word in TypeScript).
225
+ The \`if\` property maps directly to \`if:\` in the YAML. Use the \`CI\` pseudo-parameter object for type-safe variable references.
222
226
 
223
227
  ## Environments
224
228
 
@@ -473,23 +477,23 @@ bun test # runs the example's tests
473
477
 
474
478
  ## Getting Started
475
479
 
476
- \`examples/getting-started/\` — a 3-stage Node.js pipeline with build, test, and deploy jobs.
480
+ \`examples/getting-started/\` — a 2-stage Node.js pipeline with build and test jobs.
477
481
 
478
482
  \`\`\`
479
483
  src/
480
- ├── config.ts # Shared config: images, caches, artifacts, rules, environments
481
- └── pipeline.ts # Job definitions: build, test, deploy
484
+ ├── config.ts # Shared config: image, cache
485
+ └── pipeline.ts # Job definitions: build, test
482
486
  \`\`\`
483
487
 
484
488
  ### Shared configuration
485
489
 
486
- \`config.ts\` extracts reusable objects — images, caches, artifacts, rules, and environments — so jobs stay concise:
490
+ \`config.ts\` extracts reusable objects — image and cache — so jobs stay concise:
487
491
 
488
492
  {{file:getting-started/src/config.ts}}
489
493
 
490
494
  ### Pipeline jobs
491
495
 
492
- \`pipeline.ts\` defines three jobs that import shared config directly:
496
+ \`pipeline.ts\` defines two jobs that import shared config:
493
497
 
494
498
  {{file:getting-started/src/pipeline.ts}}
495
499
 
@@ -501,64 +505,45 @@ src/
501
505
  stages:
502
506
  - build
503
507
  - test
504
- - deploy
505
508
 
506
509
  build:
507
510
  stage: build
508
- image: node:20-alpine
511
+ image:
512
+ name: node:20-alpine
509
513
  cache:
510
- key: $CI_COMMIT_REF_SLUG
514
+ key: '$CI_COMMIT_REF_SLUG'
511
515
  paths:
512
516
  - node_modules/
513
517
  policy: pull-push
514
518
  script:
515
- - npm ci
519
+ - npm install
516
520
  - npm run build
517
- artifacts:
518
- paths:
519
- - dist/
520
- expire_in: 1 hour
521
521
 
522
522
  test:
523
523
  stage: test
524
- image: node:20-alpine
524
+ image:
525
+ name: node:20-alpine
525
526
  cache:
526
- key: $CI_COMMIT_REF_SLUG
527
+ key: '$CI_COMMIT_REF_SLUG'
527
528
  paths:
528
529
  - node_modules/
529
530
  policy: pull-push
530
531
  script:
531
- - npm ci
532
+ - npm install
532
533
  - npm test
533
534
  artifacts:
534
- paths:
535
- - coverage/
536
- expire_in: 1 week
537
535
  reports:
538
536
  junit: coverage/junit.xml
539
- rules:
540
- - if: $CI_MERGE_REQUEST_IID
541
- - if: $CI_COMMIT_BRANCH
542
-
543
- deploy:
544
- stage: deploy
545
- image: node:20-alpine
546
- script:
547
- - npm run deploy
548
- environment:
549
- name: production
550
- url: https://example.com
551
- rules:
552
- - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
553
- when: manual
537
+ paths:
538
+ - coverage/
539
+ expire_in: '1 week'
554
540
  \`\`\`
555
541
 
556
542
  **Patterns demonstrated:**
557
543
 
558
- 1. **Shared config** — reusable images, caches, artifacts, and rules extracted into \`config.ts\`
559
- 2. **Conditional execution** — merge request and branch rules control when jobs run
560
- 3. **Manual deployment** — deploy requires manual trigger on the default branch
561
- 4. **JUnit reports** — test artifacts include JUnit XML for GitLab MR display
544
+ 1. **Shared config** — reusable image and cache extracted into \`config.ts\`
545
+ 2. **JUnit reports** — test artifacts include JUnit XML for GitLab MR display
546
+ 3. **Stage ordering** — stages collected automatically from job declarations
562
547
 
563
548
  ## Docker Build
564
549
 
@@ -613,48 +598,9 @@ export const deployInfra = new Job({
613
598
 
614
599
  ### Service pipeline (API)
615
600
 
616
- Builds a Docker image, pushes to ECR, and deploys the API service stack with cross-stack parameter passing:
617
-
618
- \`\`\`typescript
619
- import { Job, Image, Service, Need, Rule } from "@intentius/chant-lexicon-gitlab";
620
- import { CI } from "@intentius/chant-lexicon-gitlab";
621
-
622
- const ECR_URL = "$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com";
623
- const ECR_REPO = "alb-api";
624
- const fullImage = \\\`\\\${ECR_URL}/\\\${ECR_REPO}\\\`;
625
-
626
- const dockerImage = new Image({ name: "docker:27-cli" });
627
- const dind = new Service({ name: "docker:27-dind", alias: "docker" });
628
-
629
- export const buildImage = new Job({
630
- stage: "build",
631
- image: dockerImage,
632
- services: [dind],
633
- variables: { DOCKER_TLS_CERTDIR: "/certs" },
634
- before_script: [
635
- "apk add --no-cache aws-cli",
636
- \\\`aws ecr get-login-password | docker login --username AWS --password-stdin \\\${ECR_URL}\\\`,
637
- ],
638
- script: [
639
- \\\`docker build -t \\\${fullImage}:\\\${CI.CommitRefSlug} .\\\`,
640
- \\\`docker push \\\${fullImage}:\\\${CI.CommitRefSlug}\\\`,
641
- ],
642
- rules: [new Rule({ if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" })],
643
- });
601
+ Builds a Docker image, pushes to ECR, and deploys the API service stack with cross-stack parameter passing. The full source lives in the cross-lexicon example \`examples/gitlab-aws-alb-api/\`:
644
602
 
645
- export const deployService = new Job({
646
- stage: "deploy",
647
- image: new Image({ name: "amazon/aws-cli:latest" }),
648
- needs: [new Need({ job: "build-image" })],
649
- script: [
650
- // Fetch shared ALB outputs and map to CF parameter overrides
651
- "OUTPUTS=$(aws cloudformation describe-stacks --stack-name shared-alb --query 'Stacks[0].Outputs' --output json)",
652
- 'PARAMS=$(echo "$OUTPUTS" | jq -r \\'[...output-to-param mapping...] | join(" ")\\')',
653
- "aws cloudformation deploy --template-file templates/template.json --stack-name shared-alb-api --capabilities CAPABILITY_IAM --no-fail-on-empty-changeset --parameter-overrides $PARAMS",
654
- ],
655
- rules: [new Rule({ if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" })],
656
- });
657
- \`\`\`
603
+ {{file:../../../examples/gitlab-aws-alb-api/src/pipeline.ts}}
658
604
 
659
605
  **Key patterns:**
660
606