@intentius/chant-lexicon-gitlab 0.0.10 → 0.0.11
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/package.json +2 -2
- package/src/codegen/docs.ts +107 -2
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "xxhash64",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "940e3afc86046e46",
|
|
5
5
|
"meta.json": "c663c6c63748a9d0",
|
|
6
6
|
"types/index.d.ts": "64e65524615be023",
|
|
7
7
|
"rules/missing-stage.ts": "6d5379e74209a735",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"rules/wgl013.ts": "3519c933e23fc605",
|
|
18
18
|
"skills/chant-gitlab.md": "4393eb63e0b84b7f"
|
|
19
19
|
},
|
|
20
|
-
"composite": "
|
|
20
|
+
"composite": "3a7c7f06b1b16276"
|
|
21
21
|
}
|
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-gitlab",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": ["src/", "dist/"],
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"prepack": "bun run bundle && bun run validate"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@intentius/chant": "0.0.
|
|
24
|
+
"@intentius/chant": "0.0.10"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typescript": "^5.9.3"
|
package/src/codegen/docs.ts
CHANGED
|
@@ -460,8 +460,8 @@ export default {
|
|
|
460
460
|
{
|
|
461
461
|
slug: "examples",
|
|
462
462
|
title: "Examples",
|
|
463
|
-
description: "Walkthrough of
|
|
464
|
-
content: `
|
|
463
|
+
description: "Walkthrough of GitLab CI/CD examples — pipelines, composites, and cross-lexicon patterns",
|
|
464
|
+
content: `Runnable examples live in the lexicon's \`examples/\` directory. Clone the repo and try them:
|
|
465
465
|
|
|
466
466
|
\`\`\`bash
|
|
467
467
|
cd examples/getting-started
|
|
@@ -559,6 +559,111 @@ deploy:
|
|
|
559
559
|
2. **Conditional execution** — merge request and branch rules control when jobs run
|
|
560
560
|
3. **Manual deployment** — deploy requires manual trigger on the default branch
|
|
561
561
|
4. **JUnit reports** — test artifacts include JUnit XML for GitLab MR display
|
|
562
|
+
|
|
563
|
+
## Docker Build
|
|
564
|
+
|
|
565
|
+
\`examples/docker-build/\` — builds and pushes a Docker image using the \`DockerBuild\` composite.
|
|
566
|
+
|
|
567
|
+
{{file:docker-build/src/pipeline.ts}}
|
|
568
|
+
|
|
569
|
+
The \`DockerBuild\` composite expands to a job with Docker-in-Docker service, registry login, build, and push steps.
|
|
570
|
+
|
|
571
|
+
## Node Pipeline
|
|
572
|
+
|
|
573
|
+
\`examples/node-pipeline/\` — a full Node.js CI pipeline using the \`NodePipeline\` composite.
|
|
574
|
+
|
|
575
|
+
{{file:node-pipeline/src/pipeline.ts}}
|
|
576
|
+
|
|
577
|
+
## Python Pipeline
|
|
578
|
+
|
|
579
|
+
\`examples/python-pipeline/\` — a Python CI pipeline using the \`PythonPipeline\` composite.
|
|
580
|
+
|
|
581
|
+
{{file:python-pipeline/src/pipeline.ts}}
|
|
582
|
+
|
|
583
|
+
## Review App
|
|
584
|
+
|
|
585
|
+
\`examples/review-app/\` — deploys a review environment per merge request using the \`ReviewApp\` composite.
|
|
586
|
+
|
|
587
|
+
{{file:review-app/src/pipeline.ts}}
|
|
588
|
+
|
|
589
|
+
## AWS ALB Deployment
|
|
590
|
+
|
|
591
|
+
A cross-lexicon example showing how to deploy AWS CloudFormation stacks from GitLab CI. Three separate pipelines mirror the separate-project AWS ALB pattern:
|
|
592
|
+
|
|
593
|
+
### Infra pipeline
|
|
594
|
+
|
|
595
|
+
Deploys the shared ALB stack (VPC, ALB, ECS cluster, ECR repos):
|
|
596
|
+
|
|
597
|
+
\`\`\`typescript
|
|
598
|
+
import { Job, Image, Rule } from "@intentius/chant-lexicon-gitlab";
|
|
599
|
+
|
|
600
|
+
const awsImage = new Image({ name: "amazon/aws-cli:latest" });
|
|
601
|
+
|
|
602
|
+
export const deployInfra = new Job({
|
|
603
|
+
stage: "deploy",
|
|
604
|
+
image: awsImage,
|
|
605
|
+
script: [
|
|
606
|
+
"aws cloudformation deploy --template-file templates/template.json --stack-name shared-alb --capabilities CAPABILITY_IAM --no-fail-on-empty-changeset",
|
|
607
|
+
],
|
|
608
|
+
rules: [
|
|
609
|
+
new Rule({ if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" }),
|
|
610
|
+
],
|
|
611
|
+
});
|
|
612
|
+
\`\`\`
|
|
613
|
+
|
|
614
|
+
### Service pipeline (API)
|
|
615
|
+
|
|
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
|
+
});
|
|
644
|
+
|
|
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
|
+
\`\`\`
|
|
658
|
+
|
|
659
|
+
**Key patterns:**
|
|
660
|
+
|
|
661
|
+
1. **ECR login** — uses \`aws ecr get-login-password\` instead of GitLab registry credentials
|
|
662
|
+
2. **Cross-stack parameter passing** — \`describe-stacks\` fetches outputs from the infra stack, \`jq\` maps them to \`--parameter-overrides\`
|
|
663
|
+
3. **Job naming** — \`buildImage\` serializes to \`build-image\` in YAML; \`Need\` references must use kebab-case
|
|
664
|
+
4. **Docker-in-Docker** — \`docker:27-cli\` image with \`docker:27-dind\` service for container builds
|
|
665
|
+
|
|
666
|
+
The full examples live in \`examples/gitlab-aws-alb-infra/\`, \`examples/gitlab-aws-alb-api/\`, and \`examples/gitlab-aws-alb-ui/\`.
|
|
562
667
|
`,
|
|
563
668
|
},
|
|
564
669
|
{
|