mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-22 14:16:18 +00:00
declare different when statements once and reuse them (#3176)
This commit is contained in:
parent
9bbba4441d
commit
a53fe5c0ab
1 changed files with 30 additions and 58 deletions
|
@ -3,6 +3,7 @@ when:
|
|||
- event: push
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
- release/*
|
||||
- renovate/*
|
||||
|
||||
depends_on:
|
||||
|
@ -60,6 +61,7 @@ steps:
|
|||
path: *when_path
|
||||
- branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
- release/*
|
||||
- renovate/*
|
||||
event: [push, tag]
|
||||
path: *when_path
|
||||
|
@ -81,6 +83,7 @@ steps:
|
|||
path: *when_path
|
||||
- branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
- release/*
|
||||
- renovate/*
|
||||
event: [push, tag]
|
||||
path: *when_path
|
||||
|
@ -105,8 +108,10 @@ steps:
|
|||
- event: pull_request
|
||||
path: *when_path
|
||||
- event: push
|
||||
branch: renovate/*
|
||||
path: *when_path
|
||||
branch:
|
||||
- release/*
|
||||
- renovate/*
|
||||
|
||||
cross-compile-server:
|
||||
depends_on:
|
||||
|
@ -138,7 +143,7 @@ steps:
|
|||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
logins: *publish_logins
|
||||
when:
|
||||
when: &when-preview
|
||||
evaluate: 'CI_COMMIT_PULL_REQUEST_LABELS contains "build_pr_images"'
|
||||
event: pull_request
|
||||
|
||||
|
@ -152,11 +157,9 @@ steps:
|
|||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}-alpine
|
||||
logins: *publish_logins
|
||||
when:
|
||||
evaluate: 'CI_COMMIT_PULL_REQUEST_LABELS contains "build_pr_images"'
|
||||
event: pull_request
|
||||
when: *when-preview
|
||||
|
||||
build-server:
|
||||
build-server-dryrun:
|
||||
depends_on:
|
||||
- vendor
|
||||
- build-web
|
||||
|
@ -168,13 +171,15 @@ steps:
|
|||
dockerfile: docker/Dockerfile.server.multiarch
|
||||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
when:
|
||||
when: &when-dryrun
|
||||
- evaluate: 'not (CI_COMMIT_PULL_REQUEST_LABELS contains "build_pr_images")'
|
||||
event: pull_request
|
||||
path: *when_path
|
||||
- event: push
|
||||
branch: renovate/*
|
||||
path: *when_path
|
||||
branch:
|
||||
- release/*
|
||||
- renovate/*
|
||||
|
||||
publish-next-server:
|
||||
depends_on:
|
||||
|
@ -186,7 +191,7 @@ steps:
|
|||
platforms: *platforms_server
|
||||
tag: [next, 'next-${CI_COMMIT_SHA:0:10}']
|
||||
logins: *publish_logins
|
||||
when:
|
||||
when: &when-publish-next
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
path: *when_path
|
||||
|
@ -201,10 +206,7 @@ steps:
|
|||
platforms: *platforms_alpine
|
||||
tag: [next-alpine, 'next-${CI_COMMIT_SHA:0:10}-alpine']
|
||||
logins: *publish_logins
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
path: *when_path
|
||||
when: *when-publish-next
|
||||
|
||||
release-server:
|
||||
depends_on:
|
||||
|
@ -217,7 +219,7 @@ steps:
|
|||
# remove 'latest' on older version branches to avoid accidental downgrade
|
||||
tag: [latest, '${CI_COMMIT_TAG}']
|
||||
logins: *publish_logins
|
||||
when:
|
||||
when: &when-release
|
||||
event: tag
|
||||
|
||||
release-server-alpine:
|
||||
|
@ -231,8 +233,7 @@ steps:
|
|||
# remove 'latest-alpine' on older version branches to avoid accidental downgrade
|
||||
tag: [latest-alpine, '${CI_COMMIT_TAG}-alpine']
|
||||
logins: *publish_logins
|
||||
when:
|
||||
event: tag
|
||||
when: *when-release
|
||||
|
||||
#############
|
||||
# A g e n t #
|
||||
|
@ -249,11 +250,9 @@ steps:
|
|||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
build_args: *build_args
|
||||
logins: *publish_logins
|
||||
when:
|
||||
evaluate: 'CI_COMMIT_PULL_REQUEST_LABELS contains "build_pr_images"'
|
||||
event: pull_request
|
||||
when: *when-preview
|
||||
|
||||
build-agent:
|
||||
build-agent-dryrun:
|
||||
depends_on:
|
||||
- vendor
|
||||
image: *buildx_plugin
|
||||
|
@ -264,13 +263,7 @@ steps:
|
|||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
build_args: *build_args
|
||||
when:
|
||||
- evaluate: 'not (CI_COMMIT_PULL_REQUEST_LABELS contains "build_pr_images")'
|
||||
event: pull_request
|
||||
path: *when_path
|
||||
- event: push
|
||||
branch: renovate/*
|
||||
path: *when_path
|
||||
when: *when-dryrun
|
||||
|
||||
publish-next-agent:
|
||||
depends_on:
|
||||
|
@ -305,10 +298,7 @@ steps:
|
|||
tag: [next-alpine, 'next-${CI_COMMIT_SHA:0:10}-alpine']
|
||||
logins: *publish_logins
|
||||
build_args: *build_args
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
path: *when_path
|
||||
when: *when-publish-next
|
||||
|
||||
release-agent:
|
||||
depends_on:
|
||||
|
@ -325,8 +315,7 @@ steps:
|
|||
tag: [latest, '${CI_COMMIT_TAG}']
|
||||
logins: *publish_logins
|
||||
build_args: *build_args
|
||||
when:
|
||||
event: tag
|
||||
when: *when-release
|
||||
|
||||
release-agent-alpine:
|
||||
depends_on:
|
||||
|
@ -343,8 +332,7 @@ steps:
|
|||
tag: [latest-alpine, '${CI_COMMIT_TAG}-alpine']
|
||||
logins: *publish_logins
|
||||
build_args: *build_args
|
||||
when:
|
||||
event: tag
|
||||
when: *when-release
|
||||
|
||||
#########
|
||||
# C L I #
|
||||
|
@ -361,11 +349,9 @@ steps:
|
|||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
build_args: *build_args
|
||||
logins: *publish_logins
|
||||
when:
|
||||
evaluate: 'CI_COMMIT_PULL_REQUEST_LABELS contains "build_pr_images"'
|
||||
event: pull_request
|
||||
when: *when-preview
|
||||
|
||||
build-cli:
|
||||
build-cli-dryrun:
|
||||
depends_on:
|
||||
- vendor
|
||||
image: *buildx_plugin
|
||||
|
@ -376,13 +362,7 @@ steps:
|
|||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
build_args: *build_args
|
||||
when:
|
||||
- evaluate: 'not (CI_COMMIT_PULL_REQUEST_LABELS contains "build_pr_images")'
|
||||
event: pull_request
|
||||
path: *when_path
|
||||
- event: push
|
||||
branch: renovate/*
|
||||
path: *when_path
|
||||
when: *when-dryrun
|
||||
|
||||
publish-next-cli:
|
||||
depends_on:
|
||||
|
@ -398,10 +378,7 @@ steps:
|
|||
tag: [next, 'next-${CI_COMMIT_SHA:0:10}']
|
||||
logins: *publish_logins
|
||||
build_args: *build_args
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
path: *when_path
|
||||
when: *when-publish-next
|
||||
|
||||
publish-next-cli-alpine:
|
||||
depends_on:
|
||||
|
@ -417,10 +394,7 @@ steps:
|
|||
tag: [next-alpine, 'next-${CI_COMMIT_SHA:0:10}-alpine']
|
||||
logins: *publish_logins
|
||||
build_args: *build_args
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
path: *when_path
|
||||
when: *when-publish-next
|
||||
|
||||
release-cli:
|
||||
depends_on:
|
||||
|
@ -437,8 +411,7 @@ steps:
|
|||
tag: [latest, '${CI_COMMIT_TAG}']
|
||||
logins: *publish_logins
|
||||
build_args: *build_args
|
||||
when:
|
||||
event: tag
|
||||
when: *when-release
|
||||
|
||||
release-cli-alpine:
|
||||
depends_on:
|
||||
|
@ -455,5 +428,4 @@ steps:
|
|||
tag: [latest-alpine, '${CI_COMMIT_TAG}-alpine']
|
||||
logins: *publish_logins
|
||||
build_args: *build_args
|
||||
when:
|
||||
event: tag
|
||||
when: *when-release
|
||||
|
|
Loading…
Reference in a new issue