woodpecker-ci / woodpecker

Woodpecker is a simple yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
3.88k stars 345 forks source link

Support specific arch pipelines #2492

Closed samip5 closed 9 months ago

samip5 commented 9 months ago

Clear and concise description of the problem

I need to be able to specify multiple pipelines that are only run on that specific architecture hardware as I have ARM64 and AMD64 agents.

Suggested solution

The solution should be to allow the following syntax in pipeline:

platform:
  os: linux
  arch: amd64

Alternative

Using Drone CI which supports this, but I'm not a fan.

Additional context

The following does work in Drone CI and I would love for it to be supported for Woodpecker too.

---
kind: pipeline
name: build-container-amd64

platform:
  os: linux
  arch: amd64

steps:
  - name: build-amd64
    image: plugins/docker
    settings:
      username:
        from_secret: HARBOR_USER
      password:
        from_secret: HARBOR_PASS
      registry:
        from_secret: REGISTRY
      repo: registry.<snip>.fi/ahmia/${CI_REPO_NAME}
      tags:
        - latest-amd64

---
kind: pipeline
name: build-container-arm64
type: docker

platform:
  os: linux
  arch: arm64

steps:
  - name: build-arm64
    image: plugins/docker
    settings:
      username:
        from_secret: HARBOR_USER
      password:
        from_secret: HARBOR_PASS
      registry:
        from_secret: REGISTRY
      repo: registry.<snip>.fi/ahmia/${CI_REPO_NAME}
      tags:
        - latest-arm64

---
kind: pipeline
name: docker-manifest

clone:
  disable: true

platform:
  os: linux
  arch: amd64

steps:
  - name: manifest
    image: plugins/manifest
    pull: always
    settings:
      username:
        from_secret: HARBOR_USER
      password:
        from_secret: HARBOR_PASS
      registry:
        from_secret: REGISTRY
      target: registry.<snip>.fi/ahmia/${CI_REPO_NAME}
      template: registry.<snip>.fi/ahmia/${CI_REPO_NAME}:latest-ARCH
      platforms:
        - linux/amd64
        - linux/arm64

depends_on:
  - build-container-arm64
  - build-container-amd64

Validations

qwerty287 commented 9 months ago

This is supported using labels: https://woodpecker-ci.org/docs/usage/pipeline-syntax#labels

There's also the platform key but it's deprecated and will be removed in next versions, so use labels instead (https://woodpecker-ci.org/docs/usage/pipeline-syntax#platform-1)

samip5 commented 9 months ago

Ah, so because I'm using next, the platform key doesn't get recognized anymore. I see. Closing this then. :)