fuck starlark and jsonet. jinja it is
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
parent
66b678830e
commit
f719b7ade3
@ -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"),
|
|
||||||
]
|
|
856
.drone.yml
856
.drone.yml
File diff suppressed because it is too large
Load Diff
32
build-all.sh
32
build-all.sh
@ -1,17 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/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-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 --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 --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 --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 --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 --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 --platform=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 --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 --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 --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 --platform=linux/arm,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 --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 --platform=linux/arm64,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 --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 --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 --platform=linux/arm,linux/amd64 . --push
|
cd ../arch && docker buildx build -t lerentis/ansible:arch-dev --platform=linux/arm,linux/amd64 . --push
|
||||||
|
123
drone.yaml.j2
Normal file
123
drone.yaml.j2
Normal file
@ -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 %}
|
52
generate-pipeline.py
Normal file
52
generate-pipeline.py
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user