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

This commit is contained in:
Robert Kaussow 2020-02-22 17:41:02 +01:00
parent bc4da8387a
commit 55cd2328cd
4 changed files with 164 additions and 86 deletions

View File

@ -1,100 +1,144 @@
local PipelineBuild(os='linux', arch='amd64') = { local PipelineBuild(arch='amd64') = {
local tag = os + '-' + arch, kind: 'pipeline',
local file_suffix = std.strReplace(tag, '-', '.'), name: 'build-' + arch,
kind: "pipeline",
name: tag,
platform: { platform: {
os: os, os: 'linux',
arch: arch, arch: arch,
}, },
steps: [ steps: [
{ {
name: 'dryrun', name: 'dryrun',
image: 'plugins/docker:' + tag, image: 'plugins/docker',
pull: 'always',
settings: { settings: {
dry_run: true, dry_run: true,
tags: tag, dockerfile: 'Dockerfile',
dockerfile: 'docker/Dockerfile.' + file_suffix, repo: 'xoxys/${DRONE_REPO_NAME}',
repo: ' xoxys/rpmbuild', username: { from_secret: 'docker_username' },
username: { from_secret: "docker_username" }, password: { from_secret: 'docker_password' },
password: { from_secret: "docker_password" }, build_args: [],
},
when: {
ref: [
'refs/pull/**',
],
}, },
}, },
{ {
name: 'publish', name: 'publish',
image: 'plugins/docker:' + tag, image: 'plugins/docker',
pull: 'always',
settings: { settings: {
auto_tag: true, auto_tag: true,
auto_tag_suffix: tag, auto_tag_suffix: arch,
dockerfile: 'docker/Dockerfile.' + file_suffix, dockerfile: 'Dockerfile',
repo: ' xoxys/rpmbuild', repo: 'xoxys/${DRONE_REPO_NAME}',
username: { from_secret: "docker_username" }, username: { from_secret: 'docker_username' },
password: { from_secret: "docker_password" }, password: { from_secret: 'docker_password' },
build_args: [],
}, },
when: { when: {
branch: [ "master" ], ref: [
'refs/heads/master',
'refs/tags/**',
],
},
},
{
name: 'publish-gitea',
image: 'plugins/gitea-release',
settings: {
api_key: { from_secret: 'gitea_token' },
base_url: 'https://gitea.rknet.org',
overwrite: true,
title: '${DRONE_TAG}',
note: 'CHANGELOG.md',
},
when: {
ref: ['refs/tags/**'],
}, },
}, },
], ],
}; };
local PipelineNotifications(depends_on=[]) = { local PipelineNotifications(depends_on=[]) = {
kind: "pipeline", kind: 'pipeline',
name: "notifications", name: 'notifications',
platform: { platform: {
os: "linux", os: 'linux',
arch: "amd64", arch: 'amd64',
}, },
steps: [ steps: [
{ {
image: "plugins/manifest", image: 'plugins/manifest',
name: "manifest", name: 'manifest',
pull: "always",
settings: { settings: {
ignore_missing: true, ignore_missing: true,
username: { from_secret: "docker_username" }, tags: [
password: { from_secret: "docker_password" }, '${DRONE_TAG}',
spec: "docker/manifest.tmpl", '${DRONE_TAG%-*}',
'${DRONE_TAG%.*}',
'${DRONE_TAG%%.*}',
],
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'manifest.tmpl',
}, },
when: { when: {
branch: [ "master" ], status: [
'success',
],
}, },
}, },
{ {
name: "microbadger", name: 'readme',
image: "plugins/webhook", image: 'sheogorath/readme-to-dockerhub',
pull: "always", environment: {
settings: { DOCKERHUB_USERNAME: { from_secret: 'docker_username' },
urls: { from_secret: "microbadger_url" }, DOCKERHUB_PASSWORD: { from_secret: 'docker_password' },
DOCKERHUB_REPO_PREFIX: 'xoxys',
DOCKERHUB_REPO_NAME: '${DRONE_REPO_NAME}',
README_PATH: 'README.md',
SHORT_DESCRIPTION: 'Rootless NGINX - High-performance HTTP server and reverse proxy',
},
when: {
status: [
'success',
],
}, },
}, },
{ {
image: "plugins/matrix", name: 'matrix',
name: "matrix", image: 'plugins/matrix',
pull: 'always',
settings: { settings: {
homeserver: "https://matrix.rknet.org", homeserver: { from_secret: 'matrix_homeserver' },
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: { from_secret: "matrix_username" }, username: { from_secret: 'matrix_username' },
password: { from_secret: "matrix_password" }, password: { from_secret: 'matrix_password' },
}, },
when: { when: {
status: [ "success", "failure" ], status: [
'success',
'failure',
],
}, },
}, },
], ],
trigger: { trigger: {
status: [ "success", "failure" ], ref: [
'refs/heads/master',
'refs/tags/**',
],
status: [
'success',
'failure',
],
}, },
depends_on: depends_on, depends_on: depends_on,
}; };
[ [
PipelineBuild(os='linux', arch='amd64'), PipelineBuild(arch='amd64'),
PipelineNotifications(depends_on=[ PipelineNotifications(depends_on=[
"linux-amd64" 'build-amd64',
]) ]),
] ]

