Skip to content

Commit 3d2004b

Browse files
authored
fix: Long repository names caused naming conflicts (#555)
Fixes #554
1 parent 3904d28 commit 3d2004b

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/webhook-handler.lambda.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ export async function handler(event: AWSLambda.APIGatewayProxyEventV2): Promise<
176176
}
177177

178178
// set execution name which is also used as runner name which are limited to 64 characters
179-
let executionName = `${payload.repository.full_name.replace('/', '-')}-${getHeader(event, 'x-github-delivery')}`.slice(0, 64);
179+
let executionName = payload.repository.full_name.replace('/', '-').slice(0, 50);
180+
let deliveryId = getHeader(event, 'x-github-delivery') ?? `${Math.random()}`;
181+
executionName = `${executionName}-${deliveryId.slice(0, 63-executionName.length)}`;
180182
// start execution
181183
const input = {
182184
owner: payload.repository.owner.login,

test/default.integ.snapshot/github-runners-test.assets.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@
157157
}
158158
}
159159
},
160-
"e7954c04f03129866fa75a1501b4d61587a381c13cc9b973c0a45c2f208b44d3": {
160+
"89312fab9eebb39d2c29004774d33b212c37c8fd8b0f0efb6679f51b655cf37a": {
161161
"source": {
162-
"path": "asset.e7954c04f03129866fa75a1501b4d61587a381c13cc9b973c0a45c2f208b44d3.lambda",
162+
"path": "asset.89312fab9eebb39d2c29004774d33b212c37c8fd8b0f0efb6679f51b655cf37a.lambda",
163163
"packaging": "zip"
164164
},
165165
"destinations": {
166166
"current_account-current_region": {
167167
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
168-
"objectKey": "e7954c04f03129866fa75a1501b4d61587a381c13cc9b973c0a45c2f208b44d3.zip",
168+
"objectKey": "89312fab9eebb39d2c29004774d33b212c37c8fd8b0f0efb6679f51b655cf37a.zip",
169169
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
170170
}
171171
}
@@ -209,15 +209,15 @@
209209
}
210210
}
211211
},
212-
"e603ba581db10cb1c8aac2b942091e7ce5f8cbb3b3077132445ebe7dbf183027": {
212+
"2625d437bf0d2085f1f545485692a1ee03962b8bf2fc8a01e461567773ada62a": {
213213
"source": {
214214
"path": "github-runners-test.template.json",
215215
"packaging": "file"
216216
},
217217
"destinations": {
218218
"current_account-current_region": {
219219
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
220-
"objectKey": "e603ba581db10cb1c8aac2b942091e7ce5f8cbb3b3077132445ebe7dbf183027.json",
220+
"objectKey": "2625d437bf0d2085f1f545485692a1ee03962b8bf2fc8a01e461567773ada62a.json",
221221
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
222222
}
223223
}

test/default.integ.snapshot/github-runners-test.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16006,7 +16006,7 @@
1600616006
"S3Bucket": {
1600716007
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
1600816008
},
16009-
"S3Key": "e7954c04f03129866fa75a1501b4d61587a381c13cc9b973c0a45c2f208b44d3.zip"
16009+
"S3Key": "89312fab9eebb39d2c29004774d33b212c37c8fd8b0f0efb6679f51b655cf37a.zip"
1601016010
},
1601116011
"Description": "Handle GitHub webhook and start runner orchestrator",
1601216012
"Environment": {

0 commit comments

Comments
 (0)