From c1dcfa78f77e914685fab41ccc4c9dcfd2934e26 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 9 Feb 2021 10:45:07 +0100 Subject: [PATCH] refactor: cleanup docker setup (#9) --- .drone.star | 18 +++++++++++++++--- ...Dockerfile.linux.amd64 => Dockerfile.amd64} | 4 +++- .../{Dockerfile.linux.arm => Dockerfile.arm} | 4 +++- ...Dockerfile.linux.arm64 => Dockerfile.arm64} | 4 +++- docker/manifest.tmpl | 6 +++--- 5 files changed, 27 insertions(+), 9 deletions(-) rename docker/{Dockerfile.linux.amd64 => Dockerfile.amd64} (93%) rename docker/{Dockerfile.linux.arm => Dockerfile.arm} (93%) rename docker/{Dockerfile.linux.arm64 => Dockerfile.arm64} (93%) diff --git a/.drone.star b/.drone.star index abc7621..4eb7660 100644 --- a/.drone.star +++ b/.drone.star @@ -143,7 +143,7 @@ def linux(ctx, arch): "name": "docker", "image": "plugins/docker", "settings": { - "dockerfile": "docker/Dockerfile.linux.%s" % (arch), + "dockerfile": "docker/Dockerfile.%s" % (arch), "repo": "owncloudci/%s" % (ctx.repo.name), "username": { "from_secret": "docker_username", @@ -152,14 +152,26 @@ def linux(ctx, arch): "from_secret": "docker_password", }, "auto_tag": True, - "auto_tag_suffix": "linux-%s" % (arch), + "auto_tag_suffix": "%s" % (arch), + }, + }) + else: + steps.append({ + "name": "dryrun", + "image": "plugins/docker", + "settings": { + 'dry_run': True, + "dockerfile": "docker/Dockerfile.%s" % (arch), + "repo": "owncloudci/%s" % (ctx.repo.name), + "auto_tag": True, + "auto_tag_suffix": "%s" % (arch), }, }) return { "kind": "pipeline", "type": "docker", - "name": "linux-%s" % (arch), + "name": "build-%s" % (arch), "platform": { "os": "linux", "arch": arch, diff --git a/docker/Dockerfile.linux.amd64 b/docker/Dockerfile.amd64 similarity index 93% rename from docker/Dockerfile.linux.amd64 rename to docker/Dockerfile.amd64 index fa27fa1..657f742 100644 --- a/docker/Dockerfile.linux.amd64 +++ b/docker/Dockerfile.amd64 @@ -7,8 +7,10 @@ LABEL org.opencontainers.image.url="https://github.com/owncloud-ci/drone-ansible LABEL org.opencontainers.image.source="https://github.com/owncloud-ci/drone-ansible" LABEL org.opencontainers.image.documentation="https://github.com/owncloud-ci/drone-ansible" +ARG ANSIBLE_VERSION + # renovate: datasource=pypi depName=ansible -ENV ANSIBLE_VERSION="2.10.5" +ENV ANSIBLE_VERSION="${ANSIBLE_VERSION:-2.10.5}" RUN apk add --no-cache bash git curl rsync openssh-client sshpass py3-pip py3-requests py3-paramiko python3-dev libffi-dev libressl-dev libressl build-base && \ pip3 install -U pip && \ diff --git a/docker/Dockerfile.linux.arm b/docker/Dockerfile.arm similarity index 93% rename from docker/Dockerfile.linux.arm rename to docker/Dockerfile.arm index 7a74f15..3e63e50 100644 --- a/docker/Dockerfile.linux.arm +++ b/docker/Dockerfile.arm @@ -7,8 +7,10 @@ LABEL org.opencontainers.image.url="https://github.com/owncloud-ci/drone-ansible LABEL org.opencontainers.image.source="https://github.com/owncloud-ci/drone-ansible" LABEL org.opencontainers.image.documentation="https://github.com/owncloud-ci/drone-ansible" +ARG ANSIBLE_VERSION + # renovate: datasource=pypi depName=ansible -ENV ANSIBLE_VERSION="2.10.5" +ENV ANSIBLE_VERSION="${ANSIBLE_VERSION:-2.10.5}" RUN apk add --no-cache bash git curl rsync openssh-client sshpass py3-pip py3-requests py3-paramiko python3-dev libffi-dev libressl-dev libressl build-base && \ pip3 install -U pip && \ diff --git a/docker/Dockerfile.linux.arm64 b/docker/Dockerfile.arm64 similarity index 93% rename from docker/Dockerfile.linux.arm64 rename to docker/Dockerfile.arm64 index e4919af..8f4ab7b 100644 --- a/docker/Dockerfile.linux.arm64 +++ b/docker/Dockerfile.arm64 @@ -7,8 +7,10 @@ LABEL org.opencontainers.image.url="https://github.com/owncloud-ci/drone-ansible LABEL org.opencontainers.image.source="https://github.com/owncloud-ci/drone-ansible" LABEL org.opencontainers.image.documentation="https://github.com/owncloud-ci/drone-ansible" +ARG ANSIBLE_VERSION + # renovate: datasource=pypi depName=ansible -ENV ANSIBLE_VERSION="2.10.5" +ENV ANSIBLE_VERSION="${ANSIBLE_VERSION:-2.10.5}" RUN apk add --no-cache bash git curl rsync openssh-client sshpass py3-pip py3-requests py3-paramiko python3-dev libffi-dev libressl-dev libressl build-base && \ pip3 install -U pip && \ diff --git a/docker/manifest.tmpl b/docker/manifest.tmpl index b916318..30855bc 100644 --- a/docker/manifest.tmpl +++ b/docker/manifest.tmpl @@ -6,16 +6,16 @@ tags: {{/each}} {{/if}} manifests: - - image: owncloudci/drone-ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 + - image: owncloudci/drone-ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64 platform: architecture: amd64 os: linux - - image: owncloudci/drone-ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64 + - image: owncloudci/drone-ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64 platform: architecture: arm64 os: linux variant: v8 - - image: owncloudci/drone-ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm + - image: owncloudci/drone-ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm platform: architecture: arm os: linux