From 570949a55a1b2f702e1d58c74533ddc86174ef8d Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Thu, 7 Oct 2021 18:05:00 +0200 Subject: [PATCH] fix: Upgrade lambda runtime to node 14.x (#1203) * Bump node from 12.x to 14.x for lambdas Co-authored-by: Niek Palm * set node version in .nvmrc to 14 * upgrade terraform version as required by module Co-authored-by: Niek Palm Co-authored-by: Niek Palm --- .ci/Dockerfile | 2 +- .../lambda-runner-binaries-syncer.yml | 2 +- .github/workflows/lambda-runners.yml | 2 +- .github/workflows/lambda-webhook.yml | 2 +- .github/workflows/release.yml | 8 +++--- examples/default/.terraform.lock.hcl | 27 ++++++++++--------- examples/default/versions.tf | 2 +- examples/permissions-boundary/providers.tf | 2 +- examples/ubuntu/providers.tf | 2 +- .../lambdas/runner-binaries-syncer/.nvmrc | 2 +- .../runner-binaries-syncer.tf | 2 +- modules/runner-binaries-syncer/versions.tf | 8 ++++++ modules/runners/scale-down.tf | 2 +- modules/runners/scale-up.tf | 2 +- modules/runners/versions.tf | 8 ++++++ modules/webhook/lambdas/webhook/.nvmrc | 2 +- modules/webhook/versions.tf | 8 ++++++ modules/webhook/webhook.tf | 2 +- 18 files changed, 55 insertions(+), 30 deletions(-) create mode 100644 modules/runner-binaries-syncer/versions.tf create mode 100644 modules/runners/versions.tf create mode 100644 modules/webhook/versions.tf diff --git a/.ci/Dockerfile b/.ci/Dockerfile index d8b2f3853a..dc8b447763 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -1,5 +1,5 @@ #syntax=docker/dockerfile:1.2 -FROM node:12 as build +FROM node:14 as build WORKDIR /lambda RUN apt-get update \ && apt-get install -y zip \ diff --git a/.github/workflows/lambda-runner-binaries-syncer.yml b/.github/workflows/lambda-runner-binaries-syncer.yml index 241bf9dec6..0cdf43cb41 100644 --- a/.github/workflows/lambda-runner-binaries-syncer.yml +++ b/.github/workflows/lambda-runner-binaries-syncer.yml @@ -14,7 +14,7 @@ on: jobs: build: runs-on: ubuntu-latest - container: node:12 + container: node:14 defaults: run: working-directory: ${{ env.lambda_path }} diff --git a/.github/workflows/lambda-runners.yml b/.github/workflows/lambda-runners.yml index f7b2a15be7..6aeca6685e 100644 --- a/.github/workflows/lambda-runners.yml +++ b/.github/workflows/lambda-runners.yml @@ -11,7 +11,7 @@ on: jobs: build: runs-on: ubuntu-latest - container: node:12 + container: node:14 defaults: run: working-directory: modules/runners/lambdas/runners diff --git a/.github/workflows/lambda-webhook.yml b/.github/workflows/lambda-webhook.yml index 9cef0f4494..7f99155dd7 100644 --- a/.github/workflows/lambda-webhook.yml +++ b/.github/workflows/lambda-webhook.yml @@ -11,7 +11,7 @@ on: jobs: build: runs-on: ubuntu-latest - container: node:12 + container: node:14 defaults: run: working-directory: modules/webhook/lambdas/webhook diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 617a1cd354..2242c91742 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,9 +10,9 @@ jobs: prepare: name: Create dist runs-on: ubuntu-latest - container: node:12 + container: node:14 strategy: - matrix: + matrix: lambda: ["modules/webhook/lambdas/webhook", "modules/runner-binaries-syncer/lambdas/runner-binaries-syncer", "modules/runners/lambdas/runners"] steps: - name: Extract lambda name @@ -64,14 +64,14 @@ jobs: appInstallationValue: ${{ github.repository }} - name: Dry run release - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Read only token run: | cp .release/* . yarn yarn release -d --repositoryUrl https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git - + - name: Release if: github.event_name != 'pull_request' && contains('refs/heads/master', github.ref) env: diff --git a/examples/default/.terraform.lock.hcl b/examples/default/.terraform.lock.hcl index 150b194cfd..d940521fcb 100644 --- a/examples/default/.terraform.lock.hcl +++ b/examples/default/.terraform.lock.hcl @@ -2,20 +2,21 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "3.20.0" - constraints = "3.20.0" + version = "3.61.0" + constraints = ">= 3.27.0" hashes = [ - "h1:Wk7JYiEIslHQorVPWnofRNYUAjyro6IehY/d/Yfmbr8=", - "zh:1b53d410c21332750be561092d412d83014fa0656e00f940944d2e7b07b1b9ec", - "zh:307bf780790462fe547fe23f8e38a4c178437f3a9dd725f9aa63c6d8c6cbf25d", - "zh:5818a978b9766b23a190716b85aad3a4731d33ddb8a81080cf3ef6e4bd68a003", - "zh:5f68eb4779208e21d9657b9ff492aa5f6496efea7994bdec1d302f88b0b65f34", - "zh:6028208a7b3738801cd9f3376efa40a1e55f4bb8184584f7387b08c054e43c4c", - "zh:8130269e2d8c80ea9136dcd26cfeb4e1fac83bda4aab0db70f36651a7b22365d", - "zh:9dd4a07beb89606e051b64ab05d75e1c1616389871a55065676b370aebaed8e5", - "zh:b7194500db431ba862ea8008db56a5decececda1f904ed8842d2b0f1a04eea9d", - "zh:ec214b7341137e6dd47754b843ed16fe3e1d32832537042ee81a64a3ccdbb4bd", - "zh:ec2973e04f3cb853895e51f6ec56660574610b860ee3de669ccbb1f04d1089c9", + "h1:fpZ14qQnn+uEOO2ZOlBFHgty48Ol8IOwd+ewxZ4z3zc=", + "zh:0483ca802ddb0ae4f73144b4357ba72242c6e2641aeb460b1aa9a6f6965464b0", + "zh:274712214ebeb0c1269cbc468e5705bb5741dc45b05c05e9793ca97f22a1baa1", + "zh:3c6bd97a2ca809469ae38f6893348386c476cb3065b120b785353c1507401adf", + "zh:53dd41a9aed9860adbbeeb71a23e4f8195c656fd15a02c90fa2d302a5f577d8c", + "zh:65c639c547b97bc880fd83e65511c0f4bbfc91b63cada3b8c0d5776444221700", + "zh:a2769e19137ff480c1dd3e4f248e832df90fb6930a22c66264d9793895161714", + "zh:a5897a99332cc0071e46a71359b86a8e53ab09c1453e94cd7cf45a0b577ff590", + "zh:bdc2353642d16d8e2437a9015cd4216a1772be9736645cc17d1a197480e2b5b7", + "zh:cbeace1deae938f6c0aca3734e6088f3633ca09611aff701c15cb6d42f2b918a", + "zh:d33ca19012aabd98cc03fdeccd0bd5ce56e28f61a1dfbb2eea88e89487de7fb3", + "zh:d548b29a864b0687e85e8a993f208e25e3ecc40fcc5b671e1985754b32fdd658", ] } diff --git a/examples/default/versions.tf b/examples/default/versions.tf index 508ecd2afa..c96d0eee84 100644 --- a/examples/default/versions.tf +++ b/examples/default/versions.tf @@ -2,7 +2,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 3.20" + version = ">= 3.27" } local = { source = "hashicorp/local" diff --git a/examples/permissions-boundary/providers.tf b/examples/permissions-boundary/providers.tf index 4567f85f87..3e90f57342 100644 --- a/examples/permissions-boundary/providers.tf +++ b/examples/permissions-boundary/providers.tf @@ -1,7 +1,7 @@ provider "aws" { alias = "terraform_role" region = local.aws_region - version = "3.20" + version = "3.60" assume_role { role_arn = data.terraform_remote_state.iam.outputs.role } diff --git a/examples/ubuntu/providers.tf b/examples/ubuntu/providers.tf index 5e0aedc8fe..ed0297a443 100644 --- a/examples/ubuntu/providers.tf +++ b/examples/ubuntu/providers.tf @@ -1,7 +1,7 @@ terraform { required_providers { aws = { - version = "3.20" + version = "3.27" } random = { version = "3.1.0" diff --git a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/.nvmrc b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/.nvmrc index 59db31cba0..ca3f1e5c83 100644 --- a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/.nvmrc +++ b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/.nvmrc @@ -1 +1 @@ -v12.16.1 +v14 \ No newline at end of file diff --git a/modules/runner-binaries-syncer/runner-binaries-syncer.tf b/modules/runner-binaries-syncer/runner-binaries-syncer.tf index e57dfc0c4f..4dfd726f4d 100644 --- a/modules/runner-binaries-syncer/runner-binaries-syncer.tf +++ b/modules/runner-binaries-syncer/runner-binaries-syncer.tf @@ -12,7 +12,7 @@ resource "aws_lambda_function" "syncer" { function_name = "${var.environment}-syncer" role = aws_iam_role.syncer_lambda.arn handler = "index.handler" - runtime = "nodejs12.x" + runtime = "nodejs14.x" timeout = var.lambda_timeout memory_size = 256 diff --git a/modules/runner-binaries-syncer/versions.tf b/modules/runner-binaries-syncer/versions.tf new file mode 100644 index 0000000000..76a0a5101f --- /dev/null +++ b/modules/runner-binaries-syncer/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + aws = { + source = "aws" + version = ">=3.27" + } + } +} diff --git a/modules/runners/scale-down.tf b/modules/runners/scale-down.tf index 406abe5d6f..88e68cb446 100644 --- a/modules/runners/scale-down.tf +++ b/modules/runners/scale-down.tf @@ -7,7 +7,7 @@ resource "aws_lambda_function" "scale_down" { function_name = "${var.environment}-scale-down" role = aws_iam_role.scale_down.arn handler = "index.scaleDown" - runtime = "nodejs12.x" + runtime = "nodejs14.x" timeout = var.lambda_timeout_scale_down tags = local.tags diff --git a/modules/runners/scale-up.tf b/modules/runners/scale-up.tf index 435294e29b..32457bed2e 100644 --- a/modules/runners/scale-up.tf +++ b/modules/runners/scale-up.tf @@ -7,7 +7,7 @@ resource "aws_lambda_function" "scale_up" { function_name = "${var.environment}-scale-up" role = aws_iam_role.scale_up.arn handler = "index.scaleUp" - runtime = "nodejs12.x" + runtime = "nodejs14.x" timeout = var.lambda_timeout_scale_up reserved_concurrent_executions = 1 tags = local.tags diff --git a/modules/runners/versions.tf b/modules/runners/versions.tf new file mode 100644 index 0000000000..76a0a5101f --- /dev/null +++ b/modules/runners/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + aws = { + source = "aws" + version = ">=3.27" + } + } +} diff --git a/modules/webhook/lambdas/webhook/.nvmrc b/modules/webhook/lambdas/webhook/.nvmrc index 59db31cba0..ca3f1e5c83 100644 --- a/modules/webhook/lambdas/webhook/.nvmrc +++ b/modules/webhook/lambdas/webhook/.nvmrc @@ -1 +1 @@ -v12.16.1 +v14 \ No newline at end of file diff --git a/modules/webhook/versions.tf b/modules/webhook/versions.tf new file mode 100644 index 0000000000..76a0a5101f --- /dev/null +++ b/modules/webhook/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + aws = { + source = "aws" + version = ">=3.27" + } + } +} diff --git a/modules/webhook/webhook.tf b/modules/webhook/webhook.tf index 5e7b8373cf..9f48a8980f 100644 --- a/modules/webhook/webhook.tf +++ b/modules/webhook/webhook.tf @@ -7,7 +7,7 @@ resource "aws_lambda_function" "webhook" { function_name = "${var.environment}-webhook" role = aws_iam_role.webhook_lambda.arn handler = "index.githubWebhook" - runtime = "nodejs12.x" + runtime = "nodejs14.x" timeout = var.lambda_timeout environment {