use yaml alias and adjust build targets for docker images (#1143)

- use yaml alias for plaftorms settings
- add linux/s390x for agent/cli release
- add linux/riscv64
- remove darwin as mac use linux in hypervisor for docker
This commit is contained in:
6543 2022-08-31 16:27:06 +02:00 committed by GitHub
parent 4e38a55c31
commit 65587e3e30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 24 deletions

View file

@ -7,10 +7,15 @@ variables:
- &node_image 'node:16-alpine' - &node_image 'node:16-alpine'
- &xgo_image 'techknowlogick/xgo:go-1.18.x' - &xgo_image 'techknowlogick/xgo:go-1.18.x'
- &xgo_version 'go-1.18.x' - &xgo_version 'go-1.18.x'
- &platforms_release 'linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/386,linux/amd64,linux/ppc64le,linux/riscv64,linux/s390x,windows/amd64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64'
- &platforms_server 'linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,linux/riscv64'
- &platforms_preview 'linux/arm/v6,linux/arm64/v8,linux/amd64,linux/riscv64,windows/amd64'
- &platforms_alpine 'linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le'
pipeline: pipeline:
vendor: vendor:
image: *golang_image image: *golang_image
pull: true
commands: commands:
- go mod vendor - go mod vendor
@ -26,12 +31,13 @@ pipeline:
cross-compile-server: cross-compile-server:
image: *xgo_image image: *xgo_image
pull: true
commands: commands:
- apt update - apt update
- apt install -y tree - apt install -y tree
- make cross-compile-server - make cross-compile-server
environment: environment:
PLATFORMS: linux|arm/v7;linux|arm64/v8;linux|amd64;linux|ppc64le PLATFORMS: linux|arm/v7;linux|arm64/v8;linux|amd64;linux|ppc64le;linux|riscv64
TAGS: bindata sqlite sqlite_unlock_notify TAGS: bindata sqlite sqlite_unlock_notify
XGO_VERSION: *xgo_version XGO_VERSION: *xgo_version
@ -42,7 +48,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-server repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.multiarch dockerfile: docker/Dockerfile.server.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_server
tag: pull_${CI_COMMIT_PULL_REQUEST} tag: pull_${CI_COMMIT_PULL_REQUEST}
when: when:
event: pull_request event: pull_request
@ -54,7 +60,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-server repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine.multiarch dockerfile: docker/Dockerfile.server.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
tag: pull_${CI_COMMIT_PULL_REQUEST}-alpine tag: pull_${CI_COMMIT_PULL_REQUEST}-alpine
when: when:
event: pull_request event: pull_request
@ -66,7 +72,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-server repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.multiarch dockerfile: docker/Dockerfile.server.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_server
tag: next tag: next
when: when:
branch: ${CI_REPO_DEFAULT_BRANCH} branch: ${CI_REPO_DEFAULT_BRANCH}
@ -79,7 +85,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-server repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine.multiarch dockerfile: docker/Dockerfile.server.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
tag: next-alpine tag: next-alpine
when: when:
branch: ${CI_REPO_DEFAULT_BRANCH} branch: ${CI_REPO_DEFAULT_BRANCH}
@ -92,7 +98,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-server repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.multiarch dockerfile: docker/Dockerfile.server.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_server
tag: ${CI_COMMIT_BRANCH##release/} tag: ${CI_COMMIT_BRANCH##release/}
when: when:
branch: release/* branch: release/*
@ -105,7 +111,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-server repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine.multiarch dockerfile: docker/Dockerfile.server.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
tag: ${CI_COMMIT_BRANCH##release/} tag: ${CI_COMMIT_BRANCH##release/}
when: when:
branch: release/* branch: release/*
@ -118,7 +124,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-server repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.multiarch dockerfile: docker/Dockerfile.server.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_server
# remove 'latest' on older version branches to avoid accidental downgrade # remove 'latest' on older version branches to avoid accidental downgrade
tag: [latest, "${CI_COMMIT_TAG}"] tag: [latest, "${CI_COMMIT_TAG}"]
when: when:
@ -131,7 +137,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-server repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine.multiarch dockerfile: docker/Dockerfile.server.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
# remove 'latest-alpine' on older version branches to avoid accidental downgrade # remove 'latest-alpine' on older version branches to avoid accidental downgrade
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"] tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
when: when:
@ -148,7 +154,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-agent repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.multiarch dockerfile: docker/Dockerfile.agent.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64 platforms: *platforms_preview
tag: pull_${CI_COMMIT_PULL_REQUEST} tag: pull_${CI_COMMIT_PULL_REQUEST}
when: when:
event: pull_request event: pull_request
@ -160,7 +166,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-agent repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.multiarch dockerfile: docker/Dockerfile.agent.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64 platforms: *platforms_release
tag: next tag: next
when: when:
branch: ${CI_REPO_DEFAULT_BRANCH} branch: ${CI_REPO_DEFAULT_BRANCH}
@ -173,7 +179,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-agent repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.alpine.multiarch dockerfile: docker/Dockerfile.agent.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
tag: next-alpine tag: next-alpine
when: when:
branch: ${CI_REPO_DEFAULT_BRANCH} branch: ${CI_REPO_DEFAULT_BRANCH}
@ -186,7 +192,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-agent repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.multiarch dockerfile: docker/Dockerfile.agent.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64 platforms: *platforms_release
tag: ${CI_COMMIT_BRANCH##release/} tag: ${CI_COMMIT_BRANCH##release/}
when: when:
branch: release/* branch: release/*
@ -199,7 +205,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-agent repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.alpine.multiarch dockerfile: docker/Dockerfile.agent.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
tag: ${CI_COMMIT_BRANCH##release/} tag: ${CI_COMMIT_BRANCH##release/}
when: when:
branch: release/* branch: release/*
@ -212,7 +218,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-agent repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.multiarch dockerfile: docker/Dockerfile.agent.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64 platforms: *platforms_release
# remove 'latest' on older version branches to avoid accidental downgrade # remove 'latest' on older version branches to avoid accidental downgrade
tag: [latest, "${CI_COMMIT_TAG}"] tag: [latest, "${CI_COMMIT_TAG}"]
when: when:
@ -225,7 +231,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-agent repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.alpine.multiarch dockerfile: docker/Dockerfile.agent.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
# remove 'latest-alpine' on older version branches to avoid accidental downgrade # remove 'latest-alpine' on older version branches to avoid accidental downgrade
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"] tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
when: when:
@ -242,7 +248,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-cli repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.multiarch dockerfile: docker/Dockerfile.cli.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64 platforms: *platforms_preview
tag: pull_${CI_COMMIT_PULL_REQUEST} tag: pull_${CI_COMMIT_PULL_REQUEST}
when: when:
event: pull_request event: pull_request
@ -254,7 +260,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-cli repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.multiarch dockerfile: docker/Dockerfile.cli.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64 platforms: *platforms_release
tag: next tag: next
when: when:
branch: ${CI_REPO_DEFAULT_BRANCH} branch: ${CI_REPO_DEFAULT_BRANCH}
@ -267,7 +273,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-cli repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.alpine.multiarch dockerfile: docker/Dockerfile.cli.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
tag: next-alpine tag: next-alpine
when: when:
branch: ${CI_REPO_DEFAULT_BRANCH} branch: ${CI_REPO_DEFAULT_BRANCH}
@ -280,7 +286,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-cli repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.multiarch dockerfile: docker/Dockerfile.cli.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64 platforms: *platforms_release
tag: ${CI_COMMIT_BRANCH##release/} tag: ${CI_COMMIT_BRANCH##release/}
when: when:
branch: release/* branch: release/*
@ -293,7 +299,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-cli repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.alpine.multiarch dockerfile: docker/Dockerfile.cli.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
tag: ${CI_COMMIT_BRANCH##release/} tag: ${CI_COMMIT_BRANCH##release/}
when: when:
branch: release/* branch: release/*
@ -306,7 +312,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-cli repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.multiarch dockerfile: docker/Dockerfile.cli.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64 platforms: *platforms_release
# remove 'latest' on older version branches to avoid accidental downgrade # remove 'latest' on older version branches to avoid accidental downgrade
tag: [latest, "${CI_COMMIT_TAG}"] tag: [latest, "${CI_COMMIT_TAG}"]
when: when:
@ -319,7 +325,7 @@ pipeline:
settings: settings:
repo: woodpeckerci/woodpecker-cli repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.alpine.multiarch dockerfile: docker/Dockerfile.cli.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le platforms: *platforms_alpine
# remove 'latest-alpine' on older version branches to avoid accidental downgrade # remove 'latest-alpine' on older version branches to avoid accidental downgrade
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"] tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
when: when:

View file

@ -1,4 +1,4 @@
FROM golang:1.18 AS certs FROM --platform=$BUILDPLATFORM golang:1.18 AS certs
FROM scratch FROM scratch
ARG TARGETOS TARGETARCH ARG TARGETOS TARGETARCH