Deduplicate pipeline with jsonnet
This commit is contained in:
parent
b35e640f02
commit
2f7e8ceb2c
2 changed files with 99 additions and 37 deletions
60
.drone.jsonnet
Normal file
60
.drone.jsonnet
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
local build(contrib=false) = {
|
||||||
|
"kind": "pipeline",
|
||||||
|
"name": "build" + (if contrib then "-contrib" else ""),
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"name": "set image tags",
|
||||||
|
"image": "alpine",
|
||||||
|
"environment": {
|
||||||
|
"VERSION": "7.2.10-r2"
|
||||||
|
},
|
||||||
|
"commands": [
|
||||||
|
"./write-tags.sh $VERSION contrib > .tags",
|
||||||
|
"# Will build the following tags:",
|
||||||
|
"cat .tags"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "build docker image",
|
||||||
|
"image": "ovdnet/drone-docker",
|
||||||
|
"settings": {
|
||||||
|
"repo": "ovdnet/atheme",
|
||||||
|
"username": {
|
||||||
|
"from_secret": "docker_user"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"from_secret": "docker_password"
|
||||||
|
},
|
||||||
|
"build_args": std.prune([
|
||||||
|
"ATHEME_VERSION=7.2.10-r2",
|
||||||
|
(if contrib then "BUILD_CONTRIB_MODULES=true")
|
||||||
|
])
|
||||||
|
},
|
||||||
|
"trigger": {
|
||||||
|
"branch": [
|
||||||
|
"master"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"volumes": [
|
||||||
|
{
|
||||||
|
"name": "docker-socket",
|
||||||
|
"path": "/var/run/docker.sock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"volumes": [
|
||||||
|
{
|
||||||
|
"name": "docker-socket",
|
||||||
|
"host": {
|
||||||
|
"path": "/var/run/docker.sock"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
[
|
||||||
|
build(),
|
||||||
|
build(contrib=true)
|
||||||
|
]
|
||||||
|
|
76
.drone.yml
76
.drone.yml
|
@ -2,31 +2,30 @@
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: build
|
name: build
|
||||||
|
|
||||||
steps:
|
platform:
|
||||||
- name: "set image tags"
|
os: linux
|
||||||
image: alpine
|
arch: amd64
|
||||||
environment:
|
|
||||||
VERSION: "7.2.10-r2"
|
|
||||||
commands:
|
|
||||||
- "./write-tags.sh $VERSION > .tags"
|
|
||||||
- "# Will build the following tags:"
|
|
||||||
- "cat .tags"
|
|
||||||
|
|
||||||
- name: "build docker image"
|
steps:
|
||||||
# Basically plugins/docker but bumped to Docker v20.10.7 for Alpine 3.14 support
|
- name: set image tags
|
||||||
# See https://github.com/drone-plugins/drone-docker/issues/326
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- ./write-tags.sh $VERSION contrib > .tags
|
||||||
|
- "# Will build the following tags:"
|
||||||
|
- cat .tags
|
||||||
|
environment:
|
||||||
|
VERSION: 7.2.10-r2
|
||||||
|
|
||||||
|
- name: build docker image
|
||||||
image: ovdnet/drone-docker
|
image: ovdnet/drone-docker
|
||||||
settings:
|
settings:
|
||||||
|
build_args:
|
||||||
|
- ATHEME_VERSION=7.2.10-r2
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
repo: ovdnet/atheme
|
repo: ovdnet/atheme
|
||||||
username:
|
username:
|
||||||
from_secret: docker_user
|
from_secret: docker_user
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
build_args:
|
|
||||||
- ATHEME_VERSION=7.2.10-r2
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: docker-socket
|
- name: docker-socket
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
|
@ -40,30 +39,31 @@ volumes:
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: build-contrib
|
name: build-contrib
|
||||||
|
|
||||||
steps:
|
platform:
|
||||||
- name: "set image tags"
|
os: linux
|
||||||
image: alpine
|
arch: amd64
|
||||||
environment:
|
|
||||||
VERSION: "7.2.10-r2"
|
|
||||||
commands:
|
|
||||||
- "./write-tags.sh $VERSION contrib > .tags"
|
|
||||||
- "# Will build the following tags:"
|
|
||||||
- "cat .tags"
|
|
||||||
|
|
||||||
- name: "build docker image"
|
steps:
|
||||||
|
- name: set image tags
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- ./write-tags.sh $VERSION contrib > .tags
|
||||||
|
- "# Will build the following tags:"
|
||||||
|
- cat .tags
|
||||||
|
environment:
|
||||||
|
VERSION: 7.2.10-r2
|
||||||
|
|
||||||
|
- name: build docker image
|
||||||
image: ovdnet/drone-docker
|
image: ovdnet/drone-docker
|
||||||
settings:
|
settings:
|
||||||
|
build_args:
|
||||||
|
- ATHEME_VERSION=7.2.10-r2
|
||||||
|
- BUILD_CONTRIB_MODULES=true
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
repo: ovdnet/atheme
|
repo: ovdnet/atheme
|
||||||
username:
|
username:
|
||||||
from_secret: docker_user
|
from_secret: docker_user
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
build_args:
|
|
||||||
- ATHEME_VERSION=7.2.10-r2
|
|
||||||
- BUILD_CONTRIB_MODULES=true
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: docker-socket
|
- name: docker-socket
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
|
@ -72,3 +72,5 @@ volumes:
|
||||||
- name: docker-socket
|
- name: docker-socket
|
||||||
host:
|
host:
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
...
|
||||||
|
|
Loading…
Reference in a new issue