From 66b678830e54320a1c49fcb78f305624da2eb5d1 Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Sat, 23 Apr 2022 18:25:53 +0200 Subject: [PATCH] refactored pipeline to use anchores --- .drone.yml | 712 ++++++++++++++++++----------------------------------- 1 file changed, 237 insertions(+), 475 deletions(-) diff --git a/.drone.yml b/.drone.yml index c87868a..b82778b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,175 +7,97 @@ platform: os: linux arch: amd64 +when_ressource: &WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB + +settings_template: &SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + steps: - name: build-ubuntu-22 image: plugins/kaniko settings: dockerfile: ubuntu-22.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-22.04-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-ubuntu-20 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: ubuntu-20.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-20.04-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-ubuntu-18 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: ubuntu-18.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-18.04-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-ubuntu-16 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: ubuntu-16.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-16.04-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-ubuntu-14 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: ubuntu-14.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-14.04-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-debian-8 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: debian-8/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - debian-8-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-debian-9 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: debian-9/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - debian-9-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-debian-10 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: debian-10/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - debian-10-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV --- kind: pipeline @@ -186,133 +108,79 @@ platform: os: linux arch: amd64 +when_ressource: &WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB + +settings_template: &SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + steps: - name: build-fedora-34 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: fedora-34/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - fedora-34-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-fedora-35 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: fedora-35/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - fedora-35-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-fedora-36 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: fedora-36/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - fedora-36-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-fedora-37 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: fedora-37/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - fedora-37-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-almalinux-8 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: almalinux-8/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - almalinux-8-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-centos-7 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: centos-7/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - centos-7-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV --- kind: pipeline @@ -323,49 +191,43 @@ platform: os: linux arch: amd64 +when_ressource: &WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB + +settings_template: &SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + steps: - name: build-alpine-3-14 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: alpine-3.14/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - alpine-3.14-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV - name: build-alpine-3-15 - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: alpine-3.15/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - alpine-3.15-dev - when: - event: - - push - - pull_request - - cron - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_DEV --- kind: pipeline @@ -376,29 +238,35 @@ platform: os: linux arch: amd64 -steps: - -- name: build-arch - image: plugins/kaniko:1.4.1 - settings: - dockerfile: arch/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible - tags: - - arch-dev +when_ressource: &WHEN_TEMPLATE_DEV when: event: - - push - - pull_request - - cron + - push + - pull_request + - cron resources: limits: cpu: 200 memory: 1024MiB +settings_template: &SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + +steps: + +- name: build-arch + image: plugins/kaniko + settings: + dockerfile: arch/Dockerfile + <<: *SETTINGS_TEMPLATE + tags: + - arch-dev + <<: *WHEN_TEMPLATE_DEV + --- kind: pipeline type: kubernetes @@ -408,159 +276,95 @@ platform: os: linux arch: amd64 +when_ressource_tag: &WHEN_TEMPLATE_TAG + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + +settings_template: &SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + steps: - name: build-ubuntu-22-release image: plugins/kaniko settings: dockerfile: ubuntu-22.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-22.04 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-ubuntu-20-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: ubuntu-20.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-20.04 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-ubuntu-18-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: ubuntu-18.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-18.04 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-ubuntu-16-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: ubuntu-16.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-16.04 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-ubuntu-14-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: ubuntu-14.04/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - ubuntu-14.04 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-debian-8-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: debian-8/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - debian-8 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-debian-9-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: debian-9/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - debian-9 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-debian-10-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: debian-10/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - debian-10 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG --- kind: pipeline @@ -571,122 +375,78 @@ platform: os: linux arch: amd64 +when_ressource_tag: &WHEN_TEMPLATE_TAG + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + +settings_template: &SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + steps: - name: build-fedora-34-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: fedora-34/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - fedora-34 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-fedora-35-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: fedora-35/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - fedora-35 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-fedora-36-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: fedora-36/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - fedora-36 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-fedora-37-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: fedora-37/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - fedora-37 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-almalinux-8-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: almalinux-8/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - almalinux-8 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-centos-7-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: centos-7/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - centos-7 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG --- kind: pipeline @@ -697,51 +457,63 @@ platform: os: linux arch: amd64 +when_ressource_tag: &WHEN_TEMPLATE_TAG + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + +settings_template: &SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + steps: - name: build-alpine-3.14-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: alpine-3.14/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - alpine-3.14 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG - name: build-alpine-3.15-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: alpine-3.15/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - alpine-3.15 - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG --- kind: pipeline type: kubernetes name: release-arch +when_ressource_tag: &WHEN_TEMPLATE_TAG + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + +settings_template: &SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + platform: os: linux arch: amd64 @@ -749,23 +521,13 @@ platform: steps: - name: build-arch-release - image: plugins/kaniko:1.4.1 + image: plugins/kaniko settings: dockerfile: arch/Dockerfile - password: - from_secret: docker_password - username: - from_secret: docker_username - repo: lerentis/ansible + <<: *SETTINGS_TEMPLATE tags: - arch - when: - event: - - tag - resources: - limits: - cpu: 200 - memory: 1024MiB + <<: *WHEN_TEMPLATE_TAG --- kind: pipeline