@cloudsnorkel/cdk-github-runners 0.11.3 → 0.11.5
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/.gitattributes +1 -1
- package/.jsii +127 -93
- package/API.md +29 -2
- package/SETUP_GITHUB.md +9 -5
- package/assets/delete-failed-runner.lambda/index.js +55 -45
- package/assets/docker-images/lambda/linux-arm64/runner.js +1 -0
- package/assets/docker-images/lambda/linux-arm64/runner.sh +1 -1
- package/assets/docker-images/lambda/linux-x64/runner.js +1 -0
- package/assets/docker-images/lambda/linux-x64/runner.sh +1 -1
- package/assets/idle-runner-repear.lambda/index.js +65 -55
- package/assets/image-builders/aws-image-builder/delete-ami.lambda/index.js +14 -28
- package/assets/image-builders/aws-image-builder/filter-failed-builds.lambda/index.js +4 -14
- package/assets/image-builders/aws-image-builder/reaper.lambda/index.js +18 -30
- package/assets/image-builders/aws-image-builder/versioner.lambda/index.js +10 -16
- package/assets/providers/ami-root-device.lambda/index.js +12 -23
- package/assets/providers/build-image.lambda/index.js +16 -24
- package/assets/providers/update-lambda.lambda/index.js +5 -15
- package/assets/setup.lambda/index.html +20 -12
- package/assets/setup.lambda/index.js +17 -12
- package/assets/status.lambda/index.js +50 -55
- package/assets/token-retriever.lambda/index.js +51 -39
- package/assets/webhook-handler.lambda/index.js +32 -42
- package/lib/access.js +1 -1
- package/lib/delete-failed-runner-function.js +2 -2
- package/lib/delete-failed-runner.lambda.js +4 -8
- package/lib/idle-runner-repear-function.js +2 -2
- package/lib/idle-runner-repear.lambda.js +16 -19
- package/lib/image-builders/api.js +1 -1
- package/lib/image-builders/aws-image-builder/builder.js +1 -1
- package/lib/image-builders/aws-image-builder/delete-ami-function.js +2 -2
- package/lib/image-builders/aws-image-builder/delete-ami.lambda.js +11 -11
- package/lib/image-builders/aws-image-builder/deprecated/ami.js +1 -1
- package/lib/image-builders/aws-image-builder/deprecated/container.js +1 -1
- package/lib/image-builders/aws-image-builder/deprecated/linux-components.js +1 -1
- package/lib/image-builders/aws-image-builder/deprecated/windows-components.js +1 -1
- package/lib/image-builders/aws-image-builder/filter-failed-builds-function.js +2 -2
- package/lib/image-builders/aws-image-builder/filter-failed-builds.lambda.js +5 -5
- package/lib/image-builders/aws-image-builder/reaper-function.js +2 -2
- package/lib/image-builders/aws-image-builder/reaper.lambda.js +15 -13
- package/lib/image-builders/aws-image-builder/versioner-function.js +2 -2
- package/lib/image-builders/aws-image-builder/versioner.lambda.js +9 -9
- package/lib/image-builders/codebuild-deprecated.js +1 -1
- package/lib/image-builders/components.js +1 -1
- package/lib/image-builders/static.js +1 -1
- package/lib/lambda-github.d.ts +16 -13
- package/lib/lambda-github.js +33 -8
- package/lib/lambda-helpers.js +5 -5
- package/lib/providers/ami-root-device-function.js +2 -2
- package/lib/providers/ami-root-device.lambda.js +8 -7
- package/lib/providers/build-image-function.js +2 -2
- package/lib/providers/build-image.lambda.js +15 -13
- package/lib/providers/codebuild.js +10 -5
- package/lib/providers/common.d.ts +5 -1
- package/lib/providers/common.js +4 -4
- package/lib/providers/ec2.js +56 -17
- package/lib/providers/ecs.d.ts +7 -1
- package/lib/providers/ecs.js +8 -3
- package/lib/providers/fargate.js +12 -8
- package/lib/providers/lambda.js +4 -3
- package/lib/providers/update-lambda-function.js +2 -2
- package/lib/providers/update-lambda.lambda.js +6 -6
- package/lib/runner.js +6 -2
- package/lib/secrets.js +4 -2
- package/lib/setup-function.js +2 -2
- package/lib/setup.lambda.js +13 -7
- package/lib/status-function.js +2 -2
- package/lib/status.lambda.js +23 -17
- package/lib/token-retriever-function.js +2 -2
- package/lib/token-retriever.lambda.d.ts +2 -1
- package/lib/token-retriever.lambda.js +30 -8
- package/lib/webhook-handler-function.js +2 -2
- package/lib/webhook-handler.lambda.js +5 -5
- package/package.json +21 -10
|
@@ -2513,12 +2513,12 @@ __export(versioner_lambda_exports, {
|
|
|
2513
2513
|
increaseVersion: () => increaseVersion
|
|
2514
2514
|
});
|
|
2515
2515
|
module.exports = __toCommonJS(versioner_lambda_exports);
|
|
2516
|
-
var
|
|
2516
|
+
var import_client_imagebuilder = require("@aws-sdk/client-imagebuilder");
|
|
2517
2517
|
var import_semver = __toESM(require_semver2());
|
|
2518
2518
|
|
|
2519
2519
|
// src/lambda-helpers.ts
|
|
2520
|
-
var
|
|
2521
|
-
var sm = new
|
|
2520
|
+
var import_client_secrets_manager = require("@aws-sdk/client-secrets-manager");
|
|
2521
|
+
var sm = new import_client_secrets_manager.SecretsManagerClient();
|
|
2522
2522
|
async function customResourceRespond(event, responseStatus, reason, physicalResourceId, data) {
|
|
2523
2523
|
const responseBody = JSON.stringify({
|
|
2524
2524
|
Status: responseStatus,
|
|
@@ -2554,7 +2554,7 @@ async function customResourceRespond(event, responseStatus, reason, physicalReso
|
|
|
2554
2554
|
}
|
|
2555
2555
|
|
|
2556
2556
|
// src/image-builders/aws-image-builder/versioner.lambda.ts
|
|
2557
|
-
var ib = new
|
|
2557
|
+
var ib = new import_client_imagebuilder.ImagebuilderClient();
|
|
2558
2558
|
function increaseVersion(allVersions) {
|
|
2559
2559
|
let version = (0, import_semver.maxSatisfying)(allVersions, ">=0.0.0");
|
|
2560
2560
|
if (version === null) {
|
|
@@ -2581,13 +2581,13 @@ async function handler(event, context) {
|
|
|
2581
2581
|
case "Component": {
|
|
2582
2582
|
let result = {};
|
|
2583
2583
|
do {
|
|
2584
|
-
result = await ib.
|
|
2584
|
+
result = await ib.send(new import_client_imagebuilder.ListComponentsCommand({
|
|
2585
2585
|
filters: [{
|
|
2586
2586
|
name: "name",
|
|
2587
2587
|
values: [objectName]
|
|
2588
2588
|
}],
|
|
2589
2589
|
nextToken: result.nextToken
|
|
2590
|
-
})
|
|
2590
|
+
}));
|
|
2591
2591
|
allVersions = allVersions.concat(result.componentVersionList.map((i) => i.version || "1.0.0"));
|
|
2592
2592
|
} while (result.nextToken);
|
|
2593
2593
|
break;
|
|
@@ -2595,34 +2595,28 @@ async function handler(event, context) {
|
|
|
2595
2595
|
case "ImageRecipe": {
|
|
2596
2596
|
let result = {};
|
|
2597
2597
|
do {
|
|
2598
|
-
result = await ib.
|
|
2598
|
+
result = await ib.send(new import_client_imagebuilder.ListImageRecipesCommand({
|
|
2599
2599
|
filters: [{
|
|
2600
2600
|
name: "name",
|
|
2601
2601
|
values: [objectName]
|
|
2602
2602
|
}],
|
|
2603
2603
|
nextToken: result.nextToken
|
|
2604
|
-
}).promise();
|
|
2605
|
-
allVersions = allVersions.concat(result.imageRecipeSummaryList.map((i) => {
|
|
2606
|
-
var _a;
|
|
2607
|
-
return ((_a = i.arn) == null ? void 0 : _a.split("/").pop()) || "1.0.0";
|
|
2608
2604
|
}));
|
|
2605
|
+
allVersions = allVersions.concat(result.imageRecipeSummaryList.map((i) => i.arn?.split("/").pop() || "1.0.0"));
|
|
2609
2606
|
} while (result.nextToken);
|
|
2610
2607
|
break;
|
|
2611
2608
|
}
|
|
2612
2609
|
case "ContainerRecipe": {
|
|
2613
2610
|
let result = {};
|
|
2614
2611
|
do {
|
|
2615
|
-
result = await ib.
|
|
2612
|
+
result = await ib.send(new import_client_imagebuilder.ListContainerRecipesCommand({
|
|
2616
2613
|
filters: [{
|
|
2617
2614
|
name: "name",
|
|
2618
2615
|
values: [objectName]
|
|
2619
2616
|
}],
|
|
2620
2617
|
nextToken: result.nextToken
|
|
2621
|
-
}).promise();
|
|
2622
|
-
allVersions = allVersions.concat(result.containerRecipeSummaryList.map((i) => {
|
|
2623
|
-
var _a;
|
|
2624
|
-
return ((_a = i.arn) == null ? void 0 : _a.split("/").pop()) || "1.0.0";
|
|
2625
2618
|
}));
|
|
2619
|
+
allVersions = allVersions.concat(result.containerRecipeSummaryList.map((i) => i.arn?.split("/").pop() || "1.0.0"));
|
|
2626
2620
|
} while (result.nextToken);
|
|
2627
2621
|
break;
|
|
2628
2622
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/providers/ami-root-device.lambda.ts
|
|
@@ -33,11 +23,12 @@ __export(ami_root_device_lambda_exports, {
|
|
|
33
23
|
handler: () => handler
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(ami_root_device_lambda_exports);
|
|
36
|
-
var
|
|
26
|
+
var import_client_ec2 = require("@aws-sdk/client-ec2");
|
|
27
|
+
var import_client_ssm = require("@aws-sdk/client-ssm");
|
|
37
28
|
|
|
38
29
|
// src/lambda-helpers.ts
|
|
39
|
-
var
|
|
40
|
-
var sm = new
|
|
30
|
+
var import_client_secrets_manager = require("@aws-sdk/client-secrets-manager");
|
|
31
|
+
var sm = new import_client_secrets_manager.SecretsManagerClient();
|
|
41
32
|
async function customResourceRespond(event, responseStatus, reason, physicalResourceId, data) {
|
|
42
33
|
const responseBody = JSON.stringify({
|
|
43
34
|
Status: responseStatus,
|
|
@@ -73,12 +64,11 @@ async function customResourceRespond(event, responseStatus, reason, physicalReso
|
|
|
73
64
|
}
|
|
74
65
|
|
|
75
66
|
// src/providers/ami-root-device.lambda.ts
|
|
76
|
-
var ssm = new
|
|
77
|
-
var ec2 = new
|
|
67
|
+
var ssm = new import_client_ssm.SSMClient();
|
|
68
|
+
var ec2 = new import_client_ec2.EC2Client();
|
|
78
69
|
async function handleAmi(event, ami) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (((_a = imageDescs.Images) == null ? void 0 : _a.length) !== 1) {
|
|
70
|
+
const imageDescs = await ec2.send(new import_client_ec2.DescribeImagesCommand({ ImageIds: [ami] }));
|
|
71
|
+
if (imageDescs.Images?.length !== 1) {
|
|
82
72
|
await customResourceRespond(event, "FAILED", `${ami} doesn't exist`, "ERROR", {});
|
|
83
73
|
return;
|
|
84
74
|
}
|
|
@@ -92,7 +82,6 @@ async function handleAmi(event, ami) {
|
|
|
92
82
|
return;
|
|
93
83
|
}
|
|
94
84
|
async function handler(event, context) {
|
|
95
|
-
var _a, _b, _c;
|
|
96
85
|
try {
|
|
97
86
|
console.log(JSON.stringify({ ...event, ResponseURL: "..." }));
|
|
98
87
|
const ami = event.ResourceProperties.Ami;
|
|
@@ -107,7 +96,7 @@ async function handler(event, context) {
|
|
|
107
96
|
if (ami.startsWith("resolve:ssm:")) {
|
|
108
97
|
const ssmParam = ami.substring("resolve:ssm:".length);
|
|
109
98
|
console.log(`Checking SSM ${ssmParam}`);
|
|
110
|
-
const ssmValue = (
|
|
99
|
+
const ssmValue = (await ssm.send(new import_client_ssm.GetParameterCommand({ Name: ssmParam }))).Parameter?.Value;
|
|
111
100
|
if (!ssmValue) {
|
|
112
101
|
await customResourceRespond(event, "FAILED", `${ami} has no value`, "ERROR", {});
|
|
113
102
|
break;
|
|
@@ -117,12 +106,12 @@ async function handler(event, context) {
|
|
|
117
106
|
}
|
|
118
107
|
if (ami.startsWith("lt-")) {
|
|
119
108
|
console.log(`Checking Launch Template ${ami}`);
|
|
120
|
-
const lts = await ec2.
|
|
121
|
-
if (
|
|
109
|
+
const lts = await ec2.send(new import_client_ec2.DescribeLaunchTemplateVersionsCommand({ LaunchTemplateId: ami, Versions: ["$Latest"] }));
|
|
110
|
+
if (lts.LaunchTemplateVersions?.length !== 1) {
|
|
122
111
|
await customResourceRespond(event, "FAILED", `${ami} doesn't exist`, "ERROR", {});
|
|
123
112
|
break;
|
|
124
113
|
}
|
|
125
|
-
if (!
|
|
114
|
+
if (!lts.LaunchTemplateVersions[0].LaunchTemplateData?.ImageId) {
|
|
126
115
|
await customResourceRespond(event, "FAILED", `${ami} doesn't have an AMI`, "ERROR", {});
|
|
127
116
|
break;
|
|
128
117
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/providers/build-image.lambda.ts
|
|
@@ -33,11 +23,13 @@ __export(build_image_lambda_exports, {
|
|
|
33
23
|
handler: () => handler
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(build_image_lambda_exports);
|
|
36
|
-
var
|
|
26
|
+
var import_client_codebuild = require("@aws-sdk/client-codebuild");
|
|
27
|
+
var import_client_ecr = require("@aws-sdk/client-ecr");
|
|
28
|
+
var import_client_imagebuilder = require("@aws-sdk/client-imagebuilder");
|
|
37
29
|
|
|
38
30
|
// src/lambda-helpers.ts
|
|
39
|
-
var
|
|
40
|
-
var sm = new
|
|
31
|
+
var import_client_secrets_manager = require("@aws-sdk/client-secrets-manager");
|
|
32
|
+
var sm = new import_client_secrets_manager.SecretsManagerClient();
|
|
41
33
|
async function customResourceRespond(event, responseStatus, reason, physicalResourceId, data) {
|
|
42
34
|
const responseBody = JSON.stringify({
|
|
43
35
|
Status: responseStatus,
|
|
@@ -73,9 +65,9 @@ async function customResourceRespond(event, responseStatus, reason, physicalReso
|
|
|
73
65
|
}
|
|
74
66
|
|
|
75
67
|
// src/providers/build-image.lambda.ts
|
|
76
|
-
var codebuild = new
|
|
77
|
-
var ecr = new
|
|
78
|
-
var ib = new
|
|
68
|
+
var codebuild = new import_client_codebuild.CodeBuildClient();
|
|
69
|
+
var ecr = new import_client_ecr.ECRClient();
|
|
70
|
+
var ib = new import_client_imagebuilder.ImagebuilderClient();
|
|
79
71
|
async function handler(event, context) {
|
|
80
72
|
try {
|
|
81
73
|
console.log(JSON.stringify({ ...event, ResponseURL: "..." }));
|
|
@@ -91,7 +83,7 @@ async function handler(event, context) {
|
|
|
91
83
|
break;
|
|
92
84
|
}
|
|
93
85
|
console.log(`Starting CodeBuild project ${projectName}`);
|
|
94
|
-
await codebuild.
|
|
86
|
+
await codebuild.send(new import_client_codebuild.StartBuildCommand({
|
|
95
87
|
projectName,
|
|
96
88
|
environmentVariablesOverride: [
|
|
97
89
|
{
|
|
@@ -115,29 +107,29 @@ async function handler(event, context) {
|
|
|
115
107
|
value: event.ResponseURL
|
|
116
108
|
}
|
|
117
109
|
]
|
|
118
|
-
})
|
|
110
|
+
}));
|
|
119
111
|
break;
|
|
120
112
|
case "Delete":
|
|
121
|
-
const ecrImages = await ecr.
|
|
113
|
+
const ecrImages = await ecr.send(new import_client_ecr.ListImagesCommand({ repositoryName: repoName, maxResults: 100 }));
|
|
122
114
|
if (ecrImages.imageIds && ecrImages.imageIds.length > 0) {
|
|
123
|
-
await ecr.
|
|
115
|
+
await ecr.send(new import_client_ecr.BatchDeleteImageCommand({
|
|
124
116
|
imageIds: ecrImages.imageIds.map((i) => {
|
|
125
117
|
return { imageDigest: i.imageDigest };
|
|
126
118
|
}),
|
|
127
119
|
repositoryName: repoName
|
|
128
|
-
})
|
|
120
|
+
}));
|
|
129
121
|
}
|
|
130
122
|
if (ibName) {
|
|
131
|
-
const ibImages = await ib.
|
|
123
|
+
const ibImages = await ib.send(new import_client_imagebuilder.ListImagesCommand({ filters: [{ name: "name", values: [ibName] }] }));
|
|
132
124
|
if (ibImages.imageVersionList) {
|
|
133
125
|
for (const v of ibImages.imageVersionList) {
|
|
134
126
|
if (v.arn) {
|
|
135
|
-
const ibImageVersions = await ib.
|
|
127
|
+
const ibImageVersions = await ib.send(new import_client_imagebuilder.ListImageBuildVersionsCommand({ imageVersionArn: v.arn }));
|
|
136
128
|
if (ibImageVersions.imageSummaryList) {
|
|
137
129
|
for (const vs of ibImageVersions.imageSummaryList) {
|
|
138
130
|
if (vs.arn) {
|
|
139
131
|
console.log(`Deleting ${vs.arn}`);
|
|
140
|
-
await ib.
|
|
132
|
+
await ib.send(new import_client_imagebuilder.DeleteImageCommand({ imageBuildVersionArn: vs.arn }));
|
|
141
133
|
}
|
|
142
134
|
}
|
|
143
135
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/providers/update-lambda.lambda.ts
|
|
@@ -33,8 +23,8 @@ __export(update_lambda_lambda_exports, {
|
|
|
33
23
|
handler: () => handler
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(update_lambda_lambda_exports);
|
|
36
|
-
var
|
|
37
|
-
var lambda = new
|
|
26
|
+
var import_client_lambda = require("@aws-sdk/client-lambda");
|
|
27
|
+
var lambda = new import_client_lambda.LambdaClient();
|
|
38
28
|
function sleep(ms) {
|
|
39
29
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
40
30
|
}
|
|
@@ -42,14 +32,14 @@ async function handler(event) {
|
|
|
42
32
|
console.log(JSON.stringify(event));
|
|
43
33
|
while (true) {
|
|
44
34
|
try {
|
|
45
|
-
await lambda.
|
|
35
|
+
await lambda.send(new import_client_lambda.UpdateFunctionCodeCommand({
|
|
46
36
|
FunctionName: event.lambdaName,
|
|
47
37
|
ImageUri: `${event.repositoryUri}:${event.repositoryTag}`,
|
|
48
38
|
Publish: true
|
|
49
|
-
})
|
|
39
|
+
}));
|
|
50
40
|
break;
|
|
51
41
|
} catch (e) {
|
|
52
|
-
if (e
|
|
42
|
+
if (e instanceof import_client_lambda.ResourceConflictException) {
|
|
53
43
|
await sleep(1e4);
|
|
54
44
|
} else {
|
|
55
45
|
throw e;
|
|
@@ -5,24 +5,32 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Setup GitHub Runners</title>
|
|
7
7
|
<script type="module" crossorigin>
|
|
8
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const
|
|
9
|
-
and without any path. It should look something like <code>github.mycompany.com</code>.`,p=
|
|
8
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))l(i);new MutationObserver(i=>{for(const p of i)if(p.type==="childList")for(const c of p.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&l(c)}).observe(document,{childList:!0,subtree:!0});function r(i){const p={};return i.integrity&&(p.integrity=i.integrity),i.referrerPolicy&&(p.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?p.credentials="include":i.crossOrigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function l(i){if(i.ep)return;i.ep=!0;const p=r(i);fetch(i.href,p)}})();function he(){}function De(e){return e()}function He(){return Object.create(null)}function ne(e){e.forEach(De)}function Me(e){return typeof e=="function"}function je(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Ke(e){return Object.keys(e).length===0}function n(e,t){e.appendChild(t)}function H(e,t,r){e.insertBefore(t,r||null)}function O(e){e.parentNode&&e.parentNode.removeChild(e)}function s(e){return document.createElement(e)}function z(e){return document.createTextNode(e)}function d(){return z(" ")}function Fe(){return z("")}function P(e,t,r,l){return e.addEventListener(t,r,l),()=>e.removeEventListener(t,r,l)}function o(e,t,r){r==null?e.removeAttribute(t):e.getAttribute(t)!==r&&e.setAttribute(t,r)}function me(e){let t;return{p(...r){t=r,t.forEach(l=>e.push(l))},r(){t.forEach(r=>e.splice(e.indexOf(r),1))}}}function We(e){return e===""?null:+e}function $e(e){return Array.from(e.childNodes)}function be(e,t){t=""+t,e.data!==t&&(e.data=t)}function X(e,t){e.value=t??""}let Ae;function _e(e){Ae=e}const fe=[],Ne=[];let de=[];const Re=[],Ye=Promise.resolve();let we=!1;function Ze(){we||(we=!0,Ye.then(Je))}function Ce(e){de.push(e)}const ke=new Set;let pe=0;function Je(){if(pe!==0)return;const e=Ae;do{try{for(;pe<fe.length;){const t=fe[pe];pe++,_e(t),Qe(t.$$)}}catch(t){throw fe.length=0,pe=0,t}for(_e(null),fe.length=0,pe=0;Ne.length;)Ne.pop()();for(let t=0;t<de.length;t+=1){const r=de[t];ke.has(r)||(ke.add(r),r())}de.length=0}while(fe.length);for(;Re.length;)Re.pop()();we=!1,ke.clear(),_e(e)}function Qe(e){if(e.fragment!==null){e.update(),ne(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Ce)}}function Ve(e){const t=[],r=[];de.forEach(l=>e.indexOf(l)===-1?t.push(l):r.push(l)),r.forEach(l=>l()),de=t}const Xe=new Set;function xe(e,t){e&&e.i&&(Xe.delete(e),e.i(t))}function et(e,t,r,l){const{fragment:i,after_update:p}=e.$$;i&&i.m(t,r),l||Ce(()=>{const c=e.$$.on_mount.map(De).filter(Me);e.$$.on_destroy?e.$$.on_destroy.push(...c):ne(c),e.$$.on_mount=[]}),p.forEach(Ce)}function tt(e,t){const r=e.$$;r.fragment!==null&&(Ve(r.after_update),ne(r.on_destroy),r.fragment&&r.fragment.d(t),r.on_destroy=r.fragment=null,r.ctx=[])}function nt(e,t){e.$$.dirty[0]===-1&&(fe.push(e),Ze(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function lt(e,t,r,l,i,p,c,a=[-1]){const m=Ae;_e(e);const u=e.$$={fragment:null,ctx:[],props:p,update:he,not_equal:i,bound:He(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(m?m.$$.context:[])),callbacks:He(),dirty:a,skip_bound:!1,root:t.target||m.$$.root};c&&c(u.root);let k=!1;if(u.ctx=r?r(e,t.props||{},(g,_,...E)=>{const f=E.length?E[0]:_;return u.ctx&&i(u.ctx[g],u.ctx[g]=f)&&(!u.skip_bound&&u.bound[g]&&u.bound[g](f),k&&nt(e,g)),_}):[],u.update(),k=!0,ne(u.before_update),u.fragment=l?l(u.ctx):!1,t.target){if(t.hydrate){const g=$e(t.target);u.fragment&&u.fragment.l(g),g.forEach(O)}else u.fragment&&u.fragment.c();t.intro&&xe(e.$$.fragment),et(e,t.target,t.anchor,t.customElement),Je()}_e(m)}class it{$destroy(){tt(this,1),this.$destroy=he}$on(t,r){if(!Me(r))return he;const l=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return l.push(r),()=>{const i=l.indexOf(r);i!==-1&&l.splice(i,1)}}$set(t){this.$$set&&!Ke(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Ie(e){let t,r,l,i,p,c,a,m;return{c(){t=s("h3"),t.textContent="GitHub Enterprise Server Domain",r=d(),l=s("div"),i=s("p"),i.innerHTML=`Where is GitHub Enterprise Server hosted? Type in the domain without <code>https://</code>
|
|
9
|
+
and without any path. It should look something like <code>github.mycompany.com</code>.`,p=d(),c=s("input"),o(c,"class","form-control"),o(l,"class","px-3 py-3")},m(u,k){H(u,t,k),H(u,r,k),H(u,l,k),n(l,i),n(l,p),n(l,c),X(c,e[1]),a||(m=P(c,"input",e[18]),a=!0)},p(u,k){k[0]&2&&c.value!==u[1]&&X(c,u[1])},d(u){u&&O(t),u&&O(r),u&&O(l),a=!1,m()}}}function ze(e){let t,r,l,i,p,c,a,m,u,k,g,_,E,f,S,C,b,v,T,A,y,N;return A=me(e[16][2]),{c(){t=s("h3"),t.textContent="Authentication Type",r=d(),l=s("div"),i=s("p"),i.textContent=`You can choose between creating a new app that will provide authentication for specific
|
|
10
10
|
repositories, or a personal access token that will provide access to all repositories
|
|
11
11
|
available to you. Apps are easier to set up and provide more fine-grained access control. If
|
|
12
|
-
you have previously created an app, you can choose to use an existing app.`,p=
|
|
13
|
-
scope enabled. Don't forget to also create a webhook as described in `),
|
|
14
|
-
permissions. Don't forget to set up the webhook and its secret as described in <a href="https://github.com/CloudSnorkel/cdk-github-runners/blob/main/SETUP_GITHUB.md">SETUP_GITHUB.md</a>.`,p=b(),a=s("div"),c=s("label"),c.textContent="App Id",g=b(),u=s("div"),h=s("input"),v=b(),f=s("div"),S=s("label"),S.textContent="Private Key",k=b(),A=s("div"),E=s("textarea"),r(c,"for","appid"),r(c,"class","col-sm-2 col-form-label"),r(h,"type","number"),r(h,"class","form-control"),r(h,"id","appid"),r(u,"class","col-sm-10"),r(a,"class","form-group row px-3 py-2"),r(S,"for","pk"),r(S,"class","col-sm-2 col-form-label"),r(E,"class","form-control"),r(E,"id","pk"),r(E,"rows","10"),r(A,"class","col-sm-10"),r(f,"class","form-group row px-3 py-2"),r(n,"class","px-3 py-3")},m(w,I){T(w,t,I),T(w,o,I),T(w,n,I),i(n,l),i(n,p),i(n,a),i(a,c),i(a,g),i(a,u),i(u,h),j(h,e[5]),i(n,v),i(n,f),i(f,S),i(f,k),i(f,A),i(A,E),j(E,e[6]),_||(m=[z(h,"input",e[23]),z(E,"input",e[24])],_=!0)},p(w,I){I&32&&Be(h.value)!==w[5]&&j(h,w[5]),I&64&&j(E,w[6])},d(w){w&&C(t),w&&C(o),w&&C(n),_=!1,q(m)}}}function it(e){let t,o,n,l,p,a,c,g,u,h,v,f,S,k,A,E,_,m,w,I,O=e[0]==="ghes"&&Ge(e),H=e[3]==="org"&&Re(e);return m=ye(e[13][0]),{c(){t=s("h3"),t.textContent="New App Settings",o=b(),n=s("div"),l=s("p"),l.textContent=`Choose whether to create a new personal app or organization app. A private personal app can
|
|
12
|
+
you have previously created an app, you can choose to use an existing app.`,p=d(),c=s("div"),a=s("input"),m=d(),u=s("label"),u.innerHTML="New GitHub App <b>(recommended)</b>",k=d(),g=s("div"),_=s("input"),E=d(),f=s("label"),f.textContent="Existing GitHub App",S=d(),C=s("div"),b=s("input"),v=d(),T=s("label"),T.textContent="Personal Access Token",o(a,"class","form-check-input"),o(a,"type","radio"),a.__value="newApp",a.value=a.__value,o(a,"id","newApp"),o(u,"class","form-check-label"),o(u,"for","newApp"),o(c,"class","form-check"),o(_,"class","form-check-input"),o(_,"type","radio"),_.__value="existingApp",_.value=_.__value,o(_,"id","existingApp"),o(f,"class","form-check-label"),o(f,"for","existingApp"),o(g,"class","form-check"),o(b,"class","form-check-input"),o(b,"type","radio"),b.__value="pat",b.value=b.__value,o(b,"id","pat"),o(T,"class","form-check-label"),o(T,"for","pat"),o(C,"class","form-check"),o(l,"class","px-3 py-3"),A.p(a,_,b)},m(h,R){H(h,t,R),H(h,r,R),H(h,l,R),n(l,i),n(l,p),n(l,c),n(c,a),a.checked=a.__value===e[2],n(c,m),n(c,u),n(l,k),n(l,g),n(g,_),_.checked=_.__value===e[2],n(g,E),n(g,f),n(l,S),n(l,C),n(C,b),b.checked=b.__value===e[2],n(C,v),n(C,T),y||(N=[P(a,"change",e[19]),P(_,"change",e[20]),P(b,"change",e[21])],y=!0)},p(h,R){R[0]&4&&(a.checked=a.__value===h[2]),R[0]&4&&(_.checked=_.__value===h[2]),R[0]&4&&(b.checked=b.__value===h[2])},d(h){h&&O(t),h&&O(r),h&&O(l),A.r(),y=!1,ne(N)}}}function ot(e){let t,r,l,i,p,c,a,m,u,k,g,_,E,f,S,C,b;return{c(){t=s("h2"),t.textContent="Personal Access Token",r=d(),l=s("div"),i=s("p"),p=z("The "),c=s("a"),a=z("personal access token"),u=z(" must have the "),k=s("code"),k.textContent="repo",g=z(`
|
|
13
|
+
scope enabled. Don't forget to also create a webhook as described in `),_=s("a"),_.textContent="SETUP_GITHUB.md",E=z("."),f=d(),S=s("input"),o(c,"href",m="https://"+e[1]+"/settings/tokens"),o(_,"href","https://github.com/CloudSnorkel/cdk-github-runners/blob/main/SETUP_GITHUB.md"),o(S,"class","form-control"),o(S,"placeholder","Token e.g. ghp_abcdefghijklmnopqrstuvwxyz1234567890"),o(l,"class","px-3 py-3")},m(v,T){H(v,t,T),H(v,r,T),H(v,l,T),n(l,i),n(i,p),n(i,c),n(c,a),n(i,u),n(i,k),n(i,g),n(i,_),n(i,E),n(l,f),n(l,S),X(S,e[8]),C||(b=P(S,"input",e[30]),C=!0)},p(v,T){T[0]&2&&m!==(m="https://"+v[1]+"/settings/tokens")&&o(c,"href",m),T[0]&256&&S.value!==v[8]&&X(S,v[8])},d(v){v&&O(t),v&&O(r),v&&O(l),C=!1,b()}}}function rt(e){let t,r,l,i,p,c,a,m,u,k,g,_,E,f,S,C,b,v,T,A,y,N,h,R,B,G,le,$,ie,x,oe,re,U,ee,Z=JSON.stringify(e[4]==="repo"?e[12]:e[13],void 0,2)+"",K,te,q,se,ae,Y,Q,ue;return Y=me(e[16][0]),{c(){t=s("h3"),t.textContent="Existing App Details",r=d(),l=s("div"),i=s("div"),p=s("label"),p.textContent="App Id",c=d(),a=s("div"),m=s("input"),u=d(),k=s("div"),g=s("label"),g.textContent="Private Key",_=d(),E=s("div"),f=s("textarea"),S=d(),C=s("div"),b=s("div"),b.textContent="Registration Level",v=d(),T=s("div"),A=s("div"),y=s("input"),N=d(),h=s("label"),h.textContent="Repository",R=d(),B=s("div"),G=s("input"),le=d(),$=s("label"),$.textContent="Organization",ie=d(),x=s("h4"),x.textContent="Required Permissions",oe=d(),re=s("p"),re.textContent="The existing app must have the following permissions.",U=d(),ee=s("pre"),K=z(Z),te=d(),q=s("h4"),q.textContent="Webhook",se=d(),ae=s("p"),ae.innerHTML='Don't forget to set up the webhook and its secret as described in <a href="https://github.com/CloudSnorkel/cdk-github-runners/blob/main/SETUP_GITHUB.md">SETUP_GITHUB.md</a>.',o(p,"for","appid"),o(p,"class","col-sm-2 col-form-label"),o(m,"type","number"),o(m,"class","form-control"),o(m,"id","appid"),o(a,"class","col-sm-10"),o(i,"class","form-group row px-3 py-2"),o(g,"for","pk"),o(g,"class","col-sm-2 col-form-label"),o(f,"class","form-control"),o(f,"id","pk"),o(f,"rows","10"),o(E,"class","col-sm-10"),o(k,"class","form-group row px-3 py-2"),o(b,"class","col-sm-2 col-form-label"),o(y,"class","form-check-input"),o(y,"type","radio"),y.__value="repo",y.value=y.__value,o(y,"id","repo"),o(h,"class","form-check-label"),o(h,"for","repo"),o(A,"class","form-check"),o(G,"class","form-check-input"),o(G,"type","radio"),G.__value="org",G.value=G.__value,o(G,"id","org"),o($,"class","form-check-label"),o($,"for","org"),o(B,"class","form-check"),o(T,"class","col-sm-10"),o(C,"class","form-group row px-3 py-2"),o(l,"class","px-3 py-3"),Y.p(y,G)},m(I,F){H(I,t,F),H(I,r,F),H(I,l,F),n(l,i),n(i,p),n(i,c),n(i,a),n(a,m),X(m,e[6]),n(l,u),n(l,k),n(k,g),n(k,_),n(k,E),n(E,f),X(f,e[7]),n(l,S),n(l,C),n(C,b),n(C,v),n(C,T),n(T,A),n(A,y),y.checked=y.__value===e[4],n(A,N),n(A,h),n(T,R),n(T,B),n(B,G),G.checked=G.__value===e[4],n(B,le),n(B,$),n(l,ie),n(l,x),n(l,oe),n(l,re),n(l,U),n(l,ee),n(ee,K),n(l,te),n(l,q),n(l,se),n(l,ae),Q||(ue=[P(m,"input",e[26]),P(f,"input",e[27]),P(y,"change",e[28]),P(G,"change",e[29])],Q=!0)},p(I,F){F[0]&64&&We(m.value)!==I[6]&&X(m,I[6]),F[0]&128&&X(f,I[7]),F[0]&16&&(y.checked=y.__value===I[4]),F[0]&16&&(G.checked=G.__value===I[4]),F[0]&16&&Z!==(Z=JSON.stringify(I[4]==="repo"?I[12]:I[13],void 0,2)+"")&&be(K,Z)},d(I){I&&O(t),I&&O(r),I&&O(l),Y.r(),Q=!1,ne(ue)}}}function st(e){let t,r,l,i,p,c,a,m,u,k,g,_,E,f,S,C,b,v,T,A,y=e[0]==="ghes"&&Ge(e),N=e[3]==="org"&&Pe(e);return v=me(e[16][1]),{c(){t=s("h3"),t.textContent="New App Settings",r=d(),l=s("div"),i=s("p"),i.textContent=`Choose whether to create a new personal app or organization app. A private personal app can
|
|
15
14
|
only be used for repositories under your user. A private origination app can only be used
|
|
16
|
-
for repositories under that organization.`,p=
|
|
17
|
-
you can make the app public.`,
|
|
18
|
-
`),
|
|
19
|
-
then your organization slug is `),
|
|
15
|
+
for repositories under that organization.`,p=d(),c=s("div"),a=s("input"),m=d(),u=s("label"),u.textContent="User app",k=d(),g=s("div"),_=s("input"),E=d(),f=s("label"),f.textContent="Organization app",S=d(),y&&y.c(),C=d(),N&&N.c(),b=Fe(),o(a,"class","form-check-input"),o(a,"type","radio"),a.__value="user",a.value=a.__value,o(a,"id","userScope"),o(u,"class","form-check-label"),o(u,"for","userScope"),o(c,"class","form-check"),o(_,"class","form-check-input"),o(_,"type","radio"),_.__value="org",_.value=_.__value,o(_,"id","orgScope"),o(f,"class","form-check-label"),o(f,"for","orgScope"),o(g,"class","form-check"),o(l,"class","px-3 py-3"),v.p(a,_)},m(h,R){H(h,t,R),H(h,r,R),H(h,l,R),n(l,i),n(l,p),n(l,c),n(c,a),a.checked=a.__value===e[3],n(c,m),n(c,u),n(l,k),n(l,g),n(g,_),_.checked=_.__value===e[3],n(g,E),n(g,f),n(l,S),y&&y.m(l,null),H(h,C,R),N&&N.m(h,R),H(h,b,R),T||(A=[P(a,"change",e[22]),P(_,"change",e[23])],T=!0)},p(h,R){R[0]&8&&(a.checked=a.__value===h[3]),R[0]&8&&(_.checked=_.__value===h[3]),h[0]==="ghes"?y?y.p(h,R):(y=Ge(h),y.c(),y.m(l,null)):y&&(y.d(1),y=null),h[3]==="org"?N?N.p(h,R):(N=Pe(h),N.c(),N.m(b.parentNode,b)):N&&(N.d(1),N=null)},d(h){h&&O(t),h&&O(r),h&&O(l),y&&y.d(),h&&O(C),N&&N.d(h),h&&O(b),v.r(),T=!1,ne(A)}}}function Ge(e){let t,r,l,i,p,c,a,m;return{c(){t=s("p"),t.textContent=`If multiple organizations under the same GitHub Enterprise Server need to use the runners,
|
|
16
|
+
you can make the app public.`,r=d(),l=s("div"),i=s("input"),p=d(),c=s("label"),c.textContent="Public app",o(t,"class","pt-2"),o(i,"class","form-check-input"),o(i,"type","checkbox"),o(i,"id","public"),o(c,"class","form-check-label"),o(c,"for","public"),o(l,"class","form-check")},m(u,k){H(u,t,k),H(u,r,k),H(u,l,k),n(l,i),i.checked=e[11].public,n(l,p),n(l,c),a||(m=P(i,"change",e[24]),a=!0)},p(u,k){k[0]&2048&&(i.checked=u[11].public)},d(u){u&&O(t),u&&O(r),u&&O(l),a=!1,m()}}}function Pe(e){let t,r,l,i,p,c,a,m,u,k,g,_,E,f,S,C;return{c(){t=s("h3"),t.textContent="Organization name",r=d(),l=s("div"),i=s("p"),p=z(`What is the slug for your organization? If your repositories have a URL like
|
|
17
|
+
`),c=s("code"),a=z("https://"),m=z(e[1]),u=z("/MyOrg/my-repo"),k=z(`
|
|
18
|
+
then your organization slug is `),g=s("code"),g.textContent="MyOrg",_=z("."),E=d(),f=s("input"),o(f,"class","form-control"),o(l,"class","px-3 py-3")},m(b,v){H(b,t,v),H(b,r,v),H(b,l,v),n(l,i),n(i,p),n(i,c),n(c,a),n(c,m),n(c,u),n(i,k),n(i,g),n(i,_),n(l,E),n(l,f),X(f,e[5]),S||(C=P(f,"input",e[25]),S=!0)},p(b,v){v[0]&2&&be(m,b[1]),v[0]&32&&f.value!==b[5]&&X(f,b[5])},d(b){b&&O(t),b&&O(r),b&&O(l),S=!1,C()}}}function Le(e){let t,r,l,i,p,c,a,m,u,k,g,_,E,f,S,C,b,v,T;return b=me(e[16][0]),{c(){t=s("h3"),t.textContent="Registration Level",r=d(),l=s("div"),i=s("p"),i.textContent="Would you like runners to be registered on repository level, or on organization level?",p=d(),c=s("ul"),c.innerHTML=`<li>Registering runners on repository level requires the <code>administration</code>
|
|
19
|
+
<a href="https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/autoscaling-with-self-hosted-runners#authentication-requirements">permission</a>.</li>
|
|
20
|
+
<li>Registering runners on organization level only requires the <code>organization_self_hosted_runners</code>
|
|
21
|
+
<a href="https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/autoscaling-with-self-hosted-runners#authentication-requirements">permission</a>
|
|
22
|
+
which is more fine-grained.</li>
|
|
23
|
+
<li>Registering runners on organization level means any repository can use them, even if the app wasn't
|
|
24
|
+
installed on those repositories.</li>
|
|
25
|
+
<li>Do not use organization level registration if you don't fully trust all repositories in your organization.</li>
|
|
26
|
+
<li>Use organization level to reduce the permission scope this new app is given.</li>
|
|
27
|
+
<li>When in doubt, use the default repository level registration.</li>`,a=d(),m=s("div"),u=s("input"),k=d(),g=s("label"),g.textContent="Repository",_=d(),E=s("div"),f=s("input"),S=d(),C=s("label"),C.textContent="Organization",o(u,"class","form-check-input"),o(u,"type","radio"),u.__value="repo",u.value=u.__value,o(u,"id","repo"),o(g,"class","form-check-label"),o(g,"for","repo"),o(m,"class","form-check"),o(f,"class","form-check-input"),o(f,"type","radio"),f.__value="org",f.value=f.__value,o(f,"id","org"),o(C,"class","form-check-label"),o(C,"for","org"),o(E,"class","form-check"),o(l,"class","px-3 py-3"),b.p(u,f)},m(A,y){H(A,t,y),H(A,r,y),H(A,l,y),n(l,i),n(l,p),n(l,c),n(l,a),n(l,m),n(m,u),u.checked=u.__value===e[4],n(m,k),n(m,g),n(l,_),n(l,E),n(E,f),f.checked=f.__value===e[4],n(E,S),n(E,C),v||(T=[P(u,"change",e[31]),P(f,"change",e[32])],v=!0)},p(A,y){y[0]&16&&(u.checked=u.__value===A[4]),y[0]&16&&(f.checked=f.__value===A[4])},d(A){A&&O(t),A&&O(r),A&&O(l),b.r(),v=!1,ne(T)}}}function ut(e){let t,r,l;return{c(){t=s("div"),r=z(e[10]),o(t,"class",l="alert alert-"+(e[9]?"success":"danger")),o(t,"role","alert")},m(i,p){H(i,t,p),n(t,r)},p(i,p){p[0]&1024&&be(r,i[10]),p[0]&512&&l!==(l="alert alert-"+(i[9]?"success":"danger"))&&o(t,"class",l)},d(i){i&&O(t)}}}function at(e){let t;return{c(){t=s("p"),t.textContent="This button will be enabled once all the questions above are answered."},m(r,l){H(r,t,l)},p:he,d(r){r&&O(t)}}}function Ue(e){let t,r,l,i,p,c;return{c(){t=s("p"),r=s("b"),r.textContent="WARNING:",l=z(" using a public app means anyone with access to "),i=s("code"),p=z(e[1]),c=z(`
|
|
20
28
|
can use the runners you're setting up now. Anyone can create a workflow that will run on those runners,
|
|
21
29
|
have access to their instance profile, and be part of their security group. Consider the security
|
|
22
|
-
implications before continuing.`),r
|
|
30
|
+
implications before continuing.`),o(r,"class","text-danger")},m(a,m){H(a,t,m),n(t,r),n(t,l),n(t,i),n(i,p),n(t,c)},p(a,m){m[0]&2&&be(p,a[1])},d(a){a&&O(t)}}}function ct(e){let t,r,l,i,p,c,a,m,u,k,g,_,E,f,S,C,b,v,T,A,y,N,h,R,B,G,le,$,ie,x,oe,re,U,ee,Z,K,te=Be(e[2])+"",q,se,ae,Y,Q,ue,I,F,ve,Se,D=e[0]==="ghes"&&Ie(e),M=e[0]&&ze(e);function Te(w,L){if(w[2]==="newApp")return st;if(w[2]==="existingApp")return rt;if(w[2]==="pat")return ot}let ce=Te(e),W=ce&&ce(e),J=e[3]==="org"&&e[2]==="newApp"&&Le(e);function Oe(w,L){return w[10]===void 0?at:ut}let ge=Oe(e),V=ge(e),j=e[11].public&&e[2]==="newApp"&&Ue(e);return F=me(e[16][3]),{c(){t=s("main"),r=s("div"),l=s("div"),i=s("form"),p=s("h1"),p.textContent="Setup GitHub Runners",c=d(),a=s("p"),m=z(`Answer all the questions on this page to automatically configure GitHub integration and get the
|
|
23
31
|
runners working. This page will not be accessible once you complete this operation. If you ever want
|
|
24
|
-
to access it again, edit `),u=s("code"),u.textContent=`${
|
|
25
|
-
Enterprise Server?`,
|
|
32
|
+
to access it again, edit `),u=s("code"),u.textContent=`${pt}`,k=z(" and run the status function again."),g=d(),_=s("h3"),_.textContent="Choose GitHub Instance",E=d(),f=s("div"),S=s("p"),S.textContent=`Are your repositories hosted on GitHub.com or are you using an on-premise installation of GitHub
|
|
33
|
+
Enterprise Server?`,C=d(),b=s("div"),v=s("input"),T=d(),A=s("label"),A.textContent="GitHub.com",y=d(),N=s("div"),h=s("input"),R=d(),B=s("label"),B.textContent="GitHub Enterprise Server",G=d(),D&&D.c(),le=d(),M&&M.c(),$=d(),W&&W.c(),ie=d(),J&&J.c(),x=d(),oe=s("h2"),oe.textContent="Finish Setup",re=d(),U=s("div"),V.c(),ee=d(),j&&j.c(),Z=d(),K=s("button"),q=z(te),ae=d(),Y=s("form"),Q=s("input"),o(v,"class","form-check-input"),o(v,"type","radio"),v.__value="github.com",v.value=v.__value,o(v,"id","github.com"),o(A,"class","form-check-label"),o(A,"for","github.com"),o(b,"class","form-check"),o(h,"class","form-check-input"),o(h,"type","radio"),h.__value="ghes",h.value=h.__value,o(h,"id","ghes"),o(B,"class","form-check-label"),o(B,"for","ghes"),o(N,"class","form-check"),o(f,"class","px-3 py-3"),o(K,"type","submit"),o(K,"class","btn btn-success"),K.disabled=se=qe(e[0],e[2],e[6],e[7],e[4],e[8],e[9]),o(U,"class","px-3 py-3"),o(i,"class","col"),o(l,"class","row"),o(r,"class","container py-3 px-2"),o(Q,"type","hidden"),o(Q,"name","manifest"),Q.value=ue=JSON.stringify(e[11]),o(Y,"action",I="https://"+e[1]+"/"+(e[3]==="org"?`organizations/${e[5]}/`:"")+"settings/apps/new?state="+Ee),o(Y,"method","post"),o(Y,"id","appform"),F.p(v,h)},m(w,L){H(w,t,L),n(t,r),n(r,l),n(l,i),n(i,p),n(i,c),n(i,a),n(a,m),n(a,u),n(a,k),n(i,g),n(i,_),n(i,E),n(i,f),n(f,S),n(f,C),n(f,b),n(b,v),v.checked=v.__value===e[0],n(b,T),n(b,A),n(f,y),n(f,N),n(N,h),h.checked=h.__value===e[0],n(N,R),n(N,B),n(i,G),D&&D.m(i,null),n(i,le),M&&M.m(i,null),n(i,$),W&&W.m(i,null),n(i,ie),J&&J.m(i,null),n(i,x),n(i,oe),n(i,re),n(i,U),V.m(U,null),n(U,ee),j&&j.m(U,null),n(U,Z),n(U,K),n(K,q),n(t,ae),n(t,Y),n(Y,Q),ve||(Se=[P(v,"change",e[15]),P(h,"change",e[17]),P(i,"submit",e[14])],ve=!0)},p(w,L){L[0]&1&&(v.checked=v.__value===w[0]),L[0]&1&&(h.checked=h.__value===w[0]),w[0]==="ghes"?D?D.p(w,L):(D=Ie(w),D.c(),D.m(i,le)):D&&(D.d(1),D=null),w[0]?M?M.p(w,L):(M=ze(w),M.c(),M.m(i,$)):M&&(M.d(1),M=null),ce===(ce=Te(w))&&W?W.p(w,L):(W&&W.d(1),W=ce&&ce(w),W&&(W.c(),W.m(i,ie))),w[3]==="org"&&w[2]==="newApp"?J?J.p(w,L):(J=Le(w),J.c(),J.m(i,x)):J&&(J.d(1),J=null),ge===(ge=Oe(w))&&V?V.p(w,L):(V.d(1),V=ge(w),V&&(V.c(),V.m(U,ee))),w[11].public&&w[2]==="newApp"?j?j.p(w,L):(j=Ue(w),j.c(),j.m(U,Z)):j&&(j.d(1),j=null),L[0]&4&&te!==(te=Be(w[2])+"")&&be(q,te),L[0]&981&&se!==(se=qe(w[0],w[2],w[6],w[7],w[4],w[8],w[9]))&&(K.disabled=se),L[0]&2048&&ue!==(ue=JSON.stringify(w[11]))&&(Q.value=ue),L[0]&42&&I!==(I="https://"+w[1]+"/"+(w[3]==="org"?`organizations/${w[5]}/`:"")+"settings/apps/new?state="+Ee)&&o(Y,"action",I)},i:he,o:he,d(w){w&&O(t),D&&D.d(),M&&M.d(),W&&W.d(),J&&J.d(),V.d(),j&&j.d(),F.r(),ve=!1,ne(Se)}}}const pt="INSERT_SECRET_ARN_HERE",Ee="INSERT_TOKEN_HERE";function qe(e,t,r,l,i,p,c){return c||e===void 0||t===void 0?!0:t==="newApp"?!1:t==="existingApp"?r===""||l===""||i===void 0:t==="pat"?p==="":(console.error("Something is broken",e,t,r),!0)}function Be(e){return e==="newApp"?"Create GitHub App":"Setup"}function ye(e,t){return new Promise((r,l)=>{fetch(`${e}?token=${Ee}`,{method:"POST",mode:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),redirect:"error"}).then(i=>{i.ok?i.text().then(r).catch(l):i.text().then(p=>{l(new Error(`${p} [${i.status}]`))}).catch(l)}).catch(l)})}function ft(e,t,r){let l,i="INSERT_DOMAIN_HERE",p,c="user",a="repo",m="ORGANIZATION",u="",k="",g="",_,E;const f={actions:"write",administration:"write",deployments:"read"},S={actions:"write",organization_self_hosted_runners:"write",deployments:"read"},C={url:"https://github.com/CloudSnorkel/cdk-github-runners",hook_attributes:{url:"INSERT_WEBHOOK_URL_HERE"},redirect_url:"INSERT_BASE_URL_HERE/complete-new-app",public:!1,default_permissions:f,default_events:["workflow_job"]};function b(K){K.preventDefault();function te(){const q=l==="ghes"?i:"github.com";switch(r(11,C.default_permissions=a==="repo"?f:S,C),p){case"newApp":return ye("domain",{domain:q,runnerLevel:a}).then(se=>(document.getElementById("appform").submit(),Promise.resolve("Redirecting to GitHub...")));case"existingApp":return ye("app",{appid:u,pk:k,domain:q,runnerLevel:a});case"pat":return ye("pat",{pat:g,domain:q})}}te().then(q=>{r(10,E=q),r(9,_=!0)}).catch(q=>{r(10,E=`${q}`),r(9,_=!1)})}const v=[[],[],[],[]];function T(){l=this.__value,r(0,l)}function A(){l=this.__value,r(0,l)}function y(){i=this.value,r(1,i)}function N(){p=this.__value,r(2,p)}function h(){p=this.__value,r(2,p)}function R(){p=this.__value,r(2,p)}function B(){c=this.__value,r(3,c)}function G(){c=this.__value,r(3,c)}function le(){C.public=this.checked,r(11,C)}function $(){m=this.value,r(5,m)}function ie(){u=We(this.value),r(6,u)}function x(){k=this.value,r(7,k)}function oe(){a=this.__value,r(4,a)}function re(){a=this.__value,r(4,a)}function U(){g=this.value,r(8,g)}function ee(){a=this.__value,r(4,a)}function Z(){a=this.__value,r(4,a)}return[l,i,p,c,a,m,u,k,g,_,E,C,f,S,b,T,v,A,y,N,h,R,B,G,le,$,ie,x,oe,re,U,ee,Z]}class dt extends it{constructor(t){super(),lt(this,t,ft,ct,je,{},null,[-1,-1])}}new dt({target:document.getElementById("app")});
|
|
26
34
|
|
|
27
35
|
</script>
|
|
28
36
|
<style>
|