From 6016d4a7ed1aeb0617b493a632a77ac1293e5a60 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 13 Mar 2019 10:57:48 +0100 Subject: [PATCH] refactoring --- .drone.jsonnet | 71 +++++++++++++ .drone.yml | 109 ++++++++++++-------- Dockerfile => docker/Dockerfile.linux.amd64 | 0 docker/Dockerfile.linux.arm | 21 ++++ 4 files changed, 157 insertions(+), 44 deletions(-) create mode 100644 .drone.jsonnet rename Dockerfile => docker/Dockerfile.linux.amd64 (100%) create mode 100644 docker/Dockerfile.linux.arm diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..4e16c51 --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,71 @@ +local PipelineBuild(os='linux', arch='amd64') = { + local tag = os + '-' + arch, + local file_suffix = std.strReplace(tag, '-', '.'), + kind: "pipeline", + name: tag, + platform: { + os: os, + arch: arch, + }, + steps: [ + { + name: 'dryrun', + image: 'plugins/docker:' + tag, + pull: 'always', + settings: { + dry_run: true, + tags: tag, + dockerfile: 'docker/Dockerfile.' + file_suffix, + repo: 'plugins/base', + username: { from_secret: 'docker_username' }, + password: { from_secret: 'docker_password' }, + }, + }, + { + name: 'publish', + image: 'plugins/docker:' + tag, + pull: 'always', + settings: { + auto_tag: true, + auto_tag_suffix: tag, + dockerfile: 'docker/Dockerfile.' + file_suffix, + repo: 'plugins/base', + username: { from_secret: 'docker_username' }, + password: { from_secret: 'docker_password' }, + }, + }, + ], +}; + +local PipelineNotifications = { + kind: "pipeline", + name: "notifications", + platform: { + os: "linux", + arch: "amd64", + }, + steps: [ + { + image: "plugins/matrix", + settings: { + homeserver: "https://matrix.rknet.org", + roomid: "MtidqQXWWAtQcByBhH:rknet.org", + template: "Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}", + username: { "from_secret": "matrix_username" }, + password: { "from_secret": "matrix_password" }, + }, + }, + ], + depends_on: [ + "deployment", + ], + trigger: { + event: [ "push", "tag" ], + status: [ "success", "failure" ], + }, +}; + +[ + PipelineBuild(os='linux', arch='amd64'), + PipelineBuild(os='linux', arch='arm') +] diff --git a/.drone.yml b/.drone.yml index a7261af..999b5de 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,50 +1,71 @@ --- kind: pipeline -name: default +name: linux-amd64 + +platform: + os: linux + arch: amd64 steps: - - name: dryrun - pull: always - image: plugins/docker:linux-amd64 - settings: - dry_run: true - password: - from_secret: docker_password - repo: xoxys/rpmbuild-centos7 - tags: linux-amd64 - username: - from_secret: docker_username - when: - event: - - push - - tag +- name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dockerfile: docker/Dockerfile.linux.amd64 + dry_run: true + password: + from_secret: docker_password + repo: plugins/base + tags: linux-amd64 + username: + from_secret: docker_username - - name: publish - pull: always - image: plugins/docker:linux-amd64 - settings: - auto_tag: true - password: - from_secret: docker_password - repo: xoxys/rpmbuild-centos7 - username: - from_secret: docker_username - when: - event: - - push - - tag +- 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: plugins/base + username: + from_secret: docker_username - - name: notify - image: plugins/matrix - settings: - homeserver: https://matrix.rknet.org - roomid: MtidqQXWWAtQcByBhH:rknet.org - template: "Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}" - username: - from_secret: matrix_username - password: - from_secret: matrix_password - when: - status: - - success - - failure +--- +kind: pipeline +name: linux-arm + +platform: + os: linux + arch: arm + +steps: +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: plugins/base + tags: linux-arm + username: + from_secret: docker_username + +- name: publish + pull: always + image: plugins/docker:linux-arm + settings: + auto_tag: true + auto_tag_suffix: linux-arm + dockerfile: docker/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: plugins/base + username: + from_secret: docker_username + +... diff --git a/Dockerfile b/docker/Dockerfile.linux.amd64 similarity index 100% rename from Dockerfile rename to docker/Dockerfile.linux.amd64 diff --git a/docker/Dockerfile.linux.arm b/docker/Dockerfile.linux.arm new file mode 100644 index 0000000..7ae1567 --- /dev/null +++ b/docker/Dockerfile.linux.arm @@ -0,0 +1,21 @@ +FROM arm32v7/centos:7 + +RUN yum install -y gcc gcc-c++ \ + libtool libtool-ltdl \ + gnutls-devel \ + pam-devel \ + dbus-devel \ + avahi-devel \ + systemd-devel \ + make cmake \ + git \ + pkgconfig \ + wget \ + automake autoconf \ + yum-utils rpm-build && \ + yum clean all + +USER root + +ENV FLAVOR=rpmbuild OS=centos DIST=el7 +CMD /srv/pkg