From f719b7ade32fe74844c6c1aebb08cdcd09d8b177 Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Sat, 23 Apr 2022 19:06:25 +0200 Subject: [PATCH] fuck starlark and jsonet. jinja it is --- .drone.jsonnet | 44 --- .drone.yml | 856 +++++++++++++++++++++++++++---------------- build-all.sh | 32 +- drone.yaml.j2 | 123 +++++++ generate-pipeline.py | 52 +++ 5 files changed, 740 insertions(+), 367 deletions(-) delete mode 100644 .drone.jsonnet create mode 100644 drone.yaml.j2 create mode 100644 generate-pipeline.py diff --git a/.drone.jsonnet b/.drone.jsonnet deleted file mode 100644 index 195c7d2..0000000 --- a/.drone.jsonnet +++ /dev/null @@ -1,44 +0,0 @@ -local Pipeline(tag) = { - kind: "pipeline", - type: "kubernetes", - name: tag + "build", - platform: { - os: "linux", - arch: "amd64", - }, - steps: [ - { - name: tag, - image: "plugins/kaniko", - settings: { - repo: "lerentis/ansible", - username: { "from_secret": "docker_username" }, - password: { "from_secret": "docker_password" }, - dockerfile: tag + "/Dockerfile", - tags: [ tag ], - }, - resources: { - limits: { - cpu: 200, - memory: "1024MiB", - }, - }, - when: [ "push", "pull_request", "cron" ] - } - ] -}; - - -[ - Pipeline("ubuntu-20.04"), - Pipeline("ubuntu-18.04"), - Pipeline("ubuntu-14.04"), - Pipeline("debian-8"), - Pipeline("debian-9"), - Pipeline("debian-10"), - Pipeline("centos-7"), - Pipeline("almalinux-8"), - Pipeline("fedora-24"), - Pipeline("alpine-3"), - Pipeline("arch"), -] diff --git a/.drone.yml b/.drone.yml index b82778b..522b72f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,97 +7,175 @@ platform: os: linux arch: amd64 -when_ressource: &WHEN_TEMPLATE_DEV +steps: + +- name: build-ubuntu-22.04 + image: plugins/kaniko + settings: + dockerfile: ubuntu-22.04/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - ubuntu-22.04-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-ubuntu-22 - image: plugins/kaniko - settings: - dockerfile: ubuntu-22.04/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - ubuntu-22.04-dev - <<: *WHEN_TEMPLATE_DEV - -- name: build-ubuntu-20 +- name: build-ubuntu-20.04 image: plugins/kaniko settings: dockerfile: ubuntu-20.04/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - ubuntu-20.04-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB -- name: build-ubuntu-18 +- name: build-ubuntu-18.04 image: plugins/kaniko settings: dockerfile: ubuntu-18.04/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - ubuntu-18.04-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB -- name: build-ubuntu-16 +- name: build-ubuntu-16.04 image: plugins/kaniko settings: dockerfile: ubuntu-16.04/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - ubuntu-16.04-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB -- name: build-ubuntu-14 +- name: build-ubuntu-14.04 image: plugins/kaniko settings: dockerfile: ubuntu-14.04/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - ubuntu-14.04-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB - name: build-debian-8 image: plugins/kaniko settings: dockerfile: debian-8/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - debian-8-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB - name: build-debian-9 image: plugins/kaniko settings: dockerfile: debian-9/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - debian-9-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB - name: build-debian-10 image: plugins/kaniko settings: dockerfile: debian-10/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - debian-10-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB --- kind: pipeline @@ -108,79 +186,133 @@ 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 - settings: - dockerfile: fedora-34/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - fedora-34-dev - <<: *WHEN_TEMPLATE_DEV - -- name: build-fedora-35 - image: plugins/kaniko - settings: - dockerfile: fedora-35/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - fedora-35-dev - <<: *WHEN_TEMPLATE_DEV - -- name: build-fedora-36 - image: plugins/kaniko - settings: - dockerfile: fedora-36/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - fedora-36-dev - <<: *WHEN_TEMPLATE_DEV - -- name: build-fedora-37 - image: plugins/kaniko - settings: - dockerfile: fedora-37/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - fedora-37-dev - <<: *WHEN_TEMPLATE_DEV - - name: build-almalinux-8 image: plugins/kaniko settings: dockerfile: almalinux-8/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - almalinux-8-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB - name: build-centos-7 image: plugins/kaniko settings: dockerfile: centos-7/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - centos-7-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB + +- name: build-fedora-34 + image: plugins/kaniko + settings: + dockerfile: fedora-34/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - fedora-34-dev + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB + +- name: build-fedora-35 + image: plugins/kaniko + settings: + dockerfile: fedora-35/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - fedora-35-dev + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB + +- name: build-fedora-36 + image: plugins/kaniko + settings: + dockerfile: fedora-36/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - fedora-36-dev + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB + +- name: build-fedora-37 + image: plugins/kaniko + settings: + dockerfile: fedora-37/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - fedora-37-dev + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB --- kind: pipeline @@ -191,43 +323,49 @@ platform: os: linux arch: amd64 -when_ressource: &WHEN_TEMPLATE_DEV +steps: + +- name: build-alpine-3.14 + image: plugins/kaniko + settings: + dockerfile: alpine-3.14/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - alpine-3.14-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-alpine-3-14 - image: plugins/kaniko - settings: - dockerfile: alpine-3.14/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - alpine-3.14-dev - <<: *WHEN_TEMPLATE_DEV - -- name: build-alpine-3-15 +- name: build-alpine-3.15 image: plugins/kaniko settings: dockerfile: alpine-3.15/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - alpine-3.15-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB --- kind: pipeline @@ -238,34 +376,30 @@ 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-arch image: plugins/kaniko settings: dockerfile: arch/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - arch-dev - <<: *WHEN_TEMPLATE_DEV + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB + + --- kind: pipeline @@ -276,95 +410,160 @@ platform: os: linux arch: amd64 -when_ressource_tag: &WHEN_TEMPLATE_TAG +steps: + +- name: release-ubuntu-22.04 + image: plugins/kaniko + settings: + dockerfile: ubuntu-22.04/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - ubuntu-22.04-dev when: event: - - tag + - 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 - <<: *SETTINGS_TEMPLATE - tags: - - ubuntu-22.04 - <<: *WHEN_TEMPLATE_TAG - -- name: build-ubuntu-20-release +- name: release-ubuntu-20.04 image: plugins/kaniko settings: dockerfile: ubuntu-20.04/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - ubuntu-20.04 - <<: *WHEN_TEMPLATE_TAG + - ubuntu-20.04-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB -- name: build-ubuntu-18-release +- name: release-ubuntu-18.04 image: plugins/kaniko settings: dockerfile: ubuntu-18.04/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - ubuntu-18.04 - <<: *WHEN_TEMPLATE_TAG + - ubuntu-18.04-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB -- name: build-ubuntu-16-release +- name: release-ubuntu-16.04 image: plugins/kaniko settings: dockerfile: ubuntu-16.04/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - ubuntu-16.04 - <<: *WHEN_TEMPLATE_TAG + - ubuntu-16.04-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB -- name: build-ubuntu-14-release +- name: release-ubuntu-14.04 image: plugins/kaniko settings: dockerfile: ubuntu-14.04/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - ubuntu-14.04 - <<: *WHEN_TEMPLATE_TAG + - ubuntu-14.04-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB -- name: build-debian-8-release +- name: release-debian-8 image: plugins/kaniko settings: dockerfile: debian-8/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - debian-8 - <<: *WHEN_TEMPLATE_TAG + - debian-8-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB -- name: build-debian-9-release +- name: release-debian-9 image: plugins/kaniko settings: dockerfile: debian-9/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - debian-9 - <<: *WHEN_TEMPLATE_TAG + - debian-9-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB -- name: build-debian-10-release +- name: release-debian-10 image: plugins/kaniko settings: dockerfile: debian-10/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - debian-10 - <<: *WHEN_TEMPLATE_TAG + - debian-10-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + --- kind: pipeline @@ -375,78 +574,122 @@ platform: os: linux arch: amd64 -when_ressource_tag: &WHEN_TEMPLATE_TAG +steps: + +- name: release-almalinux-8 + image: plugins/kaniko + settings: + dockerfile: almalinux-8/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - almalinux-8-dev when: event: - - tag + - 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 - settings: - dockerfile: fedora-34/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - fedora-34 - <<: *WHEN_TEMPLATE_TAG - -- name: build-fedora-35-release - image: plugins/kaniko - settings: - dockerfile: fedora-35/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - fedora-35 - <<: *WHEN_TEMPLATE_TAG - - -- name: build-fedora-36-release - image: plugins/kaniko - settings: - dockerfile: fedora-36/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - fedora-36 - <<: *WHEN_TEMPLATE_TAG - -- name: build-fedora-37-release - image: plugins/kaniko - settings: - dockerfile: fedora-37/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - fedora-37 - <<: *WHEN_TEMPLATE_TAG - -- name: build-almalinux-8-release - image: plugins/kaniko - settings: - dockerfile: almalinux-8/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - almalinux-8 - <<: *WHEN_TEMPLATE_TAG - -- name: build-centos-7-release +- name: release-centos-7 image: plugins/kaniko settings: dockerfile: centos-7/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - centos-7 - <<: *WHEN_TEMPLATE_TAG + - centos-7-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + +- name: release-fedora-34 + image: plugins/kaniko + settings: + dockerfile: fedora-34/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - fedora-34-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + +- name: release-fedora-35 + image: plugins/kaniko + settings: + dockerfile: fedora-35/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - fedora-35-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + +- name: release-fedora-36 + image: plugins/kaniko + settings: + dockerfile: fedora-36/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - fedora-36-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + +- name: release-fedora-37 + image: plugins/kaniko + settings: + dockerfile: fedora-37/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - fedora-37-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + --- kind: pipeline @@ -457,77 +700,77 @@ platform: os: linux arch: amd64 -when_ressource_tag: &WHEN_TEMPLATE_TAG +steps: + +- name: release-alpine-3.14 + image: plugins/kaniko + settings: + dockerfile: alpine-3.14/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - alpine-3.14-dev when: event: - - tag + - 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 - settings: - dockerfile: alpine-3.14/Dockerfile - <<: *SETTINGS_TEMPLATE - tags: - - alpine-3.14 - <<: *WHEN_TEMPLATE_TAG - -- name: build-alpine-3.15-release +- name: release-alpine-3.15 image: plugins/kaniko settings: dockerfile: alpine-3.15/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - alpine-3.15 - <<: *WHEN_TEMPLATE_TAG + - alpine-3.15-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + --- 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 steps: -- name: build-arch-release +- name: release-arch image: plugins/kaniko settings: dockerfile: arch/Dockerfile - <<: *SETTINGS_TEMPLATE + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible tags: - - arch - <<: *WHEN_TEMPLATE_TAG + - arch-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB + --- kind: pipeline @@ -556,11 +799,11 @@ steps: - push - pull_request - cron -depends_on: - - build-arch - - build-alpine - - build-debian - - build-rhel +depends_on: + - build-debian + - build-rhel + - build-alpine + - build-arch --- kind: pipeline @@ -586,10 +829,9 @@ steps: - failure - success event: - - tag - + - tag depends_on: - - release-arch - - release-alpine - - release-debian - - release-rhel \ No newline at end of file + - release-debian + - release-rhel + - release-alpine + - release-arch diff --git a/build-all.sh b/build-all.sh index 41edce7..6013769 100755 --- a/build-all.sh +++ b/build-all.sh @@ -1,17 +1,17 @@ #!/bin/bash -cd ubuntu-18.04 && docker buildx build -t lerentis/ansible:ubuntu-18.04 --platform=linux/arm,linux/arm64,linux/amd64 . --push -cd ../ubuntu-16.04 && docker buildx build -t lerentis/ansible:ubuntu-16.04 --platform=linux/arm,linux/arm64,linux/amd64 . --push -cd ../alpine-3.14 && docker buildx build -t lerentis/ansible:alpine-3.14 --platform=linux/arm,linux/arm64,linux/amd64 . --push -cd ../alpine-3.15 && docker buildx build -t lerentis/ansible:alpine-3.15 --platform=linux/arm,linux/arm64,linux/amd64 . --push -cd ../ubuntu-20.04 && docker buildx build -t lerentis/ansible:ubuntu-20.04 --platform=linux/arm,linux/arm64,linux/amd64 . --push -cd ../ubuntu-22.04 && docker buildx build -t lerentis/ansible:ubuntu-22.04 --platform=linux/arm,linux/arm64,linux/amd64 . --push -cd ../fedora-34 && docker buildx build -t lerentis/ansible:fedora-34 --platform=linux/amd64 . --push -cd ../fedora-35 && docker buildx build -t lerentis/ansible:fedora-35 --platform=linux/amd64 . --push -cd ../fedora-36 && docker buildx build -t lerentis/ansible:fedora-36 --platform=linux/amd64 . --push -cd ../fedora-37 && docker buildx build -t lerentis/ansible:fedora-37 --platform=linux/amd64 . --push -cd ../debian-9 && docker buildx build -t lerentis/ansible:debian-9 --platform=linux/arm,linux/amd64 . --push -cd ../debian-8 && docker buildx build -t lerentis/ansible:debian-8 --platform=linux/arm,linux/amd64 . --push -cd ../debian-10 && docker buildx build -t lerentis/ansible:debian-10 --platform=linux/arm64,linux/amd64 . --push -cd ../centos-7 && docker buildx build -t lerentis/ansible:centos-7 --platform=linux/arm64,linux/amd64 . --push -cd ../almalinux-8 && docker buildx build -t lerentis/ansible:almalinux-8 --platform=linux/arm64,linux/amd64 . --push -cd ../arch && docker buildx build -t lerentis/ansible:arch --platform=linux/arm,linux/amd64 . --push +cd ubuntu-18.04 && docker buildx build -t lerentis/ansible:ubuntu-18.04-dev --platform=linux/arm,linux/arm64,linux/amd64 . --push +cd ../ubuntu-16.04 && docker buildx build -t lerentis/ansible:ubuntu-16.04-dev --platform=linux/arm,linux/arm64,linux/amd64 . --push +cd ../alpine-3.14 && docker buildx build -t lerentis/ansible:alpine-3.14-dev --platform=linux/arm,linux/arm64,linux/amd64 . --push +cd ../alpine-3.15 && docker buildx build -t lerentis/ansible:alpine-3.15-dev --platform=linux/arm,linux/arm64,linux/amd64 . --push +cd ../ubuntu-20.04 && docker buildx build -t lerentis/ansible:ubuntu-20.04-dev --platform=linux/arm,linux/arm64,linux/amd64 . --push +cd ../ubuntu-22.04 && docker buildx build -t lerentis/ansible:ubuntu-22.04-dev --platform=linux/arm,linux/arm64,linux/amd64 . --push +cd ../fedora-34 && docker buildx build -t lerentis/ansible:fedora-34-dev --platform=linux/amd64 . --push +cd ../fedora-35 && docker buildx build -t lerentis/ansible:fedora-35-dev --platform=linux/amd64 . --push +cd ../fedora-36 && docker buildx build -t lerentis/ansible:fedora-36-dev --platform=linux/amd64 . --push +cd ../fedora-37 && docker buildx build -t lerentis/ansible:fedora-37-dev --platform=linux/amd64 . --push +cd ../debian-9 && docker buildx build -t lerentis/ansible:debian-9-dev --platform=linux/arm,linux/amd64 . --push +cd ../debian-8 && docker buildx build -t lerentis/ansible:debian-8-dev --platform=linux/arm,linux/amd64 . --push +cd ../debian-10 && docker buildx build -t lerentis/ansible:debian-10-dev --platform=linux/arm64,linux/amd64 . --push +cd ../centos-7 && docker buildx build -t lerentis/ansible:centos-7-dev --platform=linux/arm64,linux/amd64 . --push +cd ../almalinux-8 && docker buildx build -t lerentis/ansible:almalinux-8-dev --platform=linux/arm64,linux/amd64 . --push +cd ../arch && docker buildx build -t lerentis/ansible:arch-dev --platform=linux/arm,linux/amd64 . --push diff --git a/drone.yaml.j2 b/drone.yaml.j2 new file mode 100644 index 0000000..9c6bdf7 --- /dev/null +++ b/drone.yaml.j2 @@ -0,0 +1,123 @@ +{%- for pipeline in pipelines -%} +--- +kind: pipeline +type: kubernetes +name: build-{{ pipeline.group }} + +platform: + os: linux + arch: amd64 + +steps: +{% for tag in pipeline.tags %} +- name: build-{{ tag }} + image: plugins/kaniko + settings: + dockerfile: {{ tag }}/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - {{ tag }}-dev + when: + event: + - push + - pull_request + - cron + resources: + limits: + cpu: 200 + memory: 1024MiB +{% endfor %} +{% endfor %} +{% for pipeline in pipelines %} +--- +kind: pipeline +type: kubernetes +name: release-{{ pipeline.group }} + +platform: + os: linux + arch: amd64 + +steps: +{% for tag in pipeline.tags %} +- name: release-{{ tag }} + image: plugins/kaniko + settings: + dockerfile: {{ tag }}/Dockerfile + password: + from_secret: docker_password + username: + from_secret: docker_username + repo: lerentis/ansible + tags: + - {{ tag }}-dev + when: + event: + - tag + resources: + limits: + cpu: 200 + memory: 1024MiB +{% endfor %} +{% endfor %} +--- +kind: pipeline +type: kubernetes +name: notify-build + +platform: + os: linux + arch: amd64 + +steps: +{% raw %} +- name: notify + image: appleboy/drone-telegram + settings: + message: "Commit {{ commit.message }} ran with build {{ build.number }} and finished with status {{ build.status }}." + to: + from_secret: telegram_userid + token: + from_secret: telegram_secret + when: + status: + - failure + - success + event: + - push + - pull_request + - cron{% endraw %} +depends_on: {% for pipeline in pipelines %} + - build-{{ pipeline.group }} {% endfor %} + +--- +kind: pipeline +type: kubernetes +name: notify-release + +platform: + os: linux + arch: amd64 + +steps: +{% raw %} +- name: notify + image: appleboy/drone-telegram + settings: + message: "Release {{ build.tag }} ran with build {{ build.number }} and finished with status {{ build.status }}." + to: + from_secret: telegram_userid + token: + from_secret: telegram_secret + when: + status: + - failure + - success + event: + - tag {% endraw %} +depends_on:{% for pipeline in pipelines %} + - release-{{ pipeline.group }} {% endfor %} \ No newline at end of file diff --git a/generate-pipeline.py b/generate-pipeline.py new file mode 100644 index 0000000..afbc0de --- /dev/null +++ b/generate-pipeline.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +from jinja2 import Template, Environment, FileSystemLoader + +pipelines = [ + { + "group": "debian", + "tags": [ + "ubuntu-22.04", + "ubuntu-20.04", + "ubuntu-18.04", + "ubuntu-16.04", + "ubuntu-14.04", + "debian-8", + "debian-9", + "debian-10" + ] + }, + { + "group": "rhel", + "tags": [ + "almalinux-8", + "centos-7", + "fedora-34", + "fedora-35", + "fedora-36", + "fedora-37" + ] + }, + { + "group": "alpine", + "tags": [ + "alpine-3.14", + "alpine-3.15" + ] + }, + { + "group": "arch", + "tags": [ + "arch" + ] + } +] + + +file_loader = FileSystemLoader('.') +env = Environment(loader=file_loader) + +template = env.get_template('drone.yaml.j2') + +output = template.render(pipelines=pipelines) +print(output) \ No newline at end of file