View File

@ -1,6 +1,6 @@
--- ---
kind: pipeline kind: pipeline
name: linux-amd64 name: build-amd64
platform: platform:
os: linux os: linux
@ -8,33 +8,47 @@ platform:
steps: steps:
- name: dryrun - name: dryrun
pull: always image: plugins/docker
image: plugins/docker:linux-amd64
settings: settings:
dockerfile: docker/Dockerfile.linux.amd64 dockerfile: Dockerfile
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/rpmbuild repo: xoxys/${DRONE_REPO_NAME}
tags: linux-amd64
username:
from_secret: docker_username
- name: publish
pull: always
image: plugins/docker:linux-amd64
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
dockerfile: docker/Dockerfile.linux.amd64
password:
from_secret: docker_password
repo: xoxys/rpmbuild
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
branch: ref:
- master - refs/pull/**
- name: publish
image: plugins/docker
settings:
auto_tag: true
auto_tag_suffix: amd64
dockerfile: Dockerfile
password:
from_secret: docker_password
repo: xoxys/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- refs/tags/**
- name: publish-gitea
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_token
base_url: https://gitea.rknet.org
note: CHANGELOG.md
overwrite: true
title: ${DRONE_TAG}
when:
ref:
- refs/tags/**
--- ---
kind: pipeline kind: pipeline
@ -46,34 +60,47 @@ platform:
steps: steps:
- name: manifest - name: manifest
pull: always
image: plugins/manifest image: plugins/manifest
settings: settings:
ignore_missing: true ignore_missing: true
password: password:
from_secret: docker_password from_secret: docker_password
spec: docker/manifest.tmpl spec: manifest.tmpl
tags:
- ${DRONE_TAG}
- ${DRONE_TAG%-*}
- ${DRONE_TAG%.*}
- ${DRONE_TAG%%.*}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
branch: status:
- master - success
- name: microbadger - name: readme
pull: always image: sheogorath/readme-to-dockerhub
image: plugins/webhook environment:
settings: DOCKERHUB_PASSWORD:
urls: from_secret: docker_password
from_secret: microbadger_url DOCKERHUB_REPO_NAME: ${DRONE_REPO_NAME}
DOCKERHUB_REPO_PREFIX: xoxys
DOCKERHUB_USERNAME:
from_secret: docker_username
README_PATH: README.md
SHORT_DESCRIPTION: Rootless NGINX - High-performance HTTP server and reverse proxy
when:
status:
- success
- name: matrix - name: matrix
pull: always
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
@ -83,11 +110,18 @@ steps:
- failure - failure
trigger: trigger:
ref:
- refs/heads/master
- refs/tags/**
status: status:
- success - success
- failure - failure
depends_on: depends_on:
- linux-amd64 - build-amd64
---
kind: signature
hmac: 7a2b31b7decc0bb838efc3daa40e12d3bd6e07da4cbe48b6472546781b83eabe
... ...

View File

@ -10,6 +10,7 @@ RUN yum-config-manager --add-repo http://www.nasm.us/nasm.repo && \
yum install -y \ yum install -y \
gcc gcc-c++ \ gcc gcc-c++ \
libtool libtool-ltdl \ libtool libtool-ltdl \
gnutls \
gnutls-devel \ gnutls-devel \
pam-devel \ pam-devel \
dbus-devel \ dbus-devel \
@ -26,7 +27,6 @@ RUN yum-config-manager --add-repo http://www.nasm.us/nasm.repo && \
nasm \ nasm \
perl \ perl \
python \ python \
gnutls \
yasm \ yasm \
which \ which \
libva-devel \ libva-devel \