@pipeline-builder/pipeline-manager 6.5.5 → 6.5.7

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.
Files changed (65) hide show
  1. package/README.md +11 -3
  2. package/dist/agent/post-steps.d.ts +1 -1
  3. package/dist/agent/post-steps.d.ts.map +1 -1
  4. package/dist/agent/post-steps.js +27 -31
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +8 -9
  7. package/dist/commands/audit-stacks.d.ts +2 -1
  8. package/dist/commands/audit-stacks.d.ts.map +1 -1
  9. package/dist/commands/audit-stacks.js +12 -2
  10. package/dist/commands/provision-steps.d.ts +1 -1
  11. package/dist/commands/provision-steps.js +2 -2
  12. package/dist/commands/provision.js +2 -2
  13. package/dist/commands/redrive-events.d.ts +4 -3
  14. package/dist/commands/redrive-events.d.ts.map +1 -1
  15. package/dist/commands/redrive-events.js +51 -18
  16. package/dist/commands/runner-signing-key.js +2 -2
  17. package/dist/commands/{setup-runner.d.ts → setup-account.d.ts} +133 -71
  18. package/dist/commands/setup-account.d.ts.map +1 -0
  19. package/dist/commands/setup-account.js +1366 -0
  20. package/dist/commands/store-token.d.ts +6 -28
  21. package/dist/commands/store-token.d.ts.map +1 -1
  22. package/dist/commands/store-token.js +12 -139
  23. package/dist/config/cli.constants.d.ts +0 -8
  24. package/dist/config/cli.constants.d.ts.map +1 -1
  25. package/dist/config/cli.constants.js +1 -9
  26. package/dist/lambda/events-handler.js +1558 -0
  27. package/dist/lambda/runner-handler.d.ts +27 -1
  28. package/dist/lambda/runner-handler.d.ts.map +1 -1
  29. package/dist/lambda/runner-handler.js +428 -71
  30. package/dist/lambda/runner-inspect-connection.d.ts +45 -0
  31. package/dist/lambda/runner-inspect-connection.d.ts.map +1 -0
  32. package/dist/lambda/runner-inspect-connection.js +157 -0
  33. package/dist/lambda/runner-jws.d.ts.map +1 -1
  34. package/dist/lambda/runner-jws.js +64 -6
  35. package/dist/lambda/runner-sources.d.ts +12 -0
  36. package/dist/lambda/runner-sources.d.ts.map +1 -1
  37. package/dist/lambda/runner-sources.js +25 -16
  38. package/dist/lambda/token-renew-handler.d.ts +3 -2
  39. package/dist/lambda/token-renew-handler.d.ts.map +1 -1
  40. package/dist/lambda/token-renew-handler.js +17 -5
  41. package/dist/templates/account-stack.json +2060 -0
  42. package/dist/templates/forwarder-stack.json +133 -0
  43. package/dist/utils/{runner-template.d.ts → account-template.d.ts} +83 -18
  44. package/dist/utils/account-template.d.ts.map +1 -0
  45. package/dist/utils/account-template.js +340 -0
  46. package/dist/utils/inspect-buildspec.d.ts +9 -0
  47. package/dist/utils/inspect-buildspec.d.ts.map +1 -0
  48. package/dist/utils/inspect-buildspec.js +209 -0
  49. package/dist/utils/service-account.d.ts +10 -2
  50. package/dist/utils/service-account.d.ts.map +1 -1
  51. package/dist/utils/service-account.js +10 -4
  52. package/package.json +5 -4
  53. package/dist/commands/setup-events.d.ts +0 -15
  54. package/dist/commands/setup-events.d.ts.map +0 -1
  55. package/dist/commands/setup-events.js +0 -182
  56. package/dist/commands/setup-runner.d.ts.map +0 -1
  57. package/dist/commands/setup-runner.js +0 -1132
  58. package/dist/templates/events-stack.json +0 -192
  59. package/dist/templates/runner-stack.json +0 -960
  60. package/dist/templates/token-renew-stack.json +0 -115
  61. package/dist/utils/cron.d.ts +0 -28
  62. package/dist/utils/cron.d.ts.map +0 -1
  63. package/dist/utils/cron.js +0 -119
  64. package/dist/utils/runner-template.d.ts.map +0 -1
  65. package/dist/utils/runner-template.js +0 -238
