From aeaa1dc8e15db98d6577c7b8587e10cd11bbe41c Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 19 Feb 2021 09:48:31 +0100 Subject: [PATCH] ci: optimize build process and dependencies (#84) --- .drone.jsonnet | 37 +++++++++++++++++++++++++------------ .drone.yml | 20 +++++++++++--------- docker/Dockerfile.amd64 | 1 + docker/Dockerfile.arm | 1 + docker/Dockerfile.arm64 | 1 + 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 899035a..9ee90cf 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -6,6 +6,7 @@ local PythonVersion(pyversion='3.6') = { }, commands: [ 'pip install poetry poetry-dynamic-versioning -qq', + 'poetry config experimental.new-installer false', 'poetry install -E ansible-base', 'poetry run pytest', 'poetry version', @@ -33,6 +34,7 @@ local PipelineLint = { commands: [ 'git fetch -tq', 'pip install poetry poetry-dynamic-versioning -qq', + 'poetry config experimental.new-installer false', 'poetry install', 'poetry run yapf -dr ./ansiblelater', ], @@ -196,24 +198,35 @@ local PipelineBuildPackage = { }; local PipelineBuildContainer(arch='amd64') = { + local build = if arch == 'arm' then [{ + name: 'build', + image: 'python:3.9-alpine', + commands: [ + 'apk add -Uq --no-cache build-base libressl-dev libffi-dev musl-dev python3-dev git cargo', + 'git fetch -tq', + 'pip install poetry poetry-dynamic-versioning -qq', + 'poetry build', + ], + environment: { + CARGO_NET_GIT_FETCH_WITH_CLI: true, + }, + }] else [{ + name: 'build', + image: 'python:3.9', + commands: [ + 'git fetch -tq', + 'pip install poetry poetry-dynamic-versioning -qq', + 'poetry build', + ], + }], + kind: 'pipeline', name: 'build-container-' + arch, platform: { os: 'linux', arch: arch, }, - steps: [ - { - name: 'build', - image: 'python:3.9-alpine', - commands: [ - 'apk --update --quiet add build-base libffi-dev musl-dev libressl-dev python3-dev cargo git', - 'git fetch -tq', - 'pip install --upgrade --no-cache-dir pip', - 'pip install poetry poetry-dynamic-versioning -qq', - 'poetry build', - ], - }, + steps: build + [ { name: 'dryrun', image: 'thegeeklab/drone-docker:19', diff --git a/.drone.yml b/.drone.yml index e8b85ae..4c15391 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,6 +12,7 @@ steps: commands: - git fetch -tq - pip install poetry poetry-dynamic-versioning -qq + - poetry config experimental.new-installer false - poetry install - poetry run yapf -dr ./ansiblelater environment: @@ -51,6 +52,7 @@ steps: image: python:3.6 commands: - pip install poetry poetry-dynamic-versioning -qq + - poetry config experimental.new-installer false - poetry install -E ansible-base - poetry run pytest - poetry version @@ -64,6 +66,7 @@ steps: image: python:3.7 commands: - pip install poetry poetry-dynamic-versioning -qq + - poetry config experimental.new-installer false - poetry install -E ansible-base - poetry run pytest - poetry version @@ -77,6 +80,7 @@ steps: image: python:3.8 commands: - pip install poetry poetry-dynamic-versioning -qq + - poetry config experimental.new-installer false - poetry install -E ansible-base - poetry run pytest - poetry version @@ -90,6 +94,7 @@ steps: image: python:3.9 commands: - pip install poetry poetry-dynamic-versioning -qq + - poetry config experimental.new-installer false - poetry install -E ansible-base - poetry run pytest - poetry version @@ -221,11 +226,9 @@ platform: steps: - name: build - image: python:3.9-alpine + image: python:3.9 commands: - - apk --update --quiet add build-base libffi-dev musl-dev libressl-dev python3-dev cargo git - git fetch -tq - - pip install --upgrade --no-cache-dir pip - pip install poetry poetry-dynamic-versioning -qq - poetry build @@ -301,11 +304,9 @@ platform: steps: - name: build - image: python:3.9-alpine + image: python:3.9 commands: - - apk --update --quiet add build-base libffi-dev musl-dev libressl-dev python3-dev cargo git - git fetch -tq - - pip install --upgrade --no-cache-dir pip - pip install poetry poetry-dynamic-versioning -qq - poetry build @@ -383,11 +384,12 @@ steps: - name: build image: python:3.9-alpine commands: - - apk --update --quiet add build-base libffi-dev musl-dev libressl-dev python3-dev cargo git + - apk add -Uq --no-cache build-base libressl-dev libffi-dev musl-dev python3-dev git cargo - git fetch -tq - - pip install --upgrade --no-cache-dir pip - pip install poetry poetry-dynamic-versioning -qq - poetry build + environment: + CARGO_NET_GIT_FETCH_WITH_CLI: true - name: dryrun image: thegeeklab/drone-docker:19 @@ -633,6 +635,6 @@ depends_on: --- kind: signature -hmac: a3c1fab4fd9b55b5c90d443ade4979500139863a28e417e679ef9157909217ce +hmac: b3355b546c9c55cb7c83d1a6b2ae59ec4177e6495b050bc8ecae62bb7a61eceb ... diff --git a/docker/Dockerfile.amd64 b/docker/Dockerfile.amd64 index 301c03b..3ca8253 100644 --- a/docker/Dockerfile.amd64 +++ b/docker/Dockerfile.amd64 @@ -8,6 +8,7 @@ LABEL org.opencontainers.image.source="https://github.com/thegeeklab/ansible-lat LABEL org.opencontainers.image.documentation="https://ansible-later.geekdocs.de/" ENV PY_COLORS=1 +ENV CARGO_NET_GIT_FETCH_WITH_CLI=true ADD dist/ansible_later-*.whl / diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index acc30cd..416e109 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -8,6 +8,7 @@ LABEL org.opencontainers.image.source="https://github.com/thegeeklab/ansible-lat LABEL org.opencontainers.image.documentation="https://ansible-later.geekdocs.de/" ENV PY_COLORS=1 +ENV CARGO_NET_GIT_FETCH_WITH_CLI=true ADD dist/ansible_later-*.whl / diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 index 81ce121..c366f32 100644 --- a/docker/Dockerfile.arm64 +++ b/docker/Dockerfile.arm64 @@ -8,6 +8,7 @@ LABEL org.opencontainers.image.source="https://github.com/thegeeklab/ansible-lat LABEL org.opencontainers.image.documentation="https://ansible-later.geekdocs.de/" ENV PY_COLORS=1 +ENV CARGO_NET_GIT_FETCH_WITH_CLI=true ADD dist/ansible_later-*.whl /