From 8bfcfaec6232f0873c7ff3ada951a1a87f6a3f3a Mon Sep 17 00:00:00 2001 From: Erwan Rouchet <rouchet@teklia.com> Date: Tue, 24 Jan 2023 16:46:41 +0100 Subject: [PATCH] Remove Ponos git clone from build system --- .gitlab-ci.yml | 1 - Dockerfile | 10 ---------- Dockerfile.binary | 20 +++++--------------- Makefile | 5 ++--- ci/build.sh | 3 +-- 5 files changed, 8 insertions(+), 31 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e8baf1c96a..341362bf94 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,6 @@ include: before_script: # Custom line to install our own deps from Git using GitLab CI credentials - - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/teklia/arkindex/ponos#egg=ponos-server" - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/teklia/arkindex/transkribus#egg=transkribus-client" - pip install -r tests-requirements.txt codecov - "echo 'database: {host: postgres, port: 5432}\npublic_hostname: http://ci.arkindex.localhost' > $CONFIG_PATH" diff --git a/Dockerfile b/Dockerfile index a3f19987c5..480807d45d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,20 +5,10 @@ ADD . build RUN cd build && python3 setup.py sdist FROM registry.gitlab.com/teklia/arkindex/backend/base:django-4.1.5 -ARG PONOS_BRANCH=master -ARG PONOS_ID=10017043 ARG TRANSKRIBUS_BRANCH=master ARG TRANSKRIBUS_ID=11180199 ARG GITLAB_TOKEN="gaFM7LRa9zy9QMowcUhx" -# Install arkindex-ponos from private repo -RUN \ - mkdir /tmp/ponos && \ - wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/$PONOS_ID/repository/archive.tar.gz?sha=$PONOS_BRANCH -O /tmp/ponos/archive.tar.gz && \ - tar --strip-components=1 -xvf /tmp/ponos/archive.tar.gz -C /tmp/ponos && \ - cd /tmp/ponos && pip install --disable-pip-version-check --no-cache-dir --quiet . && \ - rm -rf /tmp/ponos - # Install transkribus-client from private repo RUN \ mkdir /tmp/transkribus && \ diff --git a/Dockerfile.binary b/Dockerfile.binary index 289e0c5ff3..0dee3f3f20 100644 --- a/Dockerfile.binary +++ b/Dockerfile.binary @@ -4,8 +4,6 @@ RUN apt-get update && apt-get install --no-install-recommends -y build-essential RUN pip install nuitka -ARG PONOS_BRANCH=master -ARG PONOS_ID=10017043 ARG TRANSKRIBUS_BRANCH=master ARG TRANSKRIBUS_ID=11180199 ARG GITLAB_TOKEN="gaFM7LRa9zy9QMowcUhx" @@ -19,12 +17,6 @@ ADD arkindex /usr/share/arkindex ADD base/requirements.txt /tmp/requirements-base-arkindex.txt ADD requirements.txt /tmp/requirements-arkindex.txt -# Retrieve ponos source code -RUN mkdir /tmp/ponos && \ - wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/$PONOS_ID/repository/archive.tar.gz?sha=$PONOS_BRANCH -O /tmp/ponos.tar.gz && \ - tar --strip-components=1 -xvf /tmp/ponos.tar.gz -C /tmp/ponos && \ - mv /tmp/ponos/ponos /usr/share - # Install transkribus-client from private repo RUN \ mkdir /tmp/transkribus && \ @@ -33,14 +25,13 @@ RUN \ mv /tmp/transkribus/transkribus /usr/share # Build full requirements, removing relative or remote references to arkindex projects -# Special case for approximate requirements from ponos, where we want to keep the versions specified from this repo -RUN cat /tmp/ponos/requirements-server.txt /tmp/requirements-*arkindex.txt | sort | uniq | grep -v -E '^arkindex|^#|^Django~=|^boto3~=|^cryptography~=|^django-enumfields~=|^djangorestframework~=|^pyyaml~=|transkribus-client' > /requirements.txt +RUN cat /tmp/requirements-*arkindex.txt | sort | uniq | grep -v -E '^arkindex|^#|transkribus-client' > /requirements.txt # List all management commands RUN find /usr/share/arkindex/*/management -name '*.py' -not -name '__init__.py' > /commands.txt -# Remove arkindex & ponos unit tests -RUN find /usr/share/arkindex /usr/share/ponos -type d -name tests | xargs rm -rf +# Remove arkindex unit tests +RUN find /usr/share/arkindex -type d -name tests | xargs rm -rf # This configuration is needed to avoid a compilation crash at linking stage # It only seems to happen on recent gcc @@ -50,9 +41,8 @@ ENV NUITKA_RESOURCE_MODE=linker # Compile all our python source code # Do not use the -O or -OO python flags here as it removes assert statements (see backend#432) RUN python -m nuitka \ - --nofollow-imports \ - --include-package=arkindex \ - --include-package=ponos \ +--nofollow-imports \ +--include-package=arkindex \ --include-package=transkribus \ --show-progress \ --lto=yes \ diff --git a/Makefile b/Makefile index acf28d4792..6b087eb458 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -PONOS_BRANCH=master IMAGE_TAG=registry.gitlab.com/teklia/arkindex/backend .PHONY: all release @@ -14,10 +13,10 @@ clean: find . -name '*.pyc' -exec rm {} \; build: - CI_PROJECT_DIR=$(ROOT_DIR) CI_REGISTRY_IMAGE=$(IMAGE_TAG) PONOS_BRANCH=$(PONOS_BRANCH) $(ROOT_DIR)/ci/build.sh Dockerfile + CI_PROJECT_DIR=$(ROOT_DIR) CI_REGISTRY_IMAGE=$(IMAGE_TAG) $(ROOT_DIR)/ci/build.sh Dockerfile binary: - CI_PROJECT_DIR=$(ROOT_DIR) CI_REGISTRY_IMAGE=$(IMAGE_TAG) PONOS_BRANCH=$(PONOS_BRANCH) $(ROOT_DIR)/ci/build.sh Dockerfile.binary -binary + CI_PROJECT_DIR=$(ROOT_DIR) CI_REGISTRY_IMAGE=$(IMAGE_TAG) $(ROOT_DIR)/ci/build.sh Dockerfile.binary -binary worker: arkindex/manage.py rqworker -v 2 default high diff --git a/ci/build.sh b/ci/build.sh index 517131802f..e46aff1a51 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -37,12 +37,11 @@ if [ -n "$CI_REGISTRY" -a -n "$CI_REGISTRY_USER" -a -n "$CI_REGISTRY_PASSWORD" ] echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY fi -PONOS_BRANCH=${PONOS_BRANCH:-master} IMAGE_TAG="$CI_REGISTRY_IMAGE:$VERSION" cd $CI_PROJECT_DIR docker pull "$CI_REGISTRY_IMAGE/base:latest" -docker build . -f $DOCKERFILE -t "$IMAGE_TAG" --build-arg "PONOS_BRANCH=$PONOS_BRANCH" +docker build . -f $DOCKERFILE -t "$IMAGE_TAG" if [ -n "$CI_REGISTRY" ]; then docker push "$IMAGE_TAG" fi -- GitLab