Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

declare different when statements once and reuse them #3176

Merged
merged 1 commit into from
Jan 12, 2024
Merged
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
88 changes: 30 additions & 58 deletions .woodpecker/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ when:
- event: push
branch:
- ${CI_REPO_DEFAULT_BRANCH}
- release/*
- renovate/*

depends_on:
Expand Down Expand Up @@ -60,6 +61,7 @@ steps:
path: *when_path
- branch:
- ${CI_REPO_DEFAULT_BRANCH}
- release/*
- renovate/*
event: [push, tag]
path: *when_path
Expand All @@ -81,6 +83,7 @@ steps:
path: *when_path
- branch:
- ${CI_REPO_DEFAULT_BRANCH}
- release/*
- renovate/*
event: [push, tag]
path: *when_path
Expand All @@ -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:
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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 #
Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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 #
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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