projen-pipelines 0.2.8 → 0.2.10
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/.jsii +296 -3
- package/API.md +474 -0
- package/lib/assign-approver/base.d.ts +19 -0
- package/lib/assign-approver/base.js +16 -0
- package/lib/assign-approver/github.d.ts +22 -0
- package/lib/assign-approver/github.js +85 -0
- package/lib/assign-approver/index.d.ts +2 -0
- package/lib/assign-approver/index.js +19 -0
- package/lib/awscdk/base.js +1 -1
- package/lib/awscdk/bash.js +1 -1
- package/lib/awscdk/github.js +1 -1
- package/lib/awscdk/gitlab.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/steps/artifact-steps.js +2 -2
- package/lib/steps/aws-assume-role.step.js +1 -1
- package/lib/steps/registries.js +2 -2
- package/lib/steps/step.js +4 -4
- package/llm.md +214 -0
- package/node_modules/semver/bin/semver.js +2 -0
- package/node_modules/semver/classes/comparator.js +2 -0
- package/node_modules/semver/classes/index.js +2 -0
- package/node_modules/semver/classes/range.js +2 -0
- package/node_modules/semver/classes/semver.js +4 -3
- package/node_modules/semver/functions/clean.js +2 -0
- package/node_modules/semver/functions/cmp.js +2 -0
- package/node_modules/semver/functions/coerce.js +2 -0
- package/node_modules/semver/functions/compare-build.js +2 -0
- package/node_modules/semver/functions/compare-loose.js +2 -0
- package/node_modules/semver/functions/compare.js +2 -0
- package/node_modules/semver/functions/diff.js +2 -0
- package/node_modules/semver/functions/eq.js +2 -0
- package/node_modules/semver/functions/gt.js +2 -0
- package/node_modules/semver/functions/gte.js +2 -0
- package/node_modules/semver/functions/inc.js +2 -0
- package/node_modules/semver/functions/lt.js +2 -0
- package/node_modules/semver/functions/lte.js +2 -0
- package/node_modules/semver/functions/major.js +2 -0
- package/node_modules/semver/functions/minor.js +2 -0
- package/node_modules/semver/functions/neq.js +2 -0
- package/node_modules/semver/functions/parse.js +2 -0
- package/node_modules/semver/functions/patch.js +2 -0
- package/node_modules/semver/functions/prerelease.js +2 -0
- package/node_modules/semver/functions/rcompare.js +2 -0
- package/node_modules/semver/functions/rsort.js +2 -0
- package/node_modules/semver/functions/satisfies.js +2 -0
- package/node_modules/semver/functions/sort.js +2 -0
- package/node_modules/semver/functions/valid.js +2 -0
- package/node_modules/semver/index.js +2 -0
- package/node_modules/semver/internal/constants.js +2 -0
- package/node_modules/semver/internal/debug.js +2 -0
- package/node_modules/semver/internal/identifiers.js +2 -0
- package/node_modules/semver/internal/lrucache.js +2 -0
- package/node_modules/semver/internal/parse-options.js +2 -0
- package/node_modules/semver/internal/re.js +8 -4
- package/node_modules/semver/package.json +3 -3
- package/node_modules/semver/preload.js +2 -0
- package/node_modules/semver/ranges/gtr.js +2 -0
- package/node_modules/semver/ranges/intersects.js +2 -0
- package/node_modules/semver/ranges/ltr.js +2 -0
- package/node_modules/semver/ranges/max-satisfying.js +2 -0
- package/node_modules/semver/ranges/min-satisfying.js +2 -0
- package/node_modules/semver/ranges/min-version.js +2 -0
- package/node_modules/semver/ranges/outside.js +2 -0
- package/node_modules/semver/ranges/simplify.js +2 -0
- package/node_modules/semver/ranges/subset.js +2 -0
- package/node_modules/semver/ranges/to-comparators.js +2 -0
- package/node_modules/semver/ranges/valid.js +2 -0
- package/package.json +5 -5
package/llm.md
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Projen Pipelines - LLM Context
|
|
2
|
+
|
|
3
|
+
This document provides comprehensive information about the projen-pipelines library to assist LLMs in generating code and providing accurate guidance.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Projen Pipelines is an open-source project that automates CI/CD pipeline generation using Projen (a project configuration tool created by the inventor of AWS CDK). It provides high-level abstractions for defining continuous delivery pipelines with a focus on AWS CDK applications.
|
|
8
|
+
|
|
9
|
+
The library supports multiple CI/CD platforms (currently GitHub Actions, GitLab CI, and bash scripts) and allows users to easily switch between them without rewriting pipeline configurations.
|
|
10
|
+
|
|
11
|
+
## Key Features
|
|
12
|
+
|
|
13
|
+
- **Automated pipeline code generation**: Generate CI/CD configuration files without manual writing
|
|
14
|
+
- **Multi-platform support**: Deploy to GitHub Actions, GitLab CI, or bash scripts
|
|
15
|
+
- **Baked-in proven defaults**: Optimized pipeline configurations
|
|
16
|
+
- **Compliance-as-code integration**: Integrate compliance requirements directly into pipelines
|
|
17
|
+
- **Platform migration support**: Switch CI/CD platforms with minimal code changes
|
|
18
|
+
- **Complex deployment scenarios**: Handle multi-stage, multi-account deployments
|
|
19
|
+
- **AWS infrastructure management**: Streamlined deployment to AWS environments
|
|
20
|
+
|
|
21
|
+
## Core Architecture
|
|
22
|
+
|
|
23
|
+
Projen-pipelines is built on these architectural components:
|
|
24
|
+
|
|
25
|
+
1. **Pipeline Engines**: Abstract interfaces with concrete implementations for each CI/CD platform
|
|
26
|
+
2. **Pipeline Steps**: Modular, composable actions that make up pipeline workflows
|
|
27
|
+
3. **CDK Integration**: Specialized components for AWS CDK applications
|
|
28
|
+
4. **Configuration Generation**: Automated creation of platform-specific configuration files
|
|
29
|
+
|
|
30
|
+
## Pipeline Steps
|
|
31
|
+
|
|
32
|
+
Steps are the fundamental building blocks. Key step types include:
|
|
33
|
+
|
|
34
|
+
- `PipelineStep` (abstract base class)
|
|
35
|
+
- `SimpleCommandStep` (execute shell commands)
|
|
36
|
+
- `ProjenScriptStep` (run projen scripts)
|
|
37
|
+
- `StepSequence` (combine multiple steps)
|
|
38
|
+
- `AwsAssumeRoleStep` (assume AWS IAM roles)
|
|
39
|
+
- Various artifact management steps
|
|
40
|
+
|
|
41
|
+
## CDK Pipeline Integration
|
|
42
|
+
|
|
43
|
+
For AWS CDK applications, the library provides:
|
|
44
|
+
|
|
45
|
+
- `CDKPipeline` (abstract base class)
|
|
46
|
+
- Platform-specific implementations (e.g., `GithubCDKPipeline`)
|
|
47
|
+
- Support for multi-stage deployments (dev, prod, personal)
|
|
48
|
+
- Asset publishing and versioning
|
|
49
|
+
- Automated CloudFormation deployment
|
|
50
|
+
|
|
51
|
+
## Usage Example
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { awscdk } from 'projen';
|
|
55
|
+
import { GithubCDKPipeline } from 'projen-pipelines';
|
|
56
|
+
|
|
57
|
+
// Define your AWS CDK TypeScript App
|
|
58
|
+
const app = new awscdk.AwsCdkTypeScriptApp({
|
|
59
|
+
cdkVersion: '2.150.0',
|
|
60
|
+
name: 'my-awesome-app',
|
|
61
|
+
defaultReleaseBranch: 'main',
|
|
62
|
+
devDeps: [
|
|
63
|
+
'projen-pipelines',
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Create the pipeline
|
|
68
|
+
new GithubCDKPipeline(app, {
|
|
69
|
+
stackPrefix: 'MyApp',
|
|
70
|
+
iamRoleArns: {
|
|
71
|
+
default: 'arn:aws:iam::123456789012:role/GithubDeploymentRole',
|
|
72
|
+
},
|
|
73
|
+
useGithubEnvironments: true,
|
|
74
|
+
stages: [
|
|
75
|
+
{
|
|
76
|
+
name: 'dev',
|
|
77
|
+
env: { account: '123456789013', region: 'eu-central-1' },
|
|
78
|
+
}, {
|
|
79
|
+
name: 'prod',
|
|
80
|
+
manualApproval: true,
|
|
81
|
+
env: { account: '123456789014', region: 'eu-central-1' },
|
|
82
|
+
}],
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
After running `npx projen`, a specialized `app.ts` file is created for your CDK application.
|
|
87
|
+
Use it in your main.ts:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { PipelineApp } from './app';
|
|
91
|
+
import { BackendStack } from './stack';
|
|
92
|
+
|
|
93
|
+
const app = new PipelineApp({
|
|
94
|
+
provideDevStack: (scope, id, props) => {
|
|
95
|
+
return new BackendStack(scope, id, {
|
|
96
|
+
...props,
|
|
97
|
+
apiHostname: 'api-dev',
|
|
98
|
+
myConfigSetting: 'value-for-dev',
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
provideProdStack: (scope, id, props) => {
|
|
102
|
+
return new BackendStack(scope, id, {
|
|
103
|
+
...props,
|
|
104
|
+
apiHostname: 'api',
|
|
105
|
+
myConfigSetting: 'value-for-prod',
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
providePersonalStack: (scope, id, props) => {
|
|
109
|
+
return new BackendStack(scope, id, {
|
|
110
|
+
...props,
|
|
111
|
+
apiHostname: `api-${props.stageName}`,
|
|
112
|
+
myConfigSetting: 'value-for-personal-stage',
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
app.synth();
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Pipeline Configuration Options
|
|
121
|
+
|
|
122
|
+
When creating a CDK pipeline, these are key configuration options:
|
|
123
|
+
|
|
124
|
+
| Option | Description |
|
|
125
|
+
|--------|-------------|
|
|
126
|
+
| `stackPrefix` | Prefix for CloudFormation stack names |
|
|
127
|
+
| `iamRoleArns` | IAM roles for AWS access during deployment |
|
|
128
|
+
| `pkgNamespace` | Namespace for published packages |
|
|
129
|
+
| `stages` | Array of deployment stages with environment settings |
|
|
130
|
+
| `useGithubPackagesForAssembly` | Use GitHub Packages for assembly storage |
|
|
131
|
+
|
|
132
|
+
## Deployment Stages
|
|
133
|
+
|
|
134
|
+
Each stage can have these properties:
|
|
135
|
+
|
|
136
|
+
| Property | Description |
|
|
137
|
+
|----------|-------------|
|
|
138
|
+
| `name` | Stage name (e.g., 'dev', 'prod') |
|
|
139
|
+
| `env` | AWS environment (account ID and region) |
|
|
140
|
+
| `manualApproval` | Require manual approval before deployment |
|
|
141
|
+
|
|
142
|
+
## IAM Trust Configuration
|
|
143
|
+
|
|
144
|
+
For multi-account deployments, trust relationships are needed between accounts:
|
|
145
|
+
|
|
146
|
+
1. Bootstrap each account with CDK:
|
|
147
|
+
```bash
|
|
148
|
+
cdk bootstrap --trust <deployment_account_id> --cloudformation-execution-policies "arn:aws:iam::aws:policy/AdministratorAccess"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
2. Create an IAM role in the deployment account that can assume roles in target accounts:
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"Version": "2012-10-17",
|
|
155
|
+
"Statement": [
|
|
156
|
+
{
|
|
157
|
+
"Effect": "Allow",
|
|
158
|
+
"Action": "sts:AssumeRole",
|
|
159
|
+
"Resource": [
|
|
160
|
+
"arn:aws:iam::123456789013:role/cdk-*-123456789013-*",
|
|
161
|
+
"arn:aws:iam::123456789014:role/cdk-*-123456789014-*"
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
3. Configure OIDC trust for GitHub Actions (see [GitHub documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services))
|
|
169
|
+
|
|
170
|
+
## Generated Tasks
|
|
171
|
+
|
|
172
|
+
The CDK pipeline adds these tasks to your projen project:
|
|
173
|
+
|
|
174
|
+
| Task | Description |
|
|
175
|
+
|------|-------------|
|
|
176
|
+
| `deploy:personal` | Deploy personal development environment |
|
|
177
|
+
| `watch:personal` | Deploy personal environment in watch mode |
|
|
178
|
+
| `diff:personal` | Compare personal environment with code |
|
|
179
|
+
| `destroy:personal` | Remove personal environment |
|
|
180
|
+
| `deploy:feature` | Deploy feature branch environment |
|
|
181
|
+
| `diff:feature` | Compare feature environment with code |
|
|
182
|
+
| `destroy:feature` | Remove feature environment |
|
|
183
|
+
| `deploy:<stageName>` | Deploy a specific stage |
|
|
184
|
+
| `diff:<stageName>` | Compare stage with code |
|
|
185
|
+
| `publish:assets` | Publish CDK assets to all accounts |
|
|
186
|
+
| `bump` | Bump version based on git tags |
|
|
187
|
+
| `release:push-assembly` | Publish cloud assembly to registry |
|
|
188
|
+
|
|
189
|
+
## Best Practices
|
|
190
|
+
|
|
191
|
+
1. **IAM Role Setup**: Create minimal permission IAM roles for deployment
|
|
192
|
+
2. **Account Bootstrapping**: Bootstrap all accounts with appropriate trust relationships
|
|
193
|
+
3. **Testing Locally**: Use the `deploy:personal` task for testing changes locally
|
|
194
|
+
4. **Environment Variables**: For GitHub token issues, run `GITHUB_TOKEN= npx projen`
|
|
195
|
+
5. **Security**: Never use `AdministratorAccess` in production; use custom IAM policies
|
|
196
|
+
|
|
197
|
+
## Current Status and Limitations
|
|
198
|
+
|
|
199
|
+
Projen-Pipelines is currently in version 0.x, awaiting Projen's 1.0 release. Despite being pre-1.0, it's being used in production environments.
|
|
200
|
+
|
|
201
|
+
## Extension Points
|
|
202
|
+
|
|
203
|
+
The library is designed for extension via:
|
|
204
|
+
|
|
205
|
+
1. Creating custom pipeline steps
|
|
206
|
+
2. Implementing new engine adapters
|
|
207
|
+
3. Adding support for new application types
|
|
208
|
+
4. Contributing new deployment patterns
|
|
209
|
+
|
|
210
|
+
## For More Information
|
|
211
|
+
|
|
212
|
+
- GitHub Repository: https://github.com/open-constructs/projen-pipelines
|
|
213
|
+
- API Documentation: See the API.md file
|
|
214
|
+
- Examples: See the README.md for usage examples
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
1
3
|
const debug = require('../internal/debug')
|
|
2
4
|
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
|
|
3
|
-
const { safeRe: re,
|
|
5
|
+
const { safeRe: re, t } = require('../internal/re')
|
|
4
6
|
|
|
5
7
|
const parseOptions = require('../internal/parse-options')
|
|
6
8
|
const { compareIdentifiers } = require('../internal/identifiers')
|
|
@@ -182,8 +184,7 @@ class SemVer {
|
|
|
182
184
|
}
|
|
183
185
|
// Avoid an invalid semver results
|
|
184
186
|
if (identifier) {
|
|
185
|
-
const
|
|
186
|
-
const match = `-${identifier}`.match(r)
|
|
187
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])
|
|
187
188
|
if (!match || match[1] !== identifier) {
|
|
188
189
|
throw new Error(`invalid identifier: ${identifier}`)
|
|
189
190
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
1
3
|
const {
|
|
2
4
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
3
5
|
MAX_SAFE_BUILD_LENGTH,
|
|
@@ -76,12 +78,14 @@ createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
|
|
76
78
|
|
|
77
79
|
// ## Pre-release Version Identifier
|
|
78
80
|
// A numeric identifier, or a non-numeric identifier.
|
|
81
|
+
// Non-numberic identifiers include numberic identifiers but can be longer.
|
|
82
|
+
// Therefore non-numberic identifiers must go first.
|
|
79
83
|
|
|
80
|
-
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.
|
|
81
|
-
}|${src[t.
|
|
84
|
+
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
|
|
85
|
+
}|${src[t.NUMERICIDENTIFIER]})`)
|
|
82
86
|
|
|
83
|
-
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.
|
|
84
|
-
}|${src[t.
|
|
87
|
+
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
|
|
88
|
+
}|${src[t.NUMERICIDENTIFIERLOOSE]})`)
|
|
85
89
|
|
|
86
90
|
// ## Pre-release Version
|
|
87
91
|
// Hyphen, followed by one or more dot-separated pre-release version
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semver",
|
|
3
|
-
"version": "7.7.
|
|
3
|
+
"version": "7.7.2",
|
|
4
4
|
"description": "The semantic version parser used by npm.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@npmcli/eslint-config": "^5.0.0",
|
|
18
|
-
"@npmcli/template-oss": "4.
|
|
18
|
+
"@npmcli/template-oss": "4.24.3",
|
|
19
19
|
"benchmark": "^2.1.4",
|
|
20
20
|
"tap": "^16.0.0"
|
|
21
21
|
},
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"author": "GitHub Inc.",
|
|
53
53
|
"templateOSS": {
|
|
54
54
|
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
55
|
-
"version": "4.
|
|
55
|
+
"version": "4.24.3",
|
|
56
56
|
"engines": ">=10",
|
|
57
57
|
"distPaths": [
|
|
58
58
|
"classes/",
|
package/package.json
CHANGED
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
"commit-and-tag-version": "^12",
|
|
49
49
|
"constructs": "10.4.2",
|
|
50
50
|
"eslint": "^9",
|
|
51
|
-
"eslint-import-resolver-typescript": "^3.10.
|
|
51
|
+
"eslint-import-resolver-typescript": "^3.10.1",
|
|
52
52
|
"eslint-plugin-import": "^2.31.0",
|
|
53
53
|
"fs-extra": "^11.3.0",
|
|
54
54
|
"jest": "^29.7.0",
|
|
55
55
|
"jest-junit": "^16",
|
|
56
56
|
"jsii": "~5.8",
|
|
57
|
-
"jsii-diff": "^1.
|
|
57
|
+
"jsii-diff": "^1.112.0",
|
|
58
58
|
"jsii-docgen": "^10.5.0",
|
|
59
|
-
"jsii-pacmak": "^1.
|
|
59
|
+
"jsii-pacmak": "^1.112.0",
|
|
60
60
|
"jsii-rosetta": "~5.8",
|
|
61
61
|
"projen": "0.91.20",
|
|
62
|
-
"ts-jest": "^29.3.
|
|
62
|
+
"ts-jest": "^29.3.4",
|
|
63
63
|
"ts-node": "^10.9.2",
|
|
64
64
|
"typescript": "^5.8.3"
|
|
65
65
|
},
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"version": "0.2.
|
|
86
|
+
"version": "0.2.10",
|
|
87
87
|
"jest": {
|
|
88
88
|
"coverageProvider": "v8",
|
|
89
89
|
"testMatch": [
|