From 0e55852f7e8b1b9131fb44c6a6e6af0eb254794a Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Tue, 10 May 2022 15:48:17 +0200 Subject: [PATCH 1/2] drone-tests Signed-off-by: Christian Richter --- .drone.star | 36 +++++++++++++++++++++++++++++++++++ motsognir/hooks/post_checkout | 2 -- motsognir/hooks/pre_build | 4 ---- 3 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 .drone.star delete mode 100644 motsognir/hooks/post_checkout delete mode 100644 motsognir/hooks/pre_build diff --git a/.drone.star b/.drone.star new file mode 100644 index 0000000..7f904d7 --- /dev/null +++ b/.drone.star @@ -0,0 +1,36 @@ +def main(ctx): + return [ + step("amd64"), + step("arm64"), + ] + +def step(arch): + return { + "kind": "pipeline", + "name": "build-%s" % arch, + "steps": [ + { + "name": "build", + "image": "plugins/docker", + "repo": "dragonchaser/motsognir", + "volumes": [ + { + "name":"docker_sock", + "path":"/var/run/docker.sock" + } + ], + "commands": [ + "cd motsognir", + "docker build -t dragonchaser/motsognir:latest ." + ] + } + ], + "volumes": [ + { + "name":"docker_sock", + "host": { + "path": "/var/run/docker.sock" + } + } + ] + } diff --git a/motsognir/hooks/post_checkout b/motsognir/hooks/post_checkout deleted file mode 100644 index 5c42267..0000000 --- a/motsognir/hooks/post_checkout +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static . && pwd && ls diff --git a/motsognir/hooks/pre_build b/motsognir/hooks/pre_build deleted file mode 100644 index 2c34175..0000000 --- a/motsognir/hooks/pre_build +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -#register qemu-*-static for all supported processors except the -# current one, but also remove all registered binfmt_misc before -docker run --rm --privileged multiarch/qemu-user-static:register --reset -- 2.49.1 From 228a76cd12148e0c8bb7be806f016609c1c2d08b Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Tue, 10 May 2022 22:24:44 +0200 Subject: [PATCH 2/2] Add drone + build motsognir Signed-off-by: Christian Richter --- .drone.star | 108 +++++++++++++++++++++++++++++-------------- .gitignore | 1 + motsognir/Dockerfile | 4 +- 3 files changed, 77 insertions(+), 36 deletions(-) create mode 100644 .gitignore diff --git a/.drone.star b/.drone.star index 7f904d7..15b99fe 100644 --- a/.drone.star +++ b/.drone.star @@ -1,36 +1,76 @@ def main(ctx): - return [ - step("amd64"), - step("arm64"), - ] - -def step(arch): - return { - "kind": "pipeline", - "name": "build-%s" % arch, - "steps": [ - { - "name": "build", - "image": "plugins/docker", - "repo": "dragonchaser/motsognir", - "volumes": [ - { - "name":"docker_sock", - "path":"/var/run/docker.sock" - } - ], - "commands": [ - "cd motsognir", - "docker build -t dragonchaser/motsognir:latest ." - ] - } - ], - "volumes": [ - { - "name":"docker_sock", - "host": { - "path": "/var/run/docker.sock" - } - } + return [ + stepPR("amd64"), + stepPR("arm64"), + stepMergeMaster("amd64"), + stepMergeMaster("arm64"), ] - } + + +def stepPR(arch): + return { + "kind": "pipeline", + "type": "docker", + "name": "docker-build-%s" % (arch), + "platform": { + "os": "linux", + "arch": arch, + }, + "steps": [ + { + "name": "build-image-%s" % (arch), + "image": "plugins/docker", + "settings": { + "dockerfile": "motsognir/Dockerfile", + "repo": "dragonchaser/motsognir", + "dry_run": "true", + "tag": "latest-%s" % (arch), + "username": { + "from_secret": "dockerhub-user" + }, + "password": { + "from_secret": "dockerhub-password" + } + } + }, + ], + "trigger": { + "ref": [ + "refs/pull/**", + ], + }, + } + +def stepMergeMaster(arch): + return { + "kind": "pipeline", + "type": "docker", + "name": "docker-publish-%s" % (arch), + "platform": { + "os": "linux", + "arch": arch, + }, + "steps": [ + { + "name": "build-build-and-publish-image-%s" % (arch), + "image": "plugins/docker", + "settings": { + "dockerfile": "motsognir/Dockerfile", + "repo": "dragonchaser/motsognir", + "dry_run": "true", + "tag": "latest-%s" % (arch), + "username": { + "from_secret": "dockerhub-user" + }, + "password": { + "from_secret": "dockerhub-password" + } + } + }, + ], + "trigger": { + "ref": [ + "refs/heads/master", + ], + }, + } diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eef18b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.drone.yml diff --git a/motsognir/Dockerfile b/motsognir/Dockerfile index 9ddd1bf..c384c4c 100644 --- a/motsognir/Dockerfile +++ b/motsognir/Dockerfile @@ -14,6 +14,6 @@ RUN rm -Rfv /etc/apt/sources.list.* RUN rm -Rfv /build RUN useradd -ms /bin/bash -d /gopher gopher WORKDIR /gopher -COPY entrypoint.sh / -COPY rsyslog.conf /etc +COPY motsognir/entrypoint.sh / +COPY motsognir/rsyslog.conf /etc ENTRYPOINT ["/entrypoint.sh"] -- 2.49.1