Skip to content

Node Selector assigns wrong architecture for builds #2505

@pat-s

Description

@pat-s

Component

agent

Describe the bug

Recently, I am seeing builds being assigned to the wrong nodes on our cluster.
Inspecting the pods, I can see that the platform env, which comes from the matrix definition, is set to amd64. However, the nodeSelector is set to arm64 instead.

Environment:
  platform:                        linux/amd64 

[...]

Node-Selectors:              kubernetes.io/arch=arm64 

The WF definition is as follows

platform: ${platform}

matrix:
  include:
    - DISTRIBUTION: ubuntu
      RELEASE: focal
      OS_RELEASE: 20.04
      platform: linux/amd64
    - DISTRIBUTION: ubuntu
      RELEASE: jammy
      OS_RELEASE: 22.04
      platform: linux/amd64
    - DISTRIBUTION: redhat/ubi8-minimal
      RELEASE: latest
      platform: linux/amd64
      OS_RELEASE: rhel8
    - DISTRIBUTION: redhat/ubi9-minimal
      RELEASE: latest
      platform: linux/amd64
      OS_RELEASE: rhel9

Could it be that #2048 changed the logic in a way that nodeSelector is always set to CI_SYSTEM_PLATFORM and does not honor platform env anymore?

platform, exist := step.Environment["CI_SYSTEM_PLATFORM"]

Or maybe one of the changes within the recent months caused this behavior?
Tagging @6543 and @zc-devs as you both did modifications in this area lately.

I am not having enough experience in GO to make an educated judgement right now - all I can see is that CI_SYSTEM_PLATFORM is not honoring platform env and therefore the nodeSelector is wrong in the end :)

System Info

`next-f8e91f00aa`

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Checked that the bug isn't fixed in the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
  • Check that this is a concrete bug. For Q&A join our Discord Chat Server or the Matrix room.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions