Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/goapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ on:
type: string
default: ""
description: A comma separated list of Globs which triggers terraform ci
go-maxprocs:
type: number
default: 2
description: Set the GOMAXPROCS env to this value. Runners have 2 cpus for private repos and 4 for public repos
outputs:
oci-images:
value: ${{ jobs.goapp.outputs.oci-images }}
Expand Down Expand Up @@ -73,7 +77,7 @@ jobs:
name: Go application
needs: ["detect-changes"]
if: ${{ needs.detect-changes.outputs.golang == 'true' }}
uses: coopnorge/mage/.github/workflows/reusable-goapp.yaml@main
uses: coopnorge/mage/.github/workflows/reusable-goapp.yaml@update-go-app-workflow
permissions:
contents: read
id-token: write
Expand All @@ -84,12 +88,13 @@ jobs:
push-oci-image: ${{ inputs.push-oci-image }}
workload-identity-provider: ${{ inputs.workload-identity-provider }}
service-account: ${{ inputs.service-account }}
go-maxprocs: ${{ inputs.go-maxprocs }}

terraform:
name: Terraform
needs: ["detect-changes"]
if: ${{ needs.detect-changes.outputs.terraform == 'true' }}
uses: coopnorge/mage/.github/workflows/reusable-terraform.yaml@main
uses: coopnorge/mage/.github/workflows/reusable-terraform.yaml@update-go-app-workflow
permissions:
contents: read
pull-requests: write
Expand All @@ -99,3 +104,4 @@ jobs:
secrets: inherit
with:
dependabot-automerge-enabled: true
go-maxprocs: ${{ inputs.go-maxprocs }}
6 changes: 6 additions & 0 deletions .github/workflows/reusable-goapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ on:
type: string
default: "docker"
description: Run mage go related tasks in "docker" (default) or local
go-maxprocs:
type: number
default: 2
Copy link
Copy Markdown
Contributor

@alfredosa alfredosa Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AtzeDeVries maxprocs default is the maximum available cores or in 1.25 the cpu limits of the container:

https://go.dev/blog/container-aware-gomaxprocs

We want Go to provide efficient and reliable defaults when possible, so in Go 1.25, we have made GOMAXPROCS take into account its container environment by default. If a Go process is running inside a container with a CPU limit, GOMAXPROCS will default to the CPU limit if it is less than the core count.

Container orchestration systems may adjust container CPU limits on the fly, so Go 1.25 will also periodically check the CPU limit and adjust GOMAXPROCS automatically if it changes.

Both of these defaults only apply if GOMAXPROCS is otherwise unspecified. Setting the GOMAXPROCS environment variable or calling runtime.GOMAXPROCS continues to behave as before. The runtime.GOMAXPROCS documentation covers the details of the new behavior.

I think this might introduce a potential reduction in performance by defaulting to 2. Do we have to provide a default?

tho in ci/cd it might not be a big deal but in a test suite it might cause unexpected delays

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: “core” more precisely means “logical CPU.” (Also scavanged from the post for visibility)

description: Set the GOMAXPROCS env to this value. Runners have 2 cpus for private repos and 4 for public repos

outputs:
oci-images:
value: ${{ jobs.mage.outputs.oci-images }}
Expand Down Expand Up @@ -89,6 +94,7 @@ jobs:
OCI_IMAGE_BASE: ${{ inputs.oci-image-base }}
PUSH_IMAGE: ${{ inputs.push-oci-image }}
GO_RUNTIME: ${{ inputs.go-runtime }}
GOMAXPROCS: ${{ inputs.go-maxprocs }}
- id: oci-images
name: Output OCI images references
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/reusable-terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ on:
default: false
description: |
Only run validation and skip spacelift checks
go-maxprocs:
type: number
default: 2
description: Set the GOMAXPROCS env to this value. Runners have 2 cpus for private repos and 4 for public repos
secrets: {}

jobs:
Expand Down Expand Up @@ -71,6 +75,8 @@ jobs:
- name: Code Validation
id: validate
run: go tool mage terraform:validate
env:
GOMAXPROCS: ${{ inputs.go-maxprocs }}

- name: Cleanup
if: always()
Expand Down
Loading