From 1d876dc0bb1299c65afebb340fdc23d72078b633 Mon Sep 17 00:00:00 2001 From: Jesper Terkelsen Date: Sat, 2 May 2026 01:42:59 +0200 Subject: [PATCH] ci: add optional openapi-max-workers input to component-service-profile-kotlin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a new opt-in input that maps to ./gradlew --max-workers= for the OpenAPI build step only. Defaults to empty (existing behavior unchanged for all repos that don't set it). Motivation: monta-app/service-api-gateways has been failing every recent production deploy in this exact step (runs 25171374143, 25236336830, 25236336844). The pattern is identical: SIGTERM + exit 143 ~50s after `portal-api:kaptKotlin` starts while several other modules' kaptKotlin tasks run concurrently. Each kapt worker JVM uses ~4GB heap; with 4–8 in flight on a linux-arm64 runner, the kernel OOM-kills mid-build. Caller-side change in service-api-gateways will pass `openapi-max-workers: '2'` to opt in. Other repos using this workflow (single-module Micronaut services) keep full parallelism — they don't have the contention to begin with. The input is named for the step it scopes to (Build OpenAPI spec), not "gradle-max-workers", because it doesn't affect any other gradle invocations in this workflow or anywhere else. --- .../component-service-profile-kotlin.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/component-service-profile-kotlin.yml b/.github/workflows/component-service-profile-kotlin.yml index 8e13ce6..98b82a5 100644 --- a/.github/workflows/component-service-profile-kotlin.yml +++ b/.github/workflows/component-service-profile-kotlin.yml @@ -24,6 +24,16 @@ on: default: 'service-profile.yml' type: string description: 'File name for the service profile in the `templates` directory' + openapi-max-workers: + required: false + type: string + default: '' + description: | + Optional cap on Gradle parallelism for the OpenAPI build step. + Each kapt worker uses ~4GB heap; on multi-module repos the + default parallelism (Runtime.availableProcessors()) can OOM the + runner. Set to e.g. "2" to cap concurrent kapt JVMs. Empty + string keeps the default behavior unchanged. secrets: GHL_USERNAME: required: false @@ -78,8 +88,13 @@ jobs: env: GHL_USERNAME: ${{ secrets.GHL_USERNAME }} GHL_PASSWORD: ${{ secrets.GHL_PASSWORD }} + OPENAPI_MAX_WORKERS: ${{ inputs.openapi-max-workers }} run: | - ./gradlew "$GRADLE_TASK" + if [ -n "$OPENAPI_MAX_WORKERS" ]; then + ./gradlew --max-workers="$OPENAPI_MAX_WORKERS" "$GRADLE_TASK" + else + ./gradlew "$GRADLE_TASK" + fi - name: Generate service profile shell: bash run: |