You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 16, 2025. It is now read-only.
feat!: replace tslog by awspowertools logging (#3037)
The module is using TSLog now for a sometime. But after breaking changes we are not able to update TSLog anymore. In the meantime, AWS have released [AWS Powertools for Lambda](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/), including logging capabilities. Since this solution is AWS native, we are replacing the outdated TSLog by AWS Powertools logging.
## Breaking change
In this PR we replace TSLog by AWS Powertools logs with a minimal impact on code changes. The change can have be breaking in the following cases:
- Processing the logging, we only will support JSON formatted log
- Depending on the removed setting LOG_TYPE
- Depending on the LOG_LEVEL silly, fatal or trace
## Log messages
All log messages are JSON formatted and contain besides the message scope information like: `function-name`, `environment`, `module`. By enabling DEBUG log level the event received by the Lambda will be logged.
Copy file name to clipboardExpand all lines: README.md
+50-2
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@
4
4
5
5
This [Terraform](https://www.terraform.io/) module creates the required infrastructure needed to host [GitHub Actions](https://github.com/features/actions) self-hosted, auto-scaling runners on [AWS spot instances](https://aws.amazon.com/ec2/spot/). It provides the required logic to handle the life cycle for scaling up and down using a set of AWS Lambda functions. Runners are scaled down to zero to avoid costs when no workflows are active.
6
6
7
+
> 📢 [`v3`](https://github.com/philips-labs/terraform-aws-github-runner/pull/3037) underlying loggin framework is replaces by [AWS Lambda Powertools](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/). Depending on how you handle the logging of the module a migration could be required.
8
+
7
9
> 📢 [`v2`](https://github.com/philips-labs/terraform-aws-github-runner/issues/2517) support via a Terraform [submodule](./modules/multi-runner/README.md) an option to create multiple runners at once. The webhook will deliver based on matching rules the events to a dedicated queue for the runners. Next per queue a scaling lambda will ensure the specific runner is created. For more details checkout the [examples](./examples/multi-runner/README.md).
8
10
9
11
> 📢 `v1` is available on a dedicated branch. The default branch `main` is related to `v2`, for fixes or backports you can submit a PR to the branch `v1`. For feature PR's we will ask you to at least submit a PR to `main`
@@ -31,6 +33,7 @@ This [Terraform](https://www.terraform.io/) module creates the required infrastr
31
33
-[Experimental - Optional queue to publish GitHub workflow job events](#experimental---optional-queue-to-publish-github-workflow-job-events)
@@ -41,6 +44,12 @@ This [Terraform](https://www.terraform.io/) module creates the required infrastr
41
44
-[Outputs](#outputs)
42
45
-[Contribution](#contribution)
43
46
-[Philips Forest](#philips-forest)
47
+
-[Requirements](#requirements-1)
48
+
-[Providers](#providers-1)
49
+
-[Modules](#modules-1)
50
+
-[Resources](#resources-1)
51
+
-[Inputs](#inputs-1)
52
+
-[Outputs](#outputs-1)
44
53
45
54
## Motivation
46
55
@@ -384,6 +393,45 @@ The following sub modules are optional and are provided as example or utility:
384
393
385
394
ARM64 configuration for submodules. When using the top level module configure `runner_architecture = "arm64"` and ensure the list of `instance_types` matches. When not using the top-level, ensure these properties are set on the submodules.
386
395
396
+
## Logging
397
+
398
+
The module uses [AWS Lambda Powertools](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/) for logging. By default the log level is set to `info`, by setting the leg level to `debug` the incoming event of the Lambda is logged as well.
399
+
400
+
Log messages contains at least the following keys:
401
+
402
+
-`messages`: The logged messages
403
+
-`environment`: The environment prefix provided via Terraform
404
+
-`service`: The lambda
405
+
-`module`: The TypeScript module writing the log message
406
+
-`function-name`: The name of the lambda function (prefix + function name)
407
+
-`github`: Depending on the lambda, contains GitHub context
408
+
-`runner`: Depending on the lambda, specific context related to the runner
In case the setup does not work as intended follow the trace of events:
@@ -492,7 +540,7 @@ We welcome any improvement to the standard module to make the default as secure
492
540
| <aname="input_lambda_security_group_ids"></a> [lambda\_security\_group\_ids](#input\_lambda\_security\_group\_ids)| List of security group IDs associated with the Lambda function. |`list(string)`|`[]`| no |
493
541
| <aname="input_lambda_subnet_ids"></a> [lambda\_subnet\_ids](#input\_lambda\_subnet\_ids)| List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. |`list(string)`|`[]`| no |
494
542
| <aname="input_log_level"></a> [log\_level](#input\_log\_level)| Logging level for lambda logging. Valid values are 'silly', 'trace', 'debug', 'info', 'warn', 'error', 'fatal'. |`string`|`"info"`| no |
495
-
| <aname="input_log_type"></a> [log\_type](#input\_log\_type)| Logging format for lambda logging. Valid values are 'json', 'pretty', 'hidden'. |`string`|`"pretty"`| no |
543
+
| <aname="input_log_type"></a> [log\_type](#input\_log\_type)| Logging format for lambda logging. Valid values are 'json', 'pretty', 'hidden'. |`string`|`null`| no |
496
544
| <aname="input_logging_kms_key_id"></a> [logging\_kms\_key\_id](#input\_logging\_kms\_key\_id)| Specifies the kms key id to encrypt the logs with |`string`|`null`| no |
497
545
| <aname="input_logging_retention_in_days"></a> [logging\_retention\_in\_days](#input\_logging\_retention\_in\_days)| Specifies the number of days you want to retain log events for the lambda log group. Possible values are: 0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653. |`number`|`180`| no |
498
546
| <aname="input_minimum_running_time_in_minutes"></a> [minimum\_running\_time\_in\_minutes](#input\_minimum\_running\_time\_in\_minutes)| The time an ec2 action runner should be running at minimum before terminated if not busy. |`number`|`null`| no |
@@ -742,4 +790,4 @@ Talk to the forestkeepers in the `runners`-channel on Slack.
0 commit comments