diff --git a/API.md b/API.md
index 6ed41f6f..fb9b74db 100644
--- a/API.md
+++ b/API.md
@@ -621,6 +621,7 @@ Any object.
| grantPrincipal
| aws-cdk-lib.aws_iam.IPrincipal
| Grant principal used to add permissions to the runner role. |
| image
| RunnerImage
| Docker image loaded with GitHub Actions Runner and its prerequisites. |
| labels
| string[]
| Labels associated with this provider. |
+| logGroup
| aws-cdk-lib.aws_logs.ILogGroup
| Log group where provided runners will save their logs. |
| project
| aws-cdk-lib.aws_codebuild.Project
| CodeBuild project hosting the runner. |
---
@@ -687,6 +688,20 @@ Labels associated with this provider.
---
+##### `logGroup`Required
+
+```typescript
+public readonly logGroup: ILogGroup;
+```
+
+- *Type:* aws-cdk-lib.aws_logs.ILogGroup
+
+Log group where provided runners will save their logs.
+
+Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+
+---
+
##### `project`Required
```typescript
@@ -1106,6 +1121,7 @@ Any object.
| connections
| aws-cdk-lib.aws_ec2.Connections
| The network connections associated with this resource. |
| grantPrincipal
| aws-cdk-lib.aws_iam.IPrincipal
| Grant principal used to add permissions to the runner role. |
| labels
| string[]
| Labels associated with this provider. |
+| logGroup
| aws-cdk-lib.aws_logs.ILogGroup
| Log group where provided runners will save their logs. |
---
@@ -1157,6 +1173,20 @@ Labels associated with this provider.
---
+##### `logGroup`Required
+
+```typescript
+public readonly logGroup: ILogGroup;
+```
+
+- *Type:* aws-cdk-lib.aws_logs.ILogGroup
+
+Log group where provided runners will save their logs.
+
+Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+
+---
+
### FargateRunner
@@ -1310,6 +1340,7 @@ Any object.
| grantPrincipal
| aws-cdk-lib.aws_iam.IPrincipal
| Grant principal used to add permissions to the runner role. |
| image
| RunnerImage
| Docker image loaded with GitHub Actions Runner and its prerequisites. |
| labels
| string[]
| Labels associated with this provider. |
+| logGroup
| aws-cdk-lib.aws_logs.ILogGroup
| Log group where provided runners will save their logs. |
| spot
| boolean
| Use spot pricing for Fargate tasks. |
| task
| aws-cdk-lib.aws_ecs.FargateTaskDefinition
| Fargate task hosting the runner. |
| subnetSelection
| aws-cdk-lib.aws_ec2.SubnetSelection
| Subnets used for hosting the runner task. |
@@ -1415,6 +1446,20 @@ Labels associated with this provider.
---
+##### `logGroup`Required
+
+```typescript
+public readonly logGroup: ILogGroup;
+```
+
+- *Type:* aws-cdk-lib.aws_logs.ILogGroup
+
+Log group where provided runners will save their logs.
+
+Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+
+---
+
##### `spot`Required
```typescript
@@ -1590,6 +1635,10 @@ new GitHubRunners(scope: Construct, id: string, props?: GitHubRunnersProps)
| **Name** | **Description** |
| --- | --- |
| toString
| Returns a string representation of this construct. |
+| metricFailed
| Metric for failed runner executions. |
+| metricJobCompleted
| Metric for the number of GitHub Actions jobs completed. |
+| metricSucceeded
| Metric for successful executions. |
+| metricTime
| Metric for the interval, in milliseconds, between the time the execution starts and the time it closes. |
---
@@ -1601,6 +1650,74 @@ public toString(): string
Returns a string representation of this construct.
+##### `metricFailed`
+
+```typescript
+public metricFailed(props?: MetricProps): Metric
+```
+
+Metric for failed runner executions.
+
+A failed runner usually means the runner failed to start and so a job was never executed. It doesn't necessarily mean the job was executed and failed. For that, see {@link metricJobCompleted}.
+
+###### `props`Optional
+
+- *Type:* aws-cdk-lib.aws_cloudwatch.MetricProps
+
+---
+
+##### `metricJobCompleted`
+
+```typescript
+public metricJobCompleted(props?: MetricProps): Metric
+```
+
+Metric for the number of GitHub Actions jobs completed.
+
+It has `ProviderLabels` and `Status` dimensions. The status can be one of "Succeeded", "SucceededWithIssues", "Failed", "Canceled", "Skipped", or "Abandoned".
+
+**WARNING:** this method creates a metric filter for each provider. Each metric has a status dimension with six possible values. These resources may incur cost.
+
+###### `props`Optional
+
+- *Type:* aws-cdk-lib.aws_cloudwatch.MetricProps
+
+---
+
+##### `metricSucceeded`
+
+```typescript
+public metricSucceeded(props?: MetricProps): Metric
+```
+
+Metric for successful executions.
+
+A successful execution doesn't always mean a runner was started. It can be successful even without any label matches.
+
+A successful runner doesn't mean the job it executed was successful. For that, see {@link metricJobCompleted}.
+
+###### `props`Optional
+
+- *Type:* aws-cdk-lib.aws_cloudwatch.MetricProps
+
+---
+
+##### `metricTime`
+
+```typescript
+public metricTime(props?: MetricProps): Metric
+```
+
+Metric for the interval, in milliseconds, between the time the execution starts and the time it closes.
+
+This time may be longer than the time the runner took.
+
+###### `props`Optional
+
+- *Type:* aws-cdk-lib.aws_cloudwatch.MetricProps
+
+---
+
#### Static Functions
| **Name** | **Description** |
@@ -2083,6 +2200,7 @@ Any object.
| grantPrincipal
| aws-cdk-lib.aws_iam.IPrincipal
| Grant principal used to add permissions to the runner role. |
| image
| RunnerImage
| Docker image loaded with GitHub Actions Runner and its prerequisites. |
| labels
| string[]
| Labels associated with this provider. |
+| logGroup
| aws-cdk-lib.aws_logs.ILogGroup
| Log group where provided runners will save their logs. |
---
@@ -2160,6 +2278,20 @@ Labels associated with this provider.
---
+##### `logGroup`Required
+
+```typescript
+public readonly logGroup: ILogGroup;
+```
+
+- *Type:* aws-cdk-lib.aws_logs.ILogGroup
+
+Log group where provided runners will save their logs.
+
+Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+
+---
+
#### Constants
| **Name** | **Type** | **Description** |
@@ -5788,6 +5920,7 @@ grantable for the status function.
| grantPrincipal
| aws-cdk-lib.aws_iam.IPrincipal
| The principal to grant permissions to. |
| node
| constructs.Node
| The tree node. |
| labels
| string[]
| GitHub Actions labels used for this provider. |
+| logGroup
| aws-cdk-lib.aws_logs.ILogGroup
| Log group where provided runners will save their logs. |
---
@@ -5843,6 +5976,20 @@ job's labels, this provider will be chosen and spawn a new runner.
---
+##### `logGroup`Required
+
+```typescript
+public readonly logGroup: ILogGroup;
+```
+
+- *Type:* aws-cdk-lib.aws_logs.ILogGroup
+
+Log group where provided runners will save their logs.
+
+Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+
+---
+
### IRunnerProviderStatus
- *Implemented By:* IRunnerProviderStatus
diff --git a/src/lambdas/webhook-handler/index.ts b/src/lambdas/webhook-handler/index.ts
index 0b8f0b6c..5d0fcf8a 100644
--- a/src/lambdas/webhook-handler/index.ts
+++ b/src/lambdas/webhook-handler/index.ts
@@ -89,6 +89,14 @@ exports.handler = async function (event: AWSLambda.APIGatewayProxyEventV2): Prom
};
}
+ if (!payload.workflow_job.labels.includes('self-hosted')) {
+ console.log(`Ignoring labels "${payload.workflow_job.labels}", expecting "self-hosted"`);
+ return {
+ statusCode: 200,
+ body: 'OK. No runner started.',
+ };
+ }
+
// it's easier to deal with maps in step functions
let labels: any = {};
payload.workflow_job.labels.forEach((l: string) => labels[l] = true);
diff --git a/src/providers/codebuild.ts b/src/providers/codebuild.ts
index c819832d..4d631814 100644
--- a/src/providers/codebuild.ts
+++ b/src/providers/codebuild.ts
@@ -164,10 +164,16 @@ export class CodeBuildRunner extends BaseProvider implements IRunnerProvider {
*/
readonly image: RunnerImage;
+ /**
+ * Log group where provided runners will save their logs.
+ *
+ * Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+ */
+ readonly logGroup: logs.ILogGroup;
+
private readonly vpc?: ec2.IVpc;
private readonly securityGroups?: ec2.ISecurityGroup[];
private readonly dind: boolean;
- private readonly logGroup: logs.LogGroup;
constructor(scope: Construct, id: string, props?: CodeBuildRunnerProps) {
super(scope, id, props);
@@ -212,6 +218,8 @@ export class CodeBuildRunner extends BaseProvider implements IRunnerProvider {
build: {
commands: [
'sudo --preserve-env=AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,AWS_DEFAULT_REGION,AWS_REGION -Hu runner /home/runner/run.sh',
+ 'STATUS=$(grep -Phors "finish job request for job [0-9a-f\\-]+ with result: \\K.*" /home/runner/_diag/ | tail -n1)',
+ '[ -n "$STATUS" ] && echo CDKGHA JOB DONE "$RUNNER_LABEL" "$STATUS"',
],
},
},
@@ -231,6 +239,8 @@ export class CodeBuildRunner extends BaseProvider implements IRunnerProvider {
buildSpec.phases.build.commands = [
'cd \\actions',
'./run.cmd',
+ '$STATUS = Select-String -Path \'./_diag/*.log\' -Pattern \'finish job request for job [0-9a-f\\-]+ with result: (.*)\' | %{$_.Matches.Groups[1].Value} | Select-Object -Last 1',
+ 'if ($STATUS) { echo "CDKGHA JOB DONE $\{Env:RUNNER_LABEL\} $STATUS" }',
];
}
diff --git a/src/providers/common.ts b/src/providers/common.ts
index 014f6679..daa53b13 100644
--- a/src/providers/common.ts
+++ b/src/providers/common.ts
@@ -427,6 +427,13 @@ export interface IRunnerProvider extends ec2.IConnectable, iam.IGrantable, ICons
*/
readonly labels: string[];
+ /**
+ * Log group where provided runners will save their logs.
+ *
+ * Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+ */
+ readonly logGroup: logs.ILogGroup;
+
/**
* Generate step function tasks that execute the runner.
*
diff --git a/src/providers/docker-images/lambda/linux-arm64/runner.sh b/src/providers/docker-images/lambda/linux-arm64/runner.sh
index ab90d3d3..8b26c5f6 100644
--- a/src/providers/docker-images/lambda/linux-arm64/runner.sh
+++ b/src/providers/docker-images/lambda/linux-arm64/runner.sh
@@ -12,3 +12,6 @@ if [ "${RUNNER_VERSION}" = "latest" ]; then RUNNER_FLAGS=""; else RUNNER_FLAGS="
echo Config done
./run.sh
echo Run done
+
+STATUS=$(grep -Phors "finish job request for job [0-9a-f\-]+ with result: \K.*" _diag/ | tail -n1)
+[ -n "$STATUS" ] && echo CDKGHA JOB DONE "$RUNNER_LABEL" "$STATUS"
diff --git a/src/providers/docker-images/lambda/linux-x64/runner.sh b/src/providers/docker-images/lambda/linux-x64/runner.sh
index ab90d3d3..8b26c5f6 100644
--- a/src/providers/docker-images/lambda/linux-x64/runner.sh
+++ b/src/providers/docker-images/lambda/linux-x64/runner.sh
@@ -12,3 +12,6 @@ if [ "${RUNNER_VERSION}" = "latest" ]; then RUNNER_FLAGS=""; else RUNNER_FLAGS="
echo Config done
./run.sh
echo Run done
+
+STATUS=$(grep -Phors "finish job request for job [0-9a-f\-]+ with result: \K.*" _diag/ | tail -n1)
+[ -n "$STATUS" ] && echo CDKGHA JOB DONE "$RUNNER_LABEL" "$STATUS"
diff --git a/src/providers/ec2.ts b/src/providers/ec2.ts
index 58028dfb..c0504734 100644
--- a/src/providers/ec2.ts
+++ b/src/providers/ec2.ts
@@ -60,6 +60,8 @@ EOF
action () {
sudo -Hu runner /home/runner/config.sh --unattended --url "https://{}/{}/{}" --token "{}" --ephemeral --work _work --labels "{}" {} --name "{}" || exit 1
sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2
+ STATUS=$(grep -Phors "finish job request for job [0-9a-f\\\\-]+ with result: \\\\K.*" /home/runner/_diag/ | tail -n1)
+ [ -n "$STATUS" ] && echo CDKGHA JOB DONE "{}" "$STATUS"
}
heartbeat &
if setup_logs && action | tee /var/log/runner.log 2>&1; then
@@ -67,6 +69,7 @@ if setup_logs && action | tee /var/log/runner.log 2>&1; then
else
aws stepfunctions send-task-failure --task-token "$TASK_TOKEN"
fi
+sleep 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs
poweroff
`.replace(/{/g, '\\{').replace(/}/g, '\\}').replace(/\\{\\}/g, '{}');
@@ -106,6 +109,8 @@ function action () {
if ($LASTEXITCODE -ne 0) { return 1 }
./run.cmd 2>&1 | Out-File -Encoding ASCII -Append /actions/runner.log
if ($LASTEXITCODE -ne 0) { return 2 }
+ $STATUS = Select-String -Path './_diag/*.log' -Pattern 'finish job request for job [0-9a-f\\\\-]+ with result: (.*)' | %{$_.Matches.Groups[1].Value} | Select-Object -Last 1
+ if ($STATUS) { echo "CDKGHA JOB DONE {} $STATUS" | Out-File -Encoding ASCII -Append /actions/runner.log }
return 0
}
setup_logs
@@ -115,6 +120,7 @@ if ($r -eq 0) {
} else {
aws stepfunctions send-task-failure --task-token "$TASK_TOKEN"
}
+Start-Sleep -Seconds 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs
Stop-Computer -ComputerName localhost -Force
`.replace(/{/g, '\\{').replace(/}/g, '\\}').replace(/\\{\\}/g, '{}');
@@ -226,8 +232,14 @@ export class Ec2Runner extends BaseProvider implements IRunnerProvider {
*/
readonly grantPrincipal: iam.IPrincipal;
+ /**
+ * Log group where provided runners will save their logs.
+ *
+ * Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+ */
+ readonly logGroup: logs.ILogGroup;
+
private readonly ami: RunnerAmi;
- private readonly logGroup: logs.LogGroup;
private readonly role: iam.Role;
private readonly instanceType: ec2.InstanceType;
private readonly storageSize: cdk.Size;
@@ -303,6 +315,7 @@ export class Ec2Runner extends BaseProvider implements IRunnerProvider {
this.labels.join(','),
this.ami.runnerVersion.is(RunnerVersion.latest()) ? '' : '--disableupdate',
parameters.runnerNamePath,
+ this.labels.join(','),
];
const passUserData = new stepfunctions.Pass(this, `${this.labels.join(', ')} data`, {
diff --git a/src/providers/fargate.ts b/src/providers/fargate.ts
index dd7ae910..91320ad2 100644
--- a/src/providers/fargate.ts
+++ b/src/providers/fargate.ts
@@ -276,8 +276,14 @@ export class FargateRunner extends BaseProvider implements IRunnerProvider {
*/
readonly image: RunnerImage;
+ /**
+ * Log group where provided runners will save their logs.
+ *
+ * Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+ */
+ readonly logGroup: logs.ILogGroup;
+
private readonly securityGroups: ec2.ISecurityGroup[];
- private readonly logGroup: logs.LogGroup;
constructor(scope: Construct, id: string, props?: FargateRunnerProps) {
super(scope, id, props);
@@ -448,12 +454,18 @@ export class FargateRunner extends BaseProvider implements IRunnerProvider {
if (this.image.os.is(Os.LINUX)) {
return [
'sh', '-c',
- `./config.sh --unattended --url "https://$GITHUB_DOMAIN/$OWNER/$REPO" --token "$RUNNER_TOKEN" --ephemeral --work _work --labels "$RUNNER_LABEL" ${runnerFlags} --name "$RUNNER_NAME" && ./run.sh`,
+ `./config.sh --unattended --url "https://$GITHUB_DOMAIN/$OWNER/$REPO" --token "$RUNNER_TOKEN" --ephemeral --work _work --labels "$RUNNER_LABEL" ${runnerFlags} --name "$RUNNER_NAME" &&
+ ./run.sh &&
+ STATUS=$(grep -Phors "finish job request for job [0-9a-f\\-]+ with result: \\K.*" _diag/ | tail -n1) &&
+ [ -n "$STATUS" ] && echo CDKGHA JOB DONE "$RUNNER_LABEL" "$STATUS"`,
];
} else if (this.image.os.is(Os.WINDOWS)) {
return [
'powershell', '-Command',
- `cd \\actions ; ./config.cmd --unattended --url "https://\${Env:GITHUB_DOMAIN}/\${Env:OWNER}/\${Env:REPO}" --token "\${Env:RUNNER_TOKEN}" --ephemeral --work _work --labels "\${Env:RUNNER_LABEL}" ${runnerFlags} --name "\${Env:RUNNER_NAME}" ; ./run.cmd`,
+ `cd \\actions ; ./config.cmd --unattended --url "https://\${Env:GITHUB_DOMAIN}/\${Env:OWNER}/\${Env:REPO}" --token "\${Env:RUNNER_TOKEN}" --ephemeral --work _work --labels "\${Env:RUNNER_LABEL}" ${runnerFlags} --name "\${Env:RUNNER_NAME}" ;
+ ./run.cmd ;
+ $STATUS = Select-String -Path './_diag/*.log' -Pattern 'finish job request for job [0-9a-f\\-]+ with result: (.*)' | %{$_.Matches.Groups[1].Value} | Select-Object -Last 1 ;
+ if ($STATUS) { echo "CDKGHA JOB DONE $\{Env:RUNNER_LABEL\} $STATUS" }`,
];
} else {
throw new Error(`Fargate runner doesn't support ${this.image.os.name}`);
diff --git a/src/providers/lambda.ts b/src/providers/lambda.ts
index 5192d35a..5feb4e6a 100644
--- a/src/providers/lambda.ts
+++ b/src/providers/lambda.ts
@@ -6,6 +6,7 @@ import {
aws_events_targets as events_targets,
aws_iam as iam,
aws_lambda as lambda,
+ aws_logs as logs,
aws_stepfunctions as stepfunctions,
aws_stepfunctions_tasks as stepfunctions_tasks,
custom_resources as cr,
@@ -159,6 +160,13 @@ export class LambdaRunner extends BaseProvider implements IRunnerProvider {
*/
readonly image: RunnerImage;
+ /**
+ * Log group where provided runners will save their logs.
+ *
+ * Note that this is not the job log, but the runner itself. It will not contain output from the GitHub Action but only metadata on its execution.
+ */
+ readonly logGroup: logs.ILogGroup;
+
private readonly vpc?: ec2.IVpc;
private readonly securityGroups?: ec2.ISecurityGroup[];
@@ -224,6 +232,7 @@ export class LambdaRunner extends BaseProvider implements IRunnerProvider {
);
this.grantPrincipal = this.function.grantPrincipal;
+ this.logGroup = this.function.logGroup;
this.addImageUpdater(image);
}
diff --git a/src/runner.ts b/src/runner.ts
index 55de37d5..420e4e37 100644
--- a/src/runner.ts
+++ b/src/runner.ts
@@ -1,6 +1,7 @@
import * as cdk from 'aws-cdk-lib';
import {
Annotations,
+ aws_cloudwatch as cloudwatch,
aws_ec2 as ec2,
aws_iam as iam,
aws_lambda as lambda,
@@ -184,6 +185,7 @@ export class GitHubRunners extends Construct {
private readonly extraLambdaEnv: {[p: string]: string} = {};
private readonly extraLambdaProps: lambda.FunctionOptions;
private stateMachineLogGroup?: logs.LogGroup;
+ private jobsCompletedMetricFilters?: logs.MetricFilter[];
constructor(scope: Construct, id: string, readonly props?: GitHubRunnersProps) {
super(scope, id);
@@ -320,10 +322,6 @@ export class GitHubRunners extends Construct {
),
);
- const check = new stepfunctions.Choice(this, 'Is self hosted?')
- .when(stepfunctions.Condition.isNotPresent('$.labels.self-hosted'), new stepfunctions.Succeed(this, 'No'))
- .otherwise(work);
-
let logOptions: cdk.aws_stepfunctions.LogOptions | undefined;
if (this.props?.logOptions) {
this.stateMachineLogGroup = new logs.LogGroup(this, 'Logs', {
@@ -343,7 +341,7 @@ export class GitHubRunners extends Construct {
this,
'Runner Orchestrator',
{
- definition: check,
+ definition: work,
logs: logOptions,
},
);
@@ -498,4 +496,75 @@ export class GitHubRunners extends Construct {
}
}
}
+
+ /**
+ * Metric for the number of GitHub Actions jobs completed. It has `ProviderLabels` and `Status` dimensions. The status can be one of "Succeeded", "SucceededWithIssues", "Failed", "Canceled", "Skipped", or "Abandoned".
+ *
+ * **WARNING:** this method creates a metric filter for each provider. Each metric has a status dimension with six possible values. These resources may incur cost.
+ */
+ public metricJobCompleted(props?: cloudwatch.MetricProps): cloudwatch.Metric {
+ if (!this.jobsCompletedMetricFilters) {
+ // we can't use logs.FilterPattern.spaceDelimited() because it has no support for ||
+ // status list taken from https://github.com/actions/runner/blob/be9632302ceef50bfb36ea998cea9c94c75e5d4d/src/Sdk/DTWebApi/WebApi/TaskResult.cs
+ // we need "..." for Lambda that prefixes some extra data to log lines
+ const pattern = logs.FilterPattern.literal('[..., marker = "CDKGHA", job = "JOB", done = "DONE", labels, status = "Succeeded" || status = "SucceededWithIssues" || status = "Failed" || status = "Canceled" || status = "Skipped" || status = "Abandoned"]');
+
+ this.jobsCompletedMetricFilters = this.providers.map(p =>
+ p.logGroup.addMetricFilter(`${p.logGroup.node.id} filter`, {
+ metricNamespace: 'GitHubRunners',
+ metricName: 'JobCompleted',
+ filterPattern: pattern,
+ metricValue: '1',
+ // can't with dimensions -- defaultValue: 0,
+ dimensions: {
+ ProviderLabels: '$labels',
+ Status: '$status',
+ },
+ }),
+ );
+
+ for (const metricFilter of this.jobsCompletedMetricFilters) {
+ if (metricFilter.node.defaultChild instanceof logs.CfnMetricFilter) {
+ metricFilter.node.defaultChild.addPropertyOverride('MetricTransformations.0.Unit', 'Count');
+ } else {
+ Annotations.of(metricFilter).addWarning('Unable to set metric filter Unit to Count');
+ }
+ }
+ }
+
+ return new cloudwatch.Metric({
+ namespace: 'GitHubRunners',
+ metricName: 'JobsCompleted',
+ unit: cloudwatch.Unit.COUNT,
+ statistic: cloudwatch.Statistic.SUM,
+ ...props,
+ }).attachTo(this);
+ }
+
+ /**
+ * Metric for successful executions.
+ *
+ * A successful execution doesn't always mean a runner was started. It can be successful even without any label matches.
+ *
+ * A successful runner doesn't mean the job it executed was successful. For that, see {@link metricJobCompleted}.
+ */
+ public metricSucceeded(props?: cloudwatch.MetricProps): cloudwatch.Metric {
+ return this.orchestrator.metricSucceeded(props);
+ }
+
+ /**
+ * Metric for failed runner executions.
+ *
+ * A failed runner usually means the runner failed to start and so a job was never executed. It doesn't necessarily mean the job was executed and failed. For that, see {@link metricJobCompleted}.
+ */
+ public metricFailed(props?: cloudwatch.MetricProps): cloudwatch.Metric {
+ return this.orchestrator.metricFailed(props);
+ }
+
+ /**
+ * Metric for the interval, in milliseconds, between the time the execution starts and the time it closes. This time may be longer than the time the runner took.
+ */
+ public metricTime(props?: cloudwatch.MetricProps): cloudwatch.Metric {
+ return this.orchestrator.metricTime(props);
+ }
}
diff --git a/test/default.integ.snapshot/github-runners-test.assets.json b/test/default.integ.snapshot/github-runners-test.assets.json
index cdaba024..c722ef7c 100644
--- a/test/default.integ.snapshot/github-runners-test.assets.json
+++ b/test/default.integ.snapshot/github-runners-test.assets.json
@@ -27,15 +27,15 @@
}
}
},
- "c6586c763100b9311cadceb2a66b5cd94d96d0f4f402d8c4c26b09b74cb79712": {
+ "35b43c1bd758381cc1156a4423ce9aa1cd1179195d173a9798caddab9ea9c1b9": {
"source": {
- "path": "asset.c6586c763100b9311cadceb2a66b5cd94d96d0f4f402d8c4c26b09b74cb79712",
+ "path": "asset.35b43c1bd758381cc1156a4423ce9aa1cd1179195d173a9798caddab9ea9c1b9",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
- "objectKey": "c6586c763100b9311cadceb2a66b5cd94d96d0f4f402d8c4c26b09b74cb79712.zip",
+ "objectKey": "35b43c1bd758381cc1156a4423ce9aa1cd1179195d173a9798caddab9ea9c1b9.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
@@ -131,15 +131,15 @@
}
}
},
- "8c55ea107f6e2196a0031415c01f5379272fd74e2e444a90fee3c356b9ecf5a2": {
+ "957afa1928595609e8a66240dc846b4e8fc1cf8ad1d4cfb76f4ec81853f2ae97": {
"source": {
- "path": "asset.8c55ea107f6e2196a0031415c01f5379272fd74e2e444a90fee3c356b9ecf5a2",
+ "path": "asset.957afa1928595609e8a66240dc846b4e8fc1cf8ad1d4cfb76f4ec81853f2ae97",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
- "objectKey": "8c55ea107f6e2196a0031415c01f5379272fd74e2e444a90fee3c356b9ecf5a2.zip",
+ "objectKey": "957afa1928595609e8a66240dc846b4e8fc1cf8ad1d4cfb76f4ec81853f2ae97.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
@@ -183,15 +183,15 @@
}
}
},
- "1e767d3591f00b05ef90c4d9c4a8cb3e869564005f7321ce92aaea681925076c": {
+ "3ec70c05afdc8aed95a3a8d3557ff0b9f9a04b101dd6eed663a691db1c758092": {
"source": {
- "path": "asset.1e767d3591f00b05ef90c4d9c4a8cb3e869564005f7321ce92aaea681925076c",
+ "path": "asset.3ec70c05afdc8aed95a3a8d3557ff0b9f9a04b101dd6eed663a691db1c758092",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
- "objectKey": "1e767d3591f00b05ef90c4d9c4a8cb3e869564005f7321ce92aaea681925076c.zip",
+ "objectKey": "3ec70c05afdc8aed95a3a8d3557ff0b9f9a04b101dd6eed663a691db1c758092.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
@@ -222,7 +222,7 @@
}
}
},
- "74161b87dae2f1070e81ba5e4a1e06998638573df169d10d063588ada0934d59": {
+ "e6e149362d295769a9c15b13bdbc9c297e0e0c52f0afd88785a62326dd37b86e": {
"source": {
"path": "github-runners-test.template.json",
"packaging": "file"
@@ -230,7 +230,7 @@
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
- "objectKey": "74161b87dae2f1070e81ba5e4a1e06998638573df169d10d063588ada0934d59.json",
+ "objectKey": "e6e149362d295769a9c15b13bdbc9c297e0e0c52f0afd88785a62326dd37b86e.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
diff --git a/test/default.integ.snapshot/github-runners-test.template.json b/test/default.integ.snapshot/github-runners-test.template.json
index 677f6941..42261260 100644
--- a/test/default.integ.snapshot/github-runners-test.template.json
+++ b/test/default.integ.snapshot/github-runners-test.template.json
@@ -1268,7 +1268,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "/c6586c763100b9311cadceb2a66b5cd94d96d0f4f402d8c4c26b09b74cb79712.zip"
+ "/35b43c1bd758381cc1156a4423ce9aa1cd1179195d173a9798caddab9ea9c1b9.zip"
]
]
}
@@ -1515,7 +1515,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "/c6586c763100b9311cadceb2a66b5cd94d96d0f4f402d8c4c26b09b74cb79712.zip"
+ "/35b43c1bd758381cc1156a4423ce9aa1cd1179195d173a9798caddab9ea9c1b9.zip"
]
]
},
@@ -1634,7 +1634,7 @@
"ProjectName": {
"Ref": "LambdaImageBuilderx64CodeBuild67DE14C8"
},
- "BuildHash": "616a9a0d9fd5bd03cbfa717386a62d88"
+ "BuildHash": "9929eb58cf629b06c71feb97d526c68a"
},
"DependsOn": [
"buildimagedcc036c8876b451ea2c1552f9e06e9e1LogRetention13129CEB",
@@ -3954,6 +3954,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "CodeBuildx64LogsLogsfilter915A4B6F": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "CodeBuildx64LogsA21ECD59"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"CodeBuildx64CodeBuildRole32E5C764": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -4172,7 +4199,7 @@
]
},
"Source": {
- "BuildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &\",\n \"timeout 15 sh -c \\\"until docker info; do echo .; sleep 1; done\\\"\",\n \"if [ \\\"${RUNNER_VERSION}\\\" = \\\"latest\\\" ]; then RUNNER_FLAGS=\\\"\\\"; else RUNNER_FLAGS=\\\"--disableupdate\\\"; fi\",\n \"sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://${GITHUB_DOMAIN}/${OWNER}/${REPO}\\\" --token \\\"${RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${RUNNER_LABEL}\\\" ${RUNNER_FLAGS} --name \\\"${RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"sudo --preserve-env=AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,AWS_DEFAULT_REGION,AWS_REGION -Hu runner /home/runner/run.sh\"\n ]\n }\n }\n}",
+ "BuildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &\",\n \"timeout 15 sh -c \\\"until docker info; do echo .; sleep 1; done\\\"\",\n \"if [ \\\"${RUNNER_VERSION}\\\" = \\\"latest\\\" ]; then RUNNER_FLAGS=\\\"\\\"; else RUNNER_FLAGS=\\\"--disableupdate\\\"; fi\",\n \"sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://${GITHUB_DOMAIN}/${OWNER}/${REPO}\\\" --token \\\"${RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${RUNNER_LABEL}\\\" ${RUNNER_FLAGS} --name \\\"${RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"sudo --preserve-env=AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,AWS_DEFAULT_REGION,AWS_REGION -Hu runner /home/runner/run.sh\",\n \"STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\-]+ with result: \\\\K.*\\\" /home/runner/_diag/ | tail -n1)\",\n \"[ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"$RUNNER_LABEL\\\" \\\"$STATUS\\\"\"\n ]\n }\n }\n}",
"Type": "NO_SOURCE"
},
"Cache": {
@@ -4778,6 +4805,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "CodeBuildARMLogsLogsfilter32B5122B": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "CodeBuildARMLogs7C7FC5A7"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"CodeBuildARMCodeBuildRole74DB4985": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -4996,7 +5050,7 @@
]
},
"Source": {
- "BuildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &\",\n \"timeout 15 sh -c \\\"until docker info; do echo .; sleep 1; done\\\"\",\n \"if [ \\\"${RUNNER_VERSION}\\\" = \\\"latest\\\" ]; then RUNNER_FLAGS=\\\"\\\"; else RUNNER_FLAGS=\\\"--disableupdate\\\"; fi\",\n \"sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://${GITHUB_DOMAIN}/${OWNER}/${REPO}\\\" --token \\\"${RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${RUNNER_LABEL}\\\" ${RUNNER_FLAGS} --name \\\"${RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"sudo --preserve-env=AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,AWS_DEFAULT_REGION,AWS_REGION -Hu runner /home/runner/run.sh\"\n ]\n }\n }\n}",
+ "BuildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &\",\n \"timeout 15 sh -c \\\"until docker info; do echo .; sleep 1; done\\\"\",\n \"if [ \\\"${RUNNER_VERSION}\\\" = \\\"latest\\\" ]; then RUNNER_FLAGS=\\\"\\\"; else RUNNER_FLAGS=\\\"--disableupdate\\\"; fi\",\n \"sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://${GITHUB_DOMAIN}/${OWNER}/${REPO}\\\" --token \\\"${RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${RUNNER_LABEL}\\\" ${RUNNER_FLAGS} --name \\\"${RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"sudo --preserve-env=AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,AWS_DEFAULT_REGION,AWS_REGION -Hu runner /home/runner/run.sh\",\n \"STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\-]+ with result: \\\\K.*\\\" /home/runner/_diag/ | tail -n1)\",\n \"[ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"$RUNNER_LABEL\\\" \\\"$STATUS\\\"\"\n ]\n }\n }\n}",
"Type": "NO_SOURCE"
},
"Cache": {
@@ -5023,6 +5077,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "CodeBuildWindowsLogsLogsfilterC0A33A89": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "CodeBuildWindowsLogsF4DD93A5"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"CodeBuildWindowsCodeBuildRoleDC93697E": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -5284,7 +5365,7 @@
]
},
"Source": {
- "BuildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"cd \\\\actions\",\n \"if (${Env:RUNNER_VERSION} -eq \\\"latest\\\") { $RunnerFlags = \\\"\\\" } else { $RunnerFlags = \\\"--disableupdate\\\" }\",\n \"./config.cmd --unattended --url \\\"https://${Env:GITHUB_DOMAIN}/${Env:OWNER}/${Env:REPO}\\\" --token \\\"${Env:RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${Env:RUNNER_LABEL}\\\" ${RunnerFlags} --name \\\"${Env:RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cd \\\\actions\",\n \"./run.cmd\"\n ]\n }\n }\n}",
+ "BuildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"cd \\\\actions\",\n \"if (${Env:RUNNER_VERSION} -eq \\\"latest\\\") { $RunnerFlags = \\\"\\\" } else { $RunnerFlags = \\\"--disableupdate\\\" }\",\n \"./config.cmd --unattended --url \\\"https://${Env:GITHUB_DOMAIN}/${Env:OWNER}/${Env:REPO}\\\" --token \\\"${Env:RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${Env:RUNNER_LABEL}\\\" ${RunnerFlags} --name \\\"${Env:RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cd \\\\actions\",\n \"./run.cmd\",\n \"$STATUS = Select-String -Path './_diag/*.log' -Pattern 'finish job request for job [0-9a-f\\\\-]+ with result: (.*)' | %{$_.Matches.Groups[1].Value} | Select-Object -Last 1\",\n \"if ($STATUS) { echo \\\"CDKGHA JOB DONE ${Env:RUNNER_LABEL} $STATUS\\\" }\"\n ]\n }\n }\n}",
"Type": "NO_SOURCE"
},
"Cache": {
@@ -5523,6 +5604,36 @@
"RetentionInDays": 30
}
},
+ "LambdaFunctionLogGroupLogGroupfilter60E487A5": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Fn::GetAtt": [
+ "LambdaFunctionLogRetentionB6D78D6D",
+ "LogGroupName"
+ ]
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -5799,7 +5910,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "/8c55ea107f6e2196a0031415c01f5379272fd74e2e444a90fee3c356b9ecf5a2.zip"
+ "/957afa1928595609e8a66240dc846b4e8fc1cf8ad1d4cfb76f4ec81853f2ae97.zip"
]
]
}
@@ -6046,7 +6157,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "/8c55ea107f6e2196a0031415c01f5379272fd74e2e444a90fee3c356b9ecf5a2.zip"
+ "/957afa1928595609e8a66240dc846b4e8fc1cf8ad1d4cfb76f4ec81853f2ae97.zip"
]
]
},
@@ -6165,7 +6276,7 @@
"ProjectName": {
"Ref": "LambdaImageBuilderzCodeBuild73AB6718"
},
- "BuildHash": "d6bdc06d728db2eea9d3dfc09adc2865"
+ "BuildHash": "f6743527e85fbde9ee36a21da05c4251"
},
"DependsOn": [
"buildimagedcc036c8876b451ea2c1552f9e06e9e1LogRetention13129CEB",
@@ -6551,6 +6662,36 @@
"RetentionInDays": 30
}
},
+ "LambdaARMFunctionLogGroupLogGroupfilterD29D06B1": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Fn::GetAtt": [
+ "LambdaARMFunctionLogRetention67E9FEF8",
+ "LogGroupName"
+ ]
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"FargatesecuritygroupAFCAFD34": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
@@ -6575,6 +6716,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "Fargatelogslogsfilter89D6A772": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "FargatelogsCB753638"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"FargatetaskTaskRoleEFFCDAF8": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -6600,7 +6768,7 @@
"Command": [
"sh",
"-c",
- "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && ./run.sh"
+ "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && \n ./run.sh &&\n STATUS=$(grep -Phors \"finish job request for job [0-9a-f\\-]+ with result: \\K.*\" _diag/ | tail -n1) &&\n [ -n \"$STATUS\" ] && echo CDKGHA JOB DONE \"$RUNNER_LABEL\" \"$STATUS\""
],
"Essential": true,
"Image": {
@@ -6778,6 +6946,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "Fargatex64spotlogslogsfilter6590358B": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "Fargatex64spotlogs0BCF618B"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"Fargatex64spottaskTaskRole02893C25": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -6803,7 +6998,7 @@
"Command": [
"sh",
"-c",
- "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && ./run.sh"
+ "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && \n ./run.sh &&\n STATUS=$(grep -Phors \"finish job request for job [0-9a-f\\-]+ with result: \\K.*\" _diag/ | tail -n1) &&\n [ -n \"$STATUS\" ] && echo CDKGHA JOB DONE \"$RUNNER_LABEL\" \"$STATUS\""
],
"Essential": true,
"Image": {
@@ -6981,6 +7176,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "Fargatearm64logslogsfilter4A2869DC": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "Fargatearm64logs00171A52"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"Fargatearm64taskTaskRoleD3C2CD58": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -7006,7 +7228,7 @@
"Command": [
"sh",
"-c",
- "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && ./run.sh"
+ "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && \n ./run.sh &&\n STATUS=$(grep -Phors \"finish job request for job [0-9a-f\\-]+ with result: \\K.*\" _diag/ | tail -n1) &&\n [ -n \"$STATUS\" ] && echo CDKGHA JOB DONE \"$RUNNER_LABEL\" \"$STATUS\""
],
"Essential": true,
"Image": {
@@ -7184,6 +7406,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "Fargatearm64spotlogslogsfilter7E2CFF7B": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "Fargatearm64spotlogsEFCCEC59"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"Fargatearm64spottaskTaskRole0F078C81": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -7209,7 +7458,7 @@
"Command": [
"sh",
"-c",
- "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && ./run.sh"
+ "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && \n ./run.sh &&\n STATUS=$(grep -Phors \"finish job request for job [0-9a-f\\-]+ with result: \\K.*\" _diag/ | tail -n1) &&\n [ -n \"$STATUS\" ] && echo CDKGHA JOB DONE \"$RUNNER_LABEL\" \"$STATUS\""
],
"Essential": true,
"Image": {
@@ -7387,6 +7636,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "FargateWindowslogslogsfilterB5B72E7C": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "FargateWindowslogs52881DBF"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"FargateWindowstaskTaskRole364508C8": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -7412,7 +7688,7 @@
"Command": [
"powershell",
"-Command",
- "cd \\actions ; ./config.cmd --unattended --url \"https://${Env:GITHUB_DOMAIN}/${Env:OWNER}/${Env:REPO}\" --token \"${Env:RUNNER_TOKEN}\" --ephemeral --work _work --labels \"${Env:RUNNER_LABEL}\" --disableupdate --name \"${Env:RUNNER_NAME}\" ; ./run.cmd"
+ "cd \\actions ; ./config.cmd --unattended --url \"https://${Env:GITHUB_DOMAIN}/${Env:OWNER}/${Env:REPO}\" --token \"${Env:RUNNER_TOKEN}\" --ephemeral --work _work --labels \"${Env:RUNNER_LABEL}\" --disableupdate --name \"${Env:RUNNER_NAME}\" ; \n ./run.cmd ; \n $STATUS = Select-String -Path './_diag/*.log' -Pattern 'finish job request for job [0-9a-f\\-]+ with result: (.*)' | %{$_.Matches.Groups[1].Value} | Select-Object -Last 1 ; \n if ($STATUS) { echo \"CDKGHA JOB DONE ${Env:RUNNER_LABEL} $STATUS\" }"
],
"Essential": true,
"Image": {
@@ -7709,6 +7985,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "EC2LinuxLogsLogsfilter186C2AB7": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "EC2LinuxLogsC4CD8F14"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"EC2LinuxInstanceProfile2D2BB473": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
@@ -7931,6 +8234,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "EC2SpotLinuxLogsLogsfilter89CE719F": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "EC2SpotLinuxLogsF78D5F0E"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"EC2SpotLinuxInstanceProfileB12320D4": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
@@ -8893,6 +9223,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "EC2Linuxarm64LogsLogsfilter0A247938": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "EC2Linuxarm64Logs577E371E"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"EC2Linuxarm64InstanceProfile1E6F8D53": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
@@ -9792,6 +10149,33 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
+ "EC2WindowsLogsLogsfilter253E4D4D": {
+ "Type": "AWS::Logs::MetricFilter",
+ "Properties": {
+ "FilterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "LogGroupName": {
+ "Ref": "EC2WindowsLogsDC1F2ABF"
+ },
+ "MetricTransformations": [
+ {
+ "Dimensions": [
+ {
+ "Key": "ProviderLabels",
+ "Value": "$labels"
+ },
+ {
+ "Key": "Status",
+ "Value": "$status"
+ }
+ ],
+ "MetricName": "JobCompleted",
+ "MetricNamespace": "GitHubRunners",
+ "MetricValue": "1",
+ "Unit": "Count"
+ }
+ ]
+ }
+ },
"EC2WindowsInstanceProfileDCA59D9C": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
@@ -11132,7 +11516,7 @@
"Fn::Join": [
"",
[
- "{\"StartAt\":\"Is self hosted?\",\"States\":{\"Is self hosted?\":{\"Type\":\"Choice\",\"Choices\":[{\"Variable\":\"$.labels.self-hosted\",\"IsPresent\":false,\"Next\":\"No\"}],\"Default\":\"Get Runner Token\"},\"Get Runner Token\":{\"Next\":\"Error Catcher\",\"Retry\":[{\"ErrorEquals\":[\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"ResultPath\":\"$.runner\",\"Resource\":\"",
+ "{\"StartAt\":\"Get Runner Token\",\"States\":{\"Get Runner Token\":{\"Next\":\"Error Catcher\",\"Retry\":[{\"ErrorEquals\":[\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"ResultPath\":\"$.runner\",\"Resource\":\"",
{
"Fn::GetAtt": [
"runnerstokenretrieverD5E8392A",
@@ -11315,7 +11699,7 @@
"GroupId"
]
},
- "\"]}},\"Overrides\":{\"ContainerOverrides\":[{\"Name\":\"runner\",\"Environment\":[{\"Name\":\"RUNNER_TOKEN\",\"Value.$\":\"$.runner.token\"},{\"Name\":\"RUNNER_NAME\",\"Value.$\":\"$$.Execution.Name\"},{\"Name\":\"RUNNER_LABEL\",\"Value\":\"fargate,windows,x64\"},{\"Name\":\"GITHUB_DOMAIN\",\"Value.$\":\"$.runner.domain\"},{\"Name\":\"OWNER\",\"Value.$\":\"$.owner\"},{\"Name\":\"REPO\",\"Value.$\":\"$.repo\"}]}]},\"EnableExecuteCommand\":false,\"CapacityProviderStrategy\":[{\"CapacityProvider\":\"FARGATE\"}]}},\"ec2, linux, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\npoweroff\\n\"},\"Next\":\"ec2, linux, x64 subnet iterator\"},\"ec2, linux, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, linux, x64 subnet1\",\"States\":{\"ec2, linux, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, linux, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
+ "\"]}},\"Overrides\":{\"ContainerOverrides\":[{\"Name\":\"runner\",\"Environment\":[{\"Name\":\"RUNNER_TOKEN\",\"Value.$\":\"$.runner.token\"},{\"Name\":\"RUNNER_NAME\",\"Value.$\":\"$$.Execution.Name\"},{\"Name\":\"RUNNER_LABEL\",\"Value\":\"fargate,windows,x64\"},{\"Name\":\"GITHUB_DOMAIN\",\"Value.$\":\"$.runner.domain\"},{\"Name\":\"OWNER\",\"Value.$\":\"$.owner\"},{\"Name\":\"REPO\",\"Value.$\":\"$.repo\"}]}]},\"EnableExecuteCommand\":false,\"CapacityProviderStrategy\":[{\"CapacityProvider\":\"FARGATE\"}]}},\"ec2, linux, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\\\\\-]+ with result: \\\\\\\\K.*\\\" /home/runner/_diag/ | tail -n1)\\n [ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"{}\\\" \\\"$STATUS\\\"\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\nsleep 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs\\npoweroff\\n\"},\"Next\":\"ec2, linux, x64 subnet iterator\"},\"ec2, linux, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, linux, x64 subnet1\",\"States\":{\"ec2, linux, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, linux, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
{
"Ref": "VpcPublicSubnet1Subnet5C2D37C4"
},
@@ -11331,7 +11715,7 @@
{
"Ref": "EC2LinuxLogsC4CD8F14"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,x64', '', $$.Execution.Name, 'ec2,linux,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2LinuxInstanceProfile2D2BB473",
@@ -11365,7 +11749,7 @@
{
"Ref": "EC2LinuxLogsC4CD8F14"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,x64', '', $$.Execution.Name, 'ec2,linux,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2LinuxInstanceProfile2D2BB473",
@@ -11383,7 +11767,7 @@
{
"Ref": "VpcPublicSubnet2Subnet691E08A3"
},
- "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}]}}}}]},\"ec2-spot, linux, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\npoweroff\\n\"},\"Next\":\"ec2-spot, linux, x64 subnet iterator\"},\"ec2-spot, linux, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2-spot, linux, x64 subnet1\",\"States\":{\"ec2-spot, linux, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2-spot, linux, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
+ "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}]}}}}]},\"ec2-spot, linux, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\\\\\-]+ with result: \\\\\\\\K.*\\\" /home/runner/_diag/ | tail -n1)\\n [ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"{}\\\" \\\"$STATUS\\\"\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\nsleep 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs\\npoweroff\\n\"},\"Next\":\"ec2-spot, linux, x64 subnet iterator\"},\"ec2-spot, linux, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2-spot, linux, x64 subnet1\",\"States\":{\"ec2-spot, linux, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2-spot, linux, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
{
"Ref": "VpcPublicSubnet1Subnet5C2D37C4"
},
@@ -11399,7 +11783,7 @@
{
"Ref": "EC2SpotLinuxLogsF78D5F0E"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2-spot,linux,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2-spot,linux,x64', '', $$.Execution.Name, 'ec2-spot,linux,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2SpotLinuxInstanceProfileB12320D4",
@@ -11433,7 +11817,7 @@
{
"Ref": "EC2SpotLinuxLogsF78D5F0E"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2-spot,linux,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2-spot,linux,x64', '', $$.Execution.Name, 'ec2-spot,linux,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2SpotLinuxInstanceProfileB12320D4",
@@ -11451,7 +11835,7 @@
{
"Ref": "VpcPublicSubnet2Subnet691E08A3"
},
- "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}],\"InstanceMarketOptions\":{\"MarketType\":\"spot\",\"SpotOptions\":{\"SpotInstanceType\":\"one-time\"}}}}}}]},\"ec2, linux, arm64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\npoweroff\\n\"},\"Next\":\"ec2, linux, arm64 subnet iterator\"},\"ec2, linux, arm64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, linux, arm64 subnet1\",\"States\":{\"ec2, linux, arm64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, linux, arm64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
+ "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}],\"InstanceMarketOptions\":{\"MarketType\":\"spot\",\"SpotOptions\":{\"SpotInstanceType\":\"one-time\"}}}}}}]},\"ec2, linux, arm64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\\\\\-]+ with result: \\\\\\\\K.*\\\" /home/runner/_diag/ | tail -n1)\\n [ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"{}\\\" \\\"$STATUS\\\"\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\nsleep 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs\\npoweroff\\n\"},\"Next\":\"ec2, linux, arm64 subnet iterator\"},\"ec2, linux, arm64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, linux, arm64 subnet1\",\"States\":{\"ec2, linux, arm64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, linux, arm64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
{
"Ref": "VpcPublicSubnet1Subnet5C2D37C4"
},
@@ -11467,7 +11851,7 @@
{
"Ref": "EC2Linuxarm64Logs577E371E"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,arm64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,arm64', '', $$.Execution.Name, 'ec2,linux,arm64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2Linuxarm64InstanceProfile1E6F8D53",
@@ -11501,7 +11885,7 @@
{
"Ref": "EC2Linuxarm64Logs577E371E"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,arm64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,arm64', '', $$.Execution.Name, 'ec2,linux,arm64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2Linuxarm64InstanceProfile1E6F8D53",
@@ -11519,7 +11903,7 @@
{
"Ref": "VpcPublicSubnet2Subnet691E08A3"
},
- "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}]}}}}]},\"ec2, windows, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"\\n$TASK_TOKEN = \\\"{}\\\"\\nStart-Job -ScriptBlock \\\\{\\n while (1) \\\\{\\n aws stepfunctions send-task-heartbeat --task-token \\\"$using:TASK_TOKEN\\\"\\n sleep 60\\n \\\\}\\n\\\\}\\nfunction setup_logs () \\\\{\\n echo '\\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/actions/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}' | Out-File -Encoding ASCII $Env:TEMP/log.conf\\n & \\\"C:/Program Files/Amazon/AmazonCloudWatchAgent/amazon-cloudwatch-agent-ctl.ps1\\\" -a fetch-config -m ec2 -s -c file:$Env:TEMP/log.conf\\n\\\\}\\nfunction action () \\\\{\\n cd /actions\\n ./config.cmd --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" 2>&1 | Out-File -Encoding ASCII -Append /actions/runner.log\\n if ($LASTEXITCODE -ne 0) \\\\{ return 1 \\\\}\\n ./run.cmd 2>&1 | Out-File -Encoding ASCII -Append /actions/runner.log\\n if ($LASTEXITCODE -ne 0) \\\\{ return 2 \\\\}\\n return 0\\n\\\\}\\nsetup_logs\\n$r = action\\nif ($r -eq 0) \\\\{\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{ \\\\}'\\n\\\\} else \\\\{\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\n\\\\}\\nStop-Computer -ComputerName localhost -Force\\n\\n\"},\"Next\":\"ec2, windows, x64 subnet iterator\"},\"ec2, windows, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, windows, x64 subnet1\",\"States\":{\"ec2, windows, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, windows, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
+ "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}]}}}}]},\"ec2, windows, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"\\n$TASK_TOKEN = \\\"{}\\\"\\nStart-Job -ScriptBlock \\\\{\\n while (1) \\\\{\\n aws stepfunctions send-task-heartbeat --task-token \\\"$using:TASK_TOKEN\\\"\\n sleep 60\\n \\\\}\\n\\\\}\\nfunction setup_logs () \\\\{\\n echo '\\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/actions/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}' | Out-File -Encoding ASCII $Env:TEMP/log.conf\\n & \\\"C:/Program Files/Amazon/AmazonCloudWatchAgent/amazon-cloudwatch-agent-ctl.ps1\\\" -a fetch-config -m ec2 -s -c file:$Env:TEMP/log.conf\\n\\\\}\\nfunction action () \\\\{\\n cd /actions\\n ./config.cmd --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" 2>&1 | Out-File -Encoding ASCII -Append /actions/runner.log\\n if ($LASTEXITCODE -ne 0) \\\\{ return 1 \\\\}\\n ./run.cmd 2>&1 | Out-File -Encoding ASCII -Append /actions/runner.log\\n if ($LASTEXITCODE -ne 0) \\\\{ return 2 \\\\}\\n $STATUS = Select-String -Path './_diag/*.log' -Pattern 'finish job request for job [0-9a-f\\\\\\\\-]+ with result: (.*)' | %\\\\{$_.Matches.Groups[1].Value\\\\} | Select-Object -Last 1\\n if ($STATUS) \\\\{ echo \\\"CDKGHA JOB DONE {} $STATUS\\\" | Out-File -Encoding ASCII -Append /actions/runner.log \\\\}\\n return 0\\n\\\\}\\nsetup_logs\\n$r = action\\nif ($r -eq 0) \\\\{\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{ \\\\}'\\n\\\\} else \\\\{\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\n\\\\}\\nStart-Sleep -Seconds 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs\\nStop-Computer -ComputerName localhost -Force\\n\\n\"},\"Next\":\"ec2, windows, x64 subnet iterator\"},\"ec2, windows, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, windows, x64 subnet1\",\"States\":{\"ec2, windows, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, windows, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
{
"Ref": "VpcPublicSubnet1Subnet5C2D37C4"
},
@@ -11535,7 +11919,7 @@
{
"Ref": "EC2WindowsLogsDC1F2ABF"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,windows,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,windows,x64', '', $$.Execution.Name, 'ec2,windows,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2WindowsInstanceProfileDCA59D9C",
@@ -11569,7 +11953,7 @@
{
"Ref": "EC2WindowsLogsDC1F2ABF"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,windows,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,windows,x64', '', $$.Execution.Name, 'ec2,windows,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2WindowsInstanceProfileDCA59D9C",
@@ -11601,7 +11985,7 @@
"Arn"
]
},
- "\",\"Parameters\":{\"runnerName.$\":\"$$.Execution.Name\",\"owner.$\":\"$.owner\",\"repo.$\":\"$.repo\",\"runId.$\":\"$.runId\",\"installationId.$\":\"$.installationId\",\"idleOnly\":false}},\"Runner Failed\":{\"Type\":\"Fail\"},\"No\":{\"Type\":\"Succeed\"}}}"
+ "\",\"Parameters\":{\"runnerName.$\":\"$$.Execution.Name\",\"owner.$\":\"$.owner\",\"repo.$\":\"$.repo\",\"runId.$\":\"$.runId\",\"installationId.$\":\"$.installationId\",\"idleOnly\":false}},\"Runner Failed\":{\"Type\":\"Fail\"}}}"
]
]
}
@@ -11682,7 +12066,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "S3Key": "1e767d3591f00b05ef90c4d9c4a8cb3e869564005f7321ce92aaea681925076c.zip"
+ "S3Key": "3ec70c05afdc8aed95a3a8d3557ff0b9f9a04b101dd6eed663a691db1c758092.zip"
},
"Role": {
"Fn::GetAtt": [
diff --git a/test/default.integ.snapshot/manifest.json b/test/default.integ.snapshot/manifest.json
index 1258b409..e2209cff 100644
--- a/test/default.integ.snapshot/manifest.json
+++ b/test/default.integ.snapshot/manifest.json
@@ -23,7 +23,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
- "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/74161b87dae2f1070e81ba5e4a1e06998638573df169d10d063588ada0934d59.json",
+ "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e6e149362d295769a9c15b13bdbc9c297e0e0c52f0afd88785a62326dd37b86e.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
@@ -711,6 +711,12 @@
"data": "CodeBuildx64LogsA21ECD59"
}
],
+ "/github-runners-test/CodeBuildx64/Logs/Logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "CodeBuildx64LogsLogsfilter915A4B6F"
+ }
+ ],
"/github-runners-test/CodeBuildx64/CodeBuild/Role/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -813,6 +819,12 @@
"data": "CodeBuildARMLogs7C7FC5A7"
}
],
+ "/github-runners-test/CodeBuildARM/Logs/Logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "CodeBuildARMLogsLogsfilter32B5122B"
+ }
+ ],
"/github-runners-test/CodeBuildARM/CodeBuild/Role/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -837,6 +849,12 @@
"data": "CodeBuildWindowsLogsF4DD93A5"
}
],
+ "/github-runners-test/CodeBuildWindows/Logs/Logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "CodeBuildWindowsLogsLogsfilterC0A33A89"
+ }
+ ],
"/github-runners-test/CodeBuildWindows/CodeBuild/Role/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -885,6 +903,12 @@
"data": "LambdaFunctionLogRetentionB6D78D6D"
}
],
+ "/github-runners-test/Lambda/Function/LogGroup/LogGroup filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "LambdaFunctionLogGroupLogGroupfilter60E487A5"
+ }
+ ],
"/github-runners-test/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -1029,6 +1053,12 @@
"data": "LambdaARMFunctionLogRetention67E9FEF8"
}
],
+ "/github-runners-test/LambdaARM/Function/LogGroup/LogGroup filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "LambdaARMFunctionLogGroupLogGroupfilterD29D06B1"
+ }
+ ],
"/github-runners-test/Fargate/security group/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -1041,6 +1071,12 @@
"data": "FargatelogsCB753638"
}
],
+ "/github-runners-test/Fargate/logs/logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "Fargatelogslogsfilter89D6A772"
+ }
+ ],
"/github-runners-test/Fargate/task/TaskRole/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -1077,6 +1113,12 @@
"data": "Fargatex64spotlogs0BCF618B"
}
],
+ "/github-runners-test/Fargate-x64-spot/logs/logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "Fargatex64spotlogslogsfilter6590358B"
+ }
+ ],
"/github-runners-test/Fargate-x64-spot/task/TaskRole/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -1113,6 +1155,12 @@
"data": "Fargatearm64logs00171A52"
}
],
+ "/github-runners-test/Fargate-arm64/logs/logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "Fargatearm64logslogsfilter4A2869DC"
+ }
+ ],
"/github-runners-test/Fargate-arm64/task/TaskRole/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -1149,6 +1197,12 @@
"data": "Fargatearm64spotlogsEFCCEC59"
}
],
+ "/github-runners-test/Fargate-arm64-spot/logs/logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "Fargatearm64spotlogslogsfilter7E2CFF7B"
+ }
+ ],
"/github-runners-test/Fargate-arm64-spot/task/TaskRole/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -1185,6 +1239,12 @@
"data": "FargateWindowslogs52881DBF"
}
],
+ "/github-runners-test/Fargate-Windows/logs/logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "FargateWindowslogslogsfilterB5B72E7C"
+ }
+ ],
"/github-runners-test/Fargate-Windows/task/TaskRole/Resource": [
{
"type": "aws:cdk:logicalId",
@@ -1233,6 +1293,12 @@
"data": "EC2LinuxLogsC4CD8F14"
}
],
+ "/github-runners-test/EC2 Linux/Logs/Logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "EC2LinuxLogsLogsfilter186C2AB7"
+ }
+ ],
"/github-runners-test/EC2 Linux/Instance Profile": [
{
"type": "aws:cdk:logicalId",
@@ -1293,6 +1359,12 @@
"data": "EC2SpotLinuxLogsF78D5F0E"
}
],
+ "/github-runners-test/EC2 Spot Linux/Logs/Logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "EC2SpotLinuxLogsLogsfilter89CE719F"
+ }
+ ],
"/github-runners-test/EC2 Spot Linux/Instance Profile": [
{
"type": "aws:cdk:logicalId",
@@ -1491,6 +1563,12 @@
"data": "EC2Linuxarm64Logs577E371E"
}
],
+ "/github-runners-test/EC2 Linux arm64/Logs/Logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "EC2Linuxarm64LogsLogsfilter0A247938"
+ }
+ ],
"/github-runners-test/EC2 Linux arm64/Instance Profile": [
{
"type": "aws:cdk:logicalId",
@@ -1683,6 +1761,12 @@
"data": "EC2WindowsLogsDC1F2ABF"
}
],
+ "/github-runners-test/EC2 Windows/Logs/Logs filter/Resource": [
+ {
+ "type": "aws:cdk:logicalId",
+ "data": "EC2WindowsLogsLogsfilter253E4D4D"
+ }
+ ],
"/github-runners-test/EC2 Windows/Instance Profile": [
{
"type": "aws:cdk:logicalId",
diff --git a/test/default.integ.snapshot/tree.json b/test/default.integ.snapshot/tree.json
index 0390117d..d1d383d8 100644
--- a/test/default.integ.snapshot/tree.json
+++ b/test/default.integ.snapshot/tree.json
@@ -1902,7 +1902,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "/c6586c763100b9311cadceb2a66b5cd94d96d0f4f402d8c4c26b09b74cb79712.zip"
+ "/35b43c1bd758381cc1156a4423ce9aa1cd1179195d173a9798caddab9ea9c1b9.zip"
]
]
}
@@ -2105,7 +2105,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "/c6586c763100b9311cadceb2a66b5cd94d96d0f4f402d8c4c26b09b74cb79712.zip"
+ "/35b43c1bd758381cc1156a4423ce9aa1cd1179195d173a9798caddab9ea9c1b9.zip"
]
]
},
@@ -5182,6 +5182,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "Logs filter": {
+ "id": "Logs filter",
+ "path": "github-runners-test/CodeBuildx64/Logs/Logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/CodeBuildx64/Logs/Logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "CodeBuildx64LogsA21ECD59"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -5451,7 +5495,7 @@
},
"source": {
"type": "NO_SOURCE",
- "buildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &\",\n \"timeout 15 sh -c \\\"until docker info; do echo .; sleep 1; done\\\"\",\n \"if [ \\\"${RUNNER_VERSION}\\\" = \\\"latest\\\" ]; then RUNNER_FLAGS=\\\"\\\"; else RUNNER_FLAGS=\\\"--disableupdate\\\"; fi\",\n \"sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://${GITHUB_DOMAIN}/${OWNER}/${REPO}\\\" --token \\\"${RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${RUNNER_LABEL}\\\" ${RUNNER_FLAGS} --name \\\"${RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"sudo --preserve-env=AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,AWS_DEFAULT_REGION,AWS_REGION -Hu runner /home/runner/run.sh\"\n ]\n }\n }\n}"
+ "buildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &\",\n \"timeout 15 sh -c \\\"until docker info; do echo .; sleep 1; done\\\"\",\n \"if [ \\\"${RUNNER_VERSION}\\\" = \\\"latest\\\" ]; then RUNNER_FLAGS=\\\"\\\"; else RUNNER_FLAGS=\\\"--disableupdate\\\"; fi\",\n \"sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://${GITHUB_DOMAIN}/${OWNER}/${REPO}\\\" --token \\\"${RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${RUNNER_LABEL}\\\" ${RUNNER_FLAGS} --name \\\"${RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"sudo --preserve-env=AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,AWS_DEFAULT_REGION,AWS_REGION -Hu runner /home/runner/run.sh\",\n \"STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\-]+ with result: \\\\K.*\\\" /home/runner/_diag/ | tail -n1)\",\n \"[ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"$RUNNER_LABEL\\\" \\\"$STATUS\\\"\"\n ]\n }\n }\n}"
},
"cache": {
"type": "NO_CACHE"
@@ -6345,6 +6389,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "Logs filter": {
+ "id": "Logs filter",
+ "path": "github-runners-test/CodeBuildARM/Logs/Logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/CodeBuildARM/Logs/Logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "CodeBuildARMLogs7C7FC5A7"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -6614,7 +6702,7 @@
},
"source": {
"type": "NO_SOURCE",
- "buildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &\",\n \"timeout 15 sh -c \\\"until docker info; do echo .; sleep 1; done\\\"\",\n \"if [ \\\"${RUNNER_VERSION}\\\" = \\\"latest\\\" ]; then RUNNER_FLAGS=\\\"\\\"; else RUNNER_FLAGS=\\\"--disableupdate\\\"; fi\",\n \"sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://${GITHUB_DOMAIN}/${OWNER}/${REPO}\\\" --token \\\"${RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${RUNNER_LABEL}\\\" ${RUNNER_FLAGS} --name \\\"${RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"sudo --preserve-env=AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,AWS_DEFAULT_REGION,AWS_REGION -Hu runner /home/runner/run.sh\"\n ]\n }\n }\n}"
+ "buildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &\",\n \"timeout 15 sh -c \\\"until docker info; do echo .; sleep 1; done\\\"\",\n \"if [ \\\"${RUNNER_VERSION}\\\" = \\\"latest\\\" ]; then RUNNER_FLAGS=\\\"\\\"; else RUNNER_FLAGS=\\\"--disableupdate\\\"; fi\",\n \"sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://${GITHUB_DOMAIN}/${OWNER}/${REPO}\\\" --token \\\"${RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${RUNNER_LABEL}\\\" ${RUNNER_FLAGS} --name \\\"${RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"sudo --preserve-env=AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,AWS_DEFAULT_REGION,AWS_REGION -Hu runner /home/runner/run.sh\",\n \"STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\-]+ with result: \\\\K.*\\\" /home/runner/_diag/ | tail -n1)\",\n \"[ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"$RUNNER_LABEL\\\" \\\"$STATUS\\\"\"\n ]\n }\n }\n}"
},
"cache": {
"type": "NO_CACHE"
@@ -6678,6 +6766,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "Logs filter": {
+ "id": "Logs filter",
+ "path": "github-runners-test/CodeBuildWindows/Logs/Logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/CodeBuildWindows/Logs/Logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "CodeBuildWindowsLogsF4DD93A5"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -6990,7 +7122,7 @@
},
"source": {
"type": "NO_SOURCE",
- "buildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"cd \\\\actions\",\n \"if (${Env:RUNNER_VERSION} -eq \\\"latest\\\") { $RunnerFlags = \\\"\\\" } else { $RunnerFlags = \\\"--disableupdate\\\" }\",\n \"./config.cmd --unattended --url \\\"https://${Env:GITHUB_DOMAIN}/${Env:OWNER}/${Env:REPO}\\\" --token \\\"${Env:RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${Env:RUNNER_LABEL}\\\" ${RunnerFlags} --name \\\"${Env:RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cd \\\\actions\",\n \"./run.cmd\"\n ]\n }\n }\n}"
+ "buildSpec": "{\n \"version\": \"0.2\",\n \"env\": {\n \"variables\": {\n \"RUNNER_TOKEN\": \"unspecified\",\n \"RUNNER_NAME\": \"unspecified\",\n \"RUNNER_LABEL\": \"unspecified\",\n \"OWNER\": \"unspecified\",\n \"REPO\": \"unspecified\",\n \"GITHUB_DOMAIN\": \"github.com\"\n }\n },\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"cd \\\\actions\",\n \"if (${Env:RUNNER_VERSION} -eq \\\"latest\\\") { $RunnerFlags = \\\"\\\" } else { $RunnerFlags = \\\"--disableupdate\\\" }\",\n \"./config.cmd --unattended --url \\\"https://${Env:GITHUB_DOMAIN}/${Env:OWNER}/${Env:REPO}\\\" --token \\\"${Env:RUNNER_TOKEN}\\\" --ephemeral --work _work --labels \\\"${Env:RUNNER_LABEL}\\\" ${RunnerFlags} --name \\\"${Env:RUNNER_NAME}\\\"\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cd \\\\actions\",\n \"./run.cmd\",\n \"$STATUS = Select-String -Path './_diag/*.log' -Pattern 'finish job request for job [0-9a-f\\\\-]+ with result: (.*)' | %{$_.Matches.Groups[1].Value} | Select-Object -Last 1\",\n \"if ($STATUS) { echo \\\"CDKGHA JOB DONE ${Env:RUNNER_LABEL} $STATUS\\\" }\"\n ]\n }\n }\n}"
},
"cache": {
"type": "NO_CACHE"
@@ -7288,6 +7420,55 @@
"LogGroup": {
"id": "LogGroup",
"path": "github-runners-test/Lambda/Function/LogGroup",
+ "children": {
+ "LogGroup filter": {
+ "id": "LogGroup filter",
+ "path": "github-runners-test/Lambda/Function/LogGroup/LogGroup filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/Lambda/Function/LogGroup/LogGroup filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Fn::GetAtt": [
+ "LambdaFunctionLogRetentionB6D78D6D",
+ "LogGroupName"
+ ]
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
"constructInfo": {
"fqn": "aws-cdk-lib.Resource",
"version": "2.50.0"
@@ -7815,7 +7996,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "/8c55ea107f6e2196a0031415c01f5379272fd74e2e444a90fee3c356b9ecf5a2.zip"
+ "/957afa1928595609e8a66240dc846b4e8fc1cf8ad1d4cfb76f4ec81853f2ae97.zip"
]
]
}
@@ -8018,7 +8199,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "/8c55ea107f6e2196a0031415c01f5379272fd74e2e444a90fee3c356b9ecf5a2.zip"
+ "/957afa1928595609e8a66240dc846b4e8fc1cf8ad1d4cfb76f4ec81853f2ae97.zip"
]
]
},
@@ -8739,6 +8920,55 @@
"LogGroup": {
"id": "LogGroup",
"path": "github-runners-test/LambdaARM/Function/LogGroup",
+ "children": {
+ "LogGroup filter": {
+ "id": "LogGroup filter",
+ "path": "github-runners-test/LambdaARM/Function/LogGroup/LogGroup filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/LambdaARM/Function/LogGroup/LogGroup filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Fn::GetAtt": [
+ "LambdaARMFunctionLogRetention67E9FEF8",
+ "LogGroupName"
+ ]
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
"constructInfo": {
"fqn": "aws-cdk-lib.Resource",
"version": "2.50.0"
@@ -8819,6 +9049,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "logs filter": {
+ "id": "logs filter",
+ "path": "github-runners-test/Fargate/logs/logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/Fargate/logs/logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "FargatelogsCB753638"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -8876,7 +9150,7 @@
"command": [
"sh",
"-c",
- "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && ./run.sh"
+ "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && \n ./run.sh &&\n STATUS=$(grep -Phors \"finish job request for job [0-9a-f\\-]+ with result: \\K.*\" _diag/ | tail -n1) &&\n [ -n \"$STATUS\" ] && echo CDKGHA JOB DONE \"$RUNNER_LABEL\" \"$STATUS\""
],
"essential": true,
"image": {
@@ -9154,6 +9428,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "logs filter": {
+ "id": "logs filter",
+ "path": "github-runners-test/Fargate-x64-spot/logs/logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/Fargate-x64-spot/logs/logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "Fargatex64spotlogs0BCF618B"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -9211,7 +9529,7 @@
"command": [
"sh",
"-c",
- "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && ./run.sh"
+ "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && \n ./run.sh &&\n STATUS=$(grep -Phors \"finish job request for job [0-9a-f\\-]+ with result: \\K.*\" _diag/ | tail -n1) &&\n [ -n \"$STATUS\" ] && echo CDKGHA JOB DONE \"$RUNNER_LABEL\" \"$STATUS\""
],
"essential": true,
"image": {
@@ -9489,6 +9807,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "logs filter": {
+ "id": "logs filter",
+ "path": "github-runners-test/Fargate-arm64/logs/logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/Fargate-arm64/logs/logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "Fargatearm64logs00171A52"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -9546,7 +9908,7 @@
"command": [
"sh",
"-c",
- "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && ./run.sh"
+ "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && \n ./run.sh &&\n STATUS=$(grep -Phors \"finish job request for job [0-9a-f\\-]+ with result: \\K.*\" _diag/ | tail -n1) &&\n [ -n \"$STATUS\" ] && echo CDKGHA JOB DONE \"$RUNNER_LABEL\" \"$STATUS\""
],
"essential": true,
"image": {
@@ -9824,6 +10186,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "logs filter": {
+ "id": "logs filter",
+ "path": "github-runners-test/Fargate-arm64-spot/logs/logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/Fargate-arm64-spot/logs/logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "Fargatearm64spotlogsEFCCEC59"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -9881,7 +10287,7 @@
"command": [
"sh",
"-c",
- "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && ./run.sh"
+ "./config.sh --unattended --url \"https://$GITHUB_DOMAIN/$OWNER/$REPO\" --token \"$RUNNER_TOKEN\" --ephemeral --work _work --labels \"$RUNNER_LABEL\" --disableupdate --name \"$RUNNER_NAME\" && \n ./run.sh &&\n STATUS=$(grep -Phors \"finish job request for job [0-9a-f\\-]+ with result: \\K.*\" _diag/ | tail -n1) &&\n [ -n \"$STATUS\" ] && echo CDKGHA JOB DONE \"$RUNNER_LABEL\" \"$STATUS\""
],
"essential": true,
"image": {
@@ -10159,6 +10565,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "logs filter": {
+ "id": "logs filter",
+ "path": "github-runners-test/Fargate-Windows/logs/logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/Fargate-Windows/logs/logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "FargateWindowslogs52881DBF"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -10216,7 +10666,7 @@
"command": [
"powershell",
"-Command",
- "cd \\actions ; ./config.cmd --unattended --url \"https://${Env:GITHUB_DOMAIN}/${Env:OWNER}/${Env:REPO}\" --token \"${Env:RUNNER_TOKEN}\" --ephemeral --work _work --labels \"${Env:RUNNER_LABEL}\" --disableupdate --name \"${Env:RUNNER_NAME}\" ; ./run.cmd"
+ "cd \\actions ; ./config.cmd --unattended --url \"https://${Env:GITHUB_DOMAIN}/${Env:OWNER}/${Env:REPO}\" --token \"${Env:RUNNER_TOKEN}\" --ephemeral --work _work --labels \"${Env:RUNNER_LABEL}\" --disableupdate --name \"${Env:RUNNER_NAME}\" ; \n ./run.cmd ; \n $STATUS = Select-String -Path './_diag/*.log' -Pattern 'finish job request for job [0-9a-f\\-]+ with result: (.*)' | %{$_.Matches.Groups[1].Value} | Select-Object -Last 1 ; \n if ($STATUS) { echo \"CDKGHA JOB DONE ${Env:RUNNER_LABEL} $STATUS\" }"
],
"essential": true,
"image": {
@@ -10649,6 +11099,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "Logs filter": {
+ "id": "Logs filter",
+ "path": "github-runners-test/EC2 Linux/Logs/Logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/EC2 Linux/Logs/Logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "EC2LinuxLogsC4CD8F14"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -11086,6 +11580,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "Logs filter": {
+ "id": "Logs filter",
+ "path": "github-runners-test/EC2 Spot Linux/Logs/Logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/EC2 Spot Linux/Logs/Logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "EC2SpotLinuxLogsF78D5F0E"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -12213,6 +12751,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "Logs filter": {
+ "id": "Logs filter",
+ "path": "github-runners-test/EC2 Linux arm64/Logs/Logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/EC2 Linux arm64/Logs/Logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "EC2Linuxarm64Logs577E371E"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -13300,6 +13882,50 @@
"fqn": "aws-cdk-lib.aws_logs.CfnLogGroup",
"version": "2.50.0"
}
+ },
+ "Logs filter": {
+ "id": "Logs filter",
+ "path": "github-runners-test/EC2 Windows/Logs/Logs filter",
+ "children": {
+ "Resource": {
+ "id": "Resource",
+ "path": "github-runners-test/EC2 Windows/Logs/Logs filter/Resource",
+ "attributes": {
+ "aws:cdk:cloudformation:type": "AWS::Logs::MetricFilter",
+ "aws:cdk:cloudformation:props": {
+ "filterPattern": "[..., marker = \"CDKGHA\", job = \"JOB\", done = \"DONE\", labels, status = \"Succeeded\" || status = \"SucceededWithIssues\" || status = \"Failed\" || status = \"Canceled\" || status = \"Skipped\" || status = \"Abandoned\"]",
+ "logGroupName": {
+ "Ref": "EC2WindowsLogsDC1F2ABF"
+ },
+ "metricTransformations": [
+ {
+ "metricNamespace": "GitHubRunners",
+ "metricName": "JobCompleted",
+ "metricValue": "1",
+ "dimensions": [
+ {
+ "key": "ProviderLabels",
+ "value": "$labels"
+ },
+ {
+ "key": "Status",
+ "value": "$status"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.CfnMetricFilter",
+ "version": "2.50.0"
+ }
+ }
+ },
+ "constructInfo": {
+ "fqn": "aws-cdk-lib.aws_logs.MetricFilter",
+ "version": "2.50.0"
+ }
}
},
"constructInfo": {
@@ -13978,22 +14604,6 @@
"version": "2.50.0"
}
},
- "Is self hosted?": {
- "id": "Is self hosted?",
- "path": "github-runners-test/runners/Is self hosted?",
- "constructInfo": {
- "fqn": "aws-cdk-lib.aws_stepfunctions.Choice",
- "version": "2.50.0"
- }
- },
- "No": {
- "id": "No",
- "path": "github-runners-test/runners/No",
- "constructInfo": {
- "fqn": "aws-cdk-lib.aws_stepfunctions.Succeed",
- "version": "2.50.0"
- }
- },
"Runner Orchestrator": {
"id": "Runner Orchestrator",
"path": "github-runners-test/runners/Runner Orchestrator",
@@ -15068,7 +15678,7 @@
"Fn::Join": [
"",
[
- "{\"StartAt\":\"Is self hosted?\",\"States\":{\"Is self hosted?\":{\"Type\":\"Choice\",\"Choices\":[{\"Variable\":\"$.labels.self-hosted\",\"IsPresent\":false,\"Next\":\"No\"}],\"Default\":\"Get Runner Token\"},\"Get Runner Token\":{\"Next\":\"Error Catcher\",\"Retry\":[{\"ErrorEquals\":[\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"ResultPath\":\"$.runner\",\"Resource\":\"",
+ "{\"StartAt\":\"Get Runner Token\",\"States\":{\"Get Runner Token\":{\"Next\":\"Error Catcher\",\"Retry\":[{\"ErrorEquals\":[\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"ResultPath\":\"$.runner\",\"Resource\":\"",
{
"Fn::GetAtt": [
"runnerstokenretrieverD5E8392A",
@@ -15251,7 +15861,7 @@
"GroupId"
]
},
- "\"]}},\"Overrides\":{\"ContainerOverrides\":[{\"Name\":\"runner\",\"Environment\":[{\"Name\":\"RUNNER_TOKEN\",\"Value.$\":\"$.runner.token\"},{\"Name\":\"RUNNER_NAME\",\"Value.$\":\"$$.Execution.Name\"},{\"Name\":\"RUNNER_LABEL\",\"Value\":\"fargate,windows,x64\"},{\"Name\":\"GITHUB_DOMAIN\",\"Value.$\":\"$.runner.domain\"},{\"Name\":\"OWNER\",\"Value.$\":\"$.owner\"},{\"Name\":\"REPO\",\"Value.$\":\"$.repo\"}]}]},\"EnableExecuteCommand\":false,\"CapacityProviderStrategy\":[{\"CapacityProvider\":\"FARGATE\"}]}},\"ec2, linux, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\npoweroff\\n\"},\"Next\":\"ec2, linux, x64 subnet iterator\"},\"ec2, linux, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, linux, x64 subnet1\",\"States\":{\"ec2, linux, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, linux, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
+ "\"]}},\"Overrides\":{\"ContainerOverrides\":[{\"Name\":\"runner\",\"Environment\":[{\"Name\":\"RUNNER_TOKEN\",\"Value.$\":\"$.runner.token\"},{\"Name\":\"RUNNER_NAME\",\"Value.$\":\"$$.Execution.Name\"},{\"Name\":\"RUNNER_LABEL\",\"Value\":\"fargate,windows,x64\"},{\"Name\":\"GITHUB_DOMAIN\",\"Value.$\":\"$.runner.domain\"},{\"Name\":\"OWNER\",\"Value.$\":\"$.owner\"},{\"Name\":\"REPO\",\"Value.$\":\"$.repo\"}]}]},\"EnableExecuteCommand\":false,\"CapacityProviderStrategy\":[{\"CapacityProvider\":\"FARGATE\"}]}},\"ec2, linux, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\\\\\-]+ with result: \\\\\\\\K.*\\\" /home/runner/_diag/ | tail -n1)\\n [ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"{}\\\" \\\"$STATUS\\\"\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\nsleep 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs\\npoweroff\\n\"},\"Next\":\"ec2, linux, x64 subnet iterator\"},\"ec2, linux, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, linux, x64 subnet1\",\"States\":{\"ec2, linux, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, linux, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
{
"Ref": "VpcPublicSubnet1Subnet5C2D37C4"
},
@@ -15267,7 +15877,7 @@
{
"Ref": "EC2LinuxLogsC4CD8F14"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,x64', '', $$.Execution.Name, 'ec2,linux,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2LinuxInstanceProfile2D2BB473",
@@ -15301,7 +15911,7 @@
{
"Ref": "EC2LinuxLogsC4CD8F14"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,x64', '', $$.Execution.Name, 'ec2,linux,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2LinuxInstanceProfile2D2BB473",
@@ -15319,7 +15929,7 @@
{
"Ref": "VpcPublicSubnet2Subnet691E08A3"
},
- "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}]}}}}]},\"ec2-spot, linux, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\npoweroff\\n\"},\"Next\":\"ec2-spot, linux, x64 subnet iterator\"},\"ec2-spot, linux, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2-spot, linux, x64 subnet1\",\"States\":{\"ec2-spot, linux, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2-spot, linux, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
+ "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}]}}}}]},\"ec2-spot, linux, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\\\\\-]+ with result: \\\\\\\\K.*\\\" /home/runner/_diag/ | tail -n1)\\n [ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"{}\\\" \\\"$STATUS\\\"\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\nsleep 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs\\npoweroff\\n\"},\"Next\":\"ec2-spot, linux, x64 subnet iterator\"},\"ec2-spot, linux, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2-spot, linux, x64 subnet1\",\"States\":{\"ec2-spot, linux, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2-spot, linux, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
{
"Ref": "VpcPublicSubnet1Subnet5C2D37C4"
},
@@ -15335,7 +15945,7 @@
{
"Ref": "EC2SpotLinuxLogsF78D5F0E"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2-spot,linux,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2-spot,linux,x64', '', $$.Execution.Name, 'ec2-spot,linux,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2SpotLinuxInstanceProfileB12320D4",
@@ -15369,7 +15979,7 @@
{
"Ref": "EC2SpotLinuxLogsF78D5F0E"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2-spot,linux,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2-spot,linux,x64', '', $$.Execution.Name, 'ec2-spot,linux,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2SpotLinuxInstanceProfileB12320D4",
@@ -15387,7 +15997,7 @@
{
"Ref": "VpcPublicSubnet2Subnet691E08A3"
},
- "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}],\"InstanceMarketOptions\":{\"MarketType\":\"spot\",\"SpotOptions\":{\"SpotInstanceType\":\"one-time\"}}}}}}]},\"ec2, linux, arm64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\npoweroff\\n\"},\"Next\":\"ec2, linux, arm64 subnet iterator\"},\"ec2, linux, arm64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, linux, arm64 subnet1\",\"States\":{\"ec2, linux, arm64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, linux, arm64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
+ "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}],\"InstanceMarketOptions\":{\"MarketType\":\"spot\",\"SpotOptions\":{\"SpotInstanceType\":\"one-time\"}}}}}}]},\"ec2, linux, arm64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"#!/bin/bash -x\\nTASK_TOKEN=\\\"{}\\\"\\nheartbeat () \\\\{\\n while true; do\\n aws stepfunctions send-task-heartbeat --task-token \\\"$TASK_TOKEN\\\"\\n sleep 60\\n done\\n\\\\}\\nsetup_logs () \\\\{\\n cat < /tmp/log.conf || exit 1\\n \\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/var/log/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}\\nEOF\\n /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/tmp/log.conf || exit 2\\n\\\\}\\naction () \\\\{\\n sudo -Hu runner /home/runner/config.sh --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" || exit 1\\n sudo --preserve-env=AWS_REGION -Hu runner /home/runner/run.sh || exit 2\\n STATUS=$(grep -Phors \\\"finish job request for job [0-9a-f\\\\\\\\-]+ with result: \\\\\\\\K.*\\\" /home/runner/_diag/ | tail -n1)\\n [ -n \\\"$STATUS\\\" ] && echo CDKGHA JOB DONE \\\"{}\\\" \\\"$STATUS\\\"\\n\\\\}\\nheartbeat &\\nif setup_logs && action | tee /var/log/runner.log 2>&1; then\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{\\\"ok\\\": true\\\\}'\\nelse\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\nfi\\nsleep 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs\\npoweroff\\n\"},\"Next\":\"ec2, linux, arm64 subnet iterator\"},\"ec2, linux, arm64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, linux, arm64 subnet1\",\"States\":{\"ec2, linux, arm64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, linux, arm64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
{
"Ref": "VpcPublicSubnet1Subnet5C2D37C4"
},
@@ -15403,7 +16013,7 @@
{
"Ref": "EC2Linuxarm64Logs577E371E"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,arm64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,arm64', '', $$.Execution.Name, 'ec2,linux,arm64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2Linuxarm64InstanceProfile1E6F8D53",
@@ -15437,7 +16047,7 @@
{
"Ref": "EC2Linuxarm64Logs577E371E"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,arm64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,linux,arm64', '', $$.Execution.Name, 'ec2,linux,arm64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2Linuxarm64InstanceProfile1E6F8D53",
@@ -15455,7 +16065,7 @@
{
"Ref": "VpcPublicSubnet2Subnet691E08A3"
},
- "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}]}}}}]},\"ec2, windows, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"\\n$TASK_TOKEN = \\\"{}\\\"\\nStart-Job -ScriptBlock \\\\{\\n while (1) \\\\{\\n aws stepfunctions send-task-heartbeat --task-token \\\"$using:TASK_TOKEN\\\"\\n sleep 60\\n \\\\}\\n\\\\}\\nfunction setup_logs () \\\\{\\n echo '\\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/actions/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}' | Out-File -Encoding ASCII $Env:TEMP/log.conf\\n & \\\"C:/Program Files/Amazon/AmazonCloudWatchAgent/amazon-cloudwatch-agent-ctl.ps1\\\" -a fetch-config -m ec2 -s -c file:$Env:TEMP/log.conf\\n\\\\}\\nfunction action () \\\\{\\n cd /actions\\n ./config.cmd --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" 2>&1 | Out-File -Encoding ASCII -Append /actions/runner.log\\n if ($LASTEXITCODE -ne 0) \\\\{ return 1 \\\\}\\n ./run.cmd 2>&1 | Out-File -Encoding ASCII -Append /actions/runner.log\\n if ($LASTEXITCODE -ne 0) \\\\{ return 2 \\\\}\\n return 0\\n\\\\}\\nsetup_logs\\n$r = action\\nif ($r -eq 0) \\\\{\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{ \\\\}'\\n\\\\} else \\\\{\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\n\\\\}\\nStop-Computer -ComputerName localhost -Force\\n\\n\"},\"Next\":\"ec2, windows, x64 subnet iterator\"},\"ec2, windows, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, windows, x64 subnet1\",\"States\":{\"ec2, windows, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, windows, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
+ "\",\"BlockDeviceMappings\":[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"DeleteOnTermination\":true,\"VolumeSize\":30}}]}}}}]},\"ec2, windows, x64 data\":{\"Type\":\"Pass\",\"ResultPath\":\"$.ec2\",\"Parameters\":{\"userdataTemplate\":\"\\n$TASK_TOKEN = \\\"{}\\\"\\nStart-Job -ScriptBlock \\\\{\\n while (1) \\\\{\\n aws stepfunctions send-task-heartbeat --task-token \\\"$using:TASK_TOKEN\\\"\\n sleep 60\\n \\\\}\\n\\\\}\\nfunction setup_logs () \\\\{\\n echo '\\\\{\\n \\\"logs\\\": \\\\{\\n \\\"log_stream_name\\\": \\\"unknown\\\",\\n \\\"logs_collected\\\": \\\\{\\n \\\"files\\\": \\\\{\\n \\\"collect_list\\\": [\\n \\\\{\\n \\\"file_path\\\": \\\"/actions/runner.log\\\",\\n \\\"log_group_name\\\": \\\"{}\\\",\\n \\\"log_stream_name\\\": \\\"{}\\\",\\n \\\"timezone\\\": \\\"UTC\\\"\\n \\\\}\\n ]\\n \\\\}\\n \\\\}\\n \\\\}\\n \\\\}' | Out-File -Encoding ASCII $Env:TEMP/log.conf\\n & \\\"C:/Program Files/Amazon/AmazonCloudWatchAgent/amazon-cloudwatch-agent-ctl.ps1\\\" -a fetch-config -m ec2 -s -c file:$Env:TEMP/log.conf\\n\\\\}\\nfunction action () \\\\{\\n cd /actions\\n ./config.cmd --unattended --url \\\"https://{}/{}/{}\\\" --token \\\"{}\\\" --ephemeral --work _work --labels \\\"{}\\\" {} --name \\\"{}\\\" 2>&1 | Out-File -Encoding ASCII -Append /actions/runner.log\\n if ($LASTEXITCODE -ne 0) \\\\{ return 1 \\\\}\\n ./run.cmd 2>&1 | Out-File -Encoding ASCII -Append /actions/runner.log\\n if ($LASTEXITCODE -ne 0) \\\\{ return 2 \\\\}\\n $STATUS = Select-String -Path './_diag/*.log' -Pattern 'finish job request for job [0-9a-f\\\\\\\\-]+ with result: (.*)' | %\\\\{$_.Matches.Groups[1].Value\\\\} | Select-Object -Last 1\\n if ($STATUS) \\\\{ echo \\\"CDKGHA JOB DONE {} $STATUS\\\" | Out-File -Encoding ASCII -Append /actions/runner.log \\\\}\\n return 0\\n\\\\}\\nsetup_logs\\n$r = action\\nif ($r -eq 0) \\\\{\\n aws stepfunctions send-task-success --task-token \\\"$TASK_TOKEN\\\" --task-output '\\\\{ \\\\}'\\n\\\\} else \\\\{\\n aws stepfunctions send-task-failure --task-token \\\"$TASK_TOKEN\\\"\\n\\\\}\\nStart-Sleep -Seconds 10 # give cloudwatch agent its default 5 seconds buffer duration to upload logs\\nStop-Computer -ComputerName localhost -Force\\n\\n\"},\"Next\":\"ec2, windows, x64 subnet iterator\"},\"ec2, windows, x64 subnet iterator\":{\"Type\":\"Parallel\",\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"IntervalSeconds\":60,\"MaxAttempts\":10,\"BackoffRate\":1.3}],\"Branches\":[{\"StartAt\":\"ec2, windows, x64 subnet1\",\"States\":{\"ec2, windows, x64 subnet1\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"Ec2.Ec2Exception\",\"States.Timeout\"],\"ResultPath\":\"$.lastSubnetError\",\"Next\":\"ec2, windows, x64 subnet2\"}],\"Type\":\"Task\",\"Comment\":\"",
{
"Ref": "VpcPublicSubnet1Subnet5C2D37C4"
},
@@ -15471,7 +16081,7 @@
{
"Ref": "EC2WindowsLogsDC1F2ABF"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,windows,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,windows,x64', '', $$.Execution.Name, 'ec2,windows,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2WindowsInstanceProfileDCA59D9C",
@@ -15505,7 +16115,7 @@
{
"Ref": "EC2WindowsLogsDC1F2ABF"
},
- "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,windows,x64', '', $$.Execution.Name))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
+ "', $$.Execution.Name, $.runner.domain, $.owner, $.repo, $.runner.token, 'ec2,windows,x64', '', $$.Execution.Name, 'ec2,windows,x64'))\",\"InstanceInitiatedShutdownBehavior\":\"terminate\",\"IamInstanceProfile\":{\"Arn\":\"",
{
"Fn::GetAtt": [
"EC2WindowsInstanceProfileDCA59D9C",
@@ -15537,7 +16147,7 @@
"Arn"
]
},
- "\",\"Parameters\":{\"runnerName.$\":\"$$.Execution.Name\",\"owner.$\":\"$.owner\",\"repo.$\":\"$.repo\",\"runId.$\":\"$.runId\",\"installationId.$\":\"$.installationId\",\"idleOnly\":false}},\"Runner Failed\":{\"Type\":\"Fail\"},\"No\":{\"Type\":\"Succeed\"}}}"
+ "\",\"Parameters\":{\"runnerName.$\":\"$$.Execution.Name\",\"owner.$\":\"$.owner\",\"repo.$\":\"$.repo\",\"runId.$\":\"$.runId\",\"installationId.$\":\"$.installationId\",\"idleOnly\":false}},\"Runner Failed\":{\"Type\":\"Fail\"}}}"
]
]
}
@@ -15698,7 +16308,7 @@
"s3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
- "s3Key": "1e767d3591f00b05ef90c4d9c4a8cb3e869564005f7321ce92aaea681925076c.zip"
+ "s3Key": "3ec70c05afdc8aed95a3a8d3557ff0b9f9a04b101dd6eed663a691db1c758092.zip"
},
"role": {
"Fn::GetAtt": [
diff --git a/test/default.integ.ts b/test/default.integ.ts
index 4f103a43..9ffa0c1d 100644
--- a/test/default.integ.ts
+++ b/test/default.integ.ts
@@ -160,6 +160,6 @@ new GitHubRunners(stack, 'runners', {
vpc,
}),
],
-});
+}).metricJobCompleted();
app.synth();
diff --git a/test/runner.test.ts b/test/runner.test.ts
index efb3c156..2257564a 100644
--- a/test/runner.test.ts
+++ b/test/runner.test.ts
@@ -81,4 +81,26 @@ describe('GitHubRunners', () => {
});
}).toThrow('Both test/p1 and test/p2 use the same labels [a]');
});
+
+ test('Metrics', () => {
+ const runners = new GitHubRunners(stack, 'runners', {
+ providers: [new CodeBuildRunner(stack, 'p1')],
+ });
+
+ // second time shouldn't add more filters (tested below)
+ runners.metricJobCompleted();
+ runners.metricJobCompleted();
+
+ // just test these don't crash and burn
+ runners.metricFailed();
+ runners.metricSucceeded();
+ runners.metricTime();
+
+ const template = Template.fromStack(stack);
+
+ template.resourceCountIs(
+ 'AWS::Logs::MetricFilter',
+ 1,
+ );
+ });
});