@@ -1,192 +0,0 @@
1
- {
2
- "AWSTemplateFormatVersion": "2010-09-09",
3
- "Description": "Pipeline Builder event ingestion — EventBridge rule, SQS queue, and Lambda that resolves each pipeline's pb.pipeline-id tag and forwards CodePipeline events to the reporting service API. Lambda code is deployed separately via pipeline-manager infra setup-events.",
4
- "Parameters": {
5
- "PlatformBaseUrl": {
6
- "Type": "String",
7
- "Description": "Base URL of the platform (e.g. https://app.example.com)"
8
- },
9
- "PlatformSecretName": {
10
- "Type": "String",
11
- "Description": "Secrets Manager secret name containing the reporting:ingest service-account key (e.g. pipeline-builder/{orgId}/reporting-ingest)"
12
- },
13
- "DoraEnabled": {
14
- "Type": "String",
15
- "Default": "false",
16
- "AllowedValues": ["false", "true"],
17
- "Description": "When true, the ingestion Lambda resolves commit timestamps in-account for DORA lead time (extra SCM/secret cost). Enable only for orgs with the advanced_reporting add-on."
18
- }
19
- },
20
- "Conditions": {
21
- "DoraOn": { "Fn::Equals": [{ "Ref": "DoraEnabled" }, "true"] }
22
- },
23
- "Resources": {
24
- "EventQueue": {
25
- "Type": "AWS::SQS::Queue",
26
- "Properties": {
27
- "QueueName": "pipeline-builder-events",
28
- "VisibilityTimeout": 300,
29
- "MessageRetentionPeriod": 1209600,
30
- "RedrivePolicy": {
31
- "deadLetterTargetArn": { "Fn::GetAtt": ["DeadLetterQueue", "Arn"] },
32
- "maxReceiveCount": 3
33
- }
34
- }
35
- },
36
- "DeadLetterQueue": {
37
- "Type": "AWS::SQS::Queue",
38
- "Properties": {
39
- "QueueName": "pipeline-builder-events-dlq",
40
- "MessageRetentionPeriod": 1209600
41
- }
42
- },
43
- "EventQueuePolicy": {
44
- "Type": "AWS::SQS::QueuePolicy",
45
- "Properties": {
46
- "Queues": [{ "Ref": "EventQueue" }],
47
- "PolicyDocument": {
48
- "Statement": [{
49
- "Effect": "Allow",
50
- "Principal": { "Service": "events.amazonaws.com" },
51
- "Action": "sqs:SendMessage",
52
- "Resource": { "Fn::GetAtt": ["EventQueue", "Arn"] }
53
- }]
54
- }
55
- }
56
- },
57
- "EventRule": {
58
- "Type": "AWS::Events::Rule",
59
- "Properties": {
60
- "Name": "pipeline-builder-codepipeline-events",
61
- "Description": "Capture CodePipeline state changes for reporting",
62
- "State": "ENABLED",
63
- "EventPattern": {
64
- "source": ["aws.codepipeline"],
65
- "detail-type": [
66
- "CodePipeline Pipeline Execution State Change",
67
- "CodePipeline Stage Execution State Change",
68
- "CodePipeline Action Execution State Change"
69
- ]
70
- },
71
- "Targets": [{
72
- "Id": "pipeline-events-queue",
73
- "Arn": { "Fn::GetAtt": ["EventQueue", "Arn"] }
74
- }]
75
- }
76
- },
77
- "LambdaRole": {
78
- "Type": "AWS::IAM::Role",
79
- "Properties": {
80
- "RoleName": "pipeline-builder-event-ingestion",
81
- "AssumeRolePolicyDocument": {
82
- "Version": "2012-10-17",
83
- "Statement": [{
84
- "Effect": "Allow",
85
- "Principal": { "Service": "lambda.amazonaws.com" },
86
- "Action": "sts:AssumeRole"
87
- }]
88
- },
89
- "ManagedPolicyArns": [
90
- { "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" }
91
- ],
92
- "Policies": [{
93
- "PolicyName": "event-ingestion",
94
- "PolicyDocument": {
95
- "Statement": [
96
- {
97
- "Effect": "Allow",
98
- "Action": ["sqs:ReceiveMessage", "sqs:DeleteMessage", "sqs:GetQueueAttributes"],
99
- "Resource": { "Fn::GetAtt": ["EventQueue", "Arn"] }
100
- },
101
- {
102
- "Effect": "Allow",
103
- "Action": ["sqs:StartMessageMoveTask", "sqs:ListMessageMoveTasks", "sqs:GetQueueAttributes"],
104
- "Resource": [
105
- { "Fn::GetAtt": ["EventQueue", "Arn"] },
106
- { "Fn::GetAtt": ["DeadLetterQueue", "Arn"] }
107
- ]
108
- },
109
- {
110
- "Effect": "Allow",
111
- "Action": "cloudwatch:GetMetricStatistics",
112
- "Resource": "*"
113
- },
114
- {
115
- "Effect": "Allow",
116
- "Action": "secretsmanager:GetSecretValue",
117
- "Resource": [
118
- { "Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/platform-*" },
119
- { "Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/reporting-ingest-*" },
120
- { "Fn::If": ["DoraOn", { "Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/github-token-*" }, { "Ref": "AWS::NoValue" }] },
121
- { "Fn::If": ["DoraOn", { "Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/github-token/*" }, { "Ref": "AWS::NoValue" }] }
122
- ]
123
- },
124
- {
125
- "Effect": "Allow",
126
- "Action": "codepipeline:ListTagsForResource",
127
- "Resource": { "Fn::Sub": "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${AWS::AccountId}:*" }
128
- },
129
- {
130
- "Effect": "Allow",
131
- "Action": "codebuild:BatchGetBuilds",
132
- "Resource": { "Fn::Sub": "arn:${AWS::Partition}:codebuild:${AWS::Region}:${AWS::AccountId}:project/*" }
133
- },
134
- {
135
- "Effect": "Allow",
136
- "Action": "logs:FilterLogEvents",
137
- "Resource": { "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/codebuild/*:*" }
138
- },
139
- {
140
- "Fn::If": ["DoraOn", {
141
- "Effect": "Allow",
142
- "Action": "codecommit:GetCommit",
143
- "Resource": { "Fn::Sub": "arn:${AWS::Partition}:codecommit:${AWS::Region}:${AWS::AccountId}:*" }
144
- }, { "Ref": "AWS::NoValue" }]
145
- }
146
- ]
147
- }
148
- }]
149
- }
150
- },
151
- "EventHandler": {
152
- "Type": "AWS::Lambda::Function",
153
- "Properties": {
154
- "FunctionName": "pipeline-builder-event-ingestion",
155
- "Runtime": "nodejs26.x",
156
- "Handler": "index.handler",
157
- "Code": {
158
- "ZipFile": "exports.handler=async(event)=>{console.log('Placeholder handler — run pipeline-manager infra setup-events to deploy real code');return{statusCode:200,body:JSON.stringify({message:'hello',records:event.Records?.length||0})}}"
159
- },
160
- "Role": { "Fn::GetAtt": ["LambdaRole", "Arn"] },
161
- "Timeout": 60,
162
- "MemorySize": 256,
163
- "Environment": {
164
- "Variables": {
165
- "PLATFORM_BASE_URL": { "Ref": "PlatformBaseUrl" },
166
- "PLATFORM_SECRET_NAME": { "Ref": "PlatformSecretName" },
167
- "DORA_ENABLED": { "Ref": "DoraEnabled" },
168
- "EVENT_DLQ_ARN": { "Fn::GetAtt": ["DeadLetterQueue", "Arn"] }
169
- }
170
- }
171
- }
172
- },
173
- "EventSourceMapping": {
174
- "Type": "AWS::Lambda::EventSourceMapping",
175
- "Properties": {
176
- "EventSourceArn": { "Fn::GetAtt": ["EventQueue", "Arn"] },
177
- "FunctionName": { "Ref": "EventHandler" },
178
- "BatchSize": 10,
179
- "MaximumBatchingWindowInSeconds": 5,
180
- "Enabled": true,
181
- "FunctionResponseTypes": ["ReportBatchItemFailures"]
182
- }
183
- }
184
- },
185
- "Outputs": {
186
- "EventQueueArn": { "Value": { "Fn::GetAtt": ["EventQueue", "Arn"] } },
187
- "EventQueueUrl": { "Value": { "Ref": "EventQueue" } },
188
- "DeadLetterQueueUrl": { "Value": { "Ref": "DeadLetterQueue" } },
189
- "LambdaFunctionArn": { "Value": { "Fn::GetAtt": ["EventHandler", "Arn"] } },
190
- "EventRuleName": { "Value": { "Ref": "EventRule" } }
191
- }
192
- }