ansible/drone.yaml.j2

123 lines
2.2 KiB
Django/Jinja

{%- 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 }}
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 %}