refactor drone config
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2020-06-05 14:01:51 +02:00
parent 58ea3ba483
commit db552093f7
2 changed files with 30 additions and 118 deletions

View File

@ -1,104 +0,0 @@
def pipeline_build():
step_build = {
'image': 'xoxys/rpmbuild',
'name': 'build',
'environment': {
'CUPSRELEASE': '${DRONE_TAG##v}'
},
'commands': [
'[ -z "$CUPSRELEASE" ] && CUPSRELEASE=2.2.10',
'wget https://github.com/apple/cups/releases/download/v$CUPSRELEASE/cups-$CUPSRELEASE-source.tar.gz',
'mkdir ./rpms',
'rpmbuild -ta --define "_rpmdir $(pwd)/rpms" --without libusb1 cups-$CUPSRELEASE-source.tar.gz'
]
}
step_checksum = {
'name': 'checksum',
'image': 'alpine',
'commands': [
'apk add --no-cache coreutils',
'sha256sum -b rpms/x86_64/* > sha256sum.txt'
]
}
step_sign = {
'name': 'gpgsign',
'image': 'plugins/gpgsign:1',
'pull': 'always',
'settings': {
'key': { 'from_secret': 'gpgsign_key' },
'passphrase': { 'from_secret': 'gpgsign_passphrase' },
'detach_sign': True,
'files': [
'rpms/x86_64/*'
]
},
'when': {
'ref': {
'exclude': ['refs/pull/**'],
},
},
}
step_publish = {
'name': 'publish',
'image': 'plugins/gitea-release',
'settings': {
'base_url': 'https://gitea.rknet.org',
'api_key': { 'from_secret': 'gitea_token' },
'files': [
'rpms/x86_64/*',
'sha256sum.txt'
],
'title': '${DRONE_TAG}'
},
'when': {
'ref': ['refs/tags/**'],
}
}
return {
'kind': 'pipeline',
'name': 'build',
'steps': [
step_build,
step_checksum,
step_sign,
step_publish
]
}
def pipeline_notify(deps=[]):
step_matrix = {
'name': 'matrix',
'image': 'plugins/matrix',
'settings': {
'homeserver': 'https://matrix.rknet.org',
'roomid': 'MtidqQXWWAtQcByBhH:rknet.org',
'template': 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}',
'username': { 'from_secret': 'matrix_username' },
'password': { 'from_secret': 'matrix_password' },
}
}
return {
'kind': 'pipeline',
'name': 'notifications',
'steps': [
step_matrix,
],
'depends_on': deps,
'trigger': {
'ref': ['refs/heads/master', 'refs/tags/**'],
'status': [ 'success', 'failure' ],
},
}
def main():
return [
pipeline_build(),
pipeline_notify(deps=[pipeline_build().get('name')])
]

View File

@ -13,15 +13,15 @@ steps:
- "[ -z \"$CUPSRELEASE\" ] && CUPSRELEASE=2.2.10" - "[ -z \"$CUPSRELEASE\" ] && CUPSRELEASE=2.2.10"
- wget https://github.com/apple/cups/releases/download/v$CUPSRELEASE/cups-$CUPSRELEASE-source.tar.gz - wget https://github.com/apple/cups/releases/download/v$CUPSRELEASE/cups-$CUPSRELEASE-source.tar.gz
- mkdir ./rpms - mkdir ./rpms
- "rpmbuild -ta --define \"_rpmdir $(pwd)/rpms\" --without libusb1 cups-$CUPSRELEASE-source.tar.gz" - rpmbuild -ta --define "_rpmdir $(pwd)/rpms" --without libusb1 cups-$CUPSRELEASE-source.tar.gz
environment: environment:
CUPSRELEASE: "${DRONE_TAG##v}" CUPSRELEASE: ${DRONE_TAG##v}
- name: checksum - name: checksum
image: alpine image: alpine
commands: commands:
- apk add --no-cache coreutils - apk add --no-cache coreutils
- "sha256sum -b rpms/x86_64/* > sha256sum.txt" - sha256sum -b rpms/x86_64/* > sha256sum.txt
- name: gpgsign - name: gpgsign
pull: always pull: always
@ -29,7 +29,7 @@ steps:
settings: settings:
detach_sign: true detach_sign: true
files: files:
- "rpms/x86_64/*" - rpms/x86_64/*
key: key:
from_secret: gpgsign_key from_secret: gpgsign_key
passphrase: passphrase:
@ -37,25 +37,39 @@ steps:
when: when:
ref: ref:
exclude: exclude:
- "refs/pull/**" - refs/pull/**
- name: publish - name: release
image: plugins/gitea-release image: plugins/gitea-release
settings: settings:
api_key: api_key:
from_secret: gitea_token from_secret: gitea_token
base_url: https://gitea.rknet.org base_url: https://gitea.rknet.org
files: files:
- "rpms/x86_64/*" - rpms/x86_64/*
- sha256sum.txt - sha256sum.txt
title: "${DRONE_TAG}" title: ${DRONE_TAG}
when: when:
ref: ref:
- "refs/tags/**" - refs/tags/**
- name: repository
image: plugins/s3
settings:
access_key:
from_secret: s3_access_key
bucket: packages
endpoint: https://sp.rknet.org
path_style: true
secret_key:
from_secret: s3_secret_access_key
source: rpms/x86_64/*.rpm
strip_prefix: rpms/
target: /centos/7/
--- ---
kind: pipeline kind: pipeline
name: notifications name: notification
platform: platform:
os: linux os: linux
@ -65,10 +79,12 @@ steps:
- name: matrix - name: matrix
image: plugins/matrix image: plugins/matrix
settings: settings:
homeserver: https://matrix.rknet.org homeserver:
from_secret: matrix_homeserver
password: password:
from_secret: matrix_password from_secret: matrix_password
roomid: MtidqQXWWAtQcByBhH:rknet.org roomid:
from_secret: matrix_roomid
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}" template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}"
username: username:
from_secret: matrix_username from_secret: matrix_username
@ -76,7 +92,7 @@ steps:
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- "refs/tags/**" - refs/tags/**
status: status:
- success - success
- failure - failure
@ -86,6 +102,6 @@ depends_on:
--- ---
kind: signature kind: signature
hmac: 1ded387fbbaa7f8c65b0d80499e0c3bac52839f76e8a5530a5ca2ffd3032c02a hmac: d5f65915907940d58f7753b74590a9e5ca1889a864983cec06fd7b542606e70a
... ...