From 4d231131f5800ee49877045d6fc0901595892c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20G=C3=B6bel?= <dgoebel@techfak.uni-bielefeld.de> Date: Mon, 6 Nov 2023 09:51:35 +0100 Subject: [PATCH] Use GitLab Dependency Proxy in CI pipeline #62 --- .gitlab-ci.yml | 10 +++++----- app/git_repository/abstract_repository.py | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9f7e74e..ec216b8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: python:3.11-slim +image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.11-slim variables: PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" @@ -43,7 +43,7 @@ integration-test-job: # Runs integration tests with the database DB_DATABASE: "integration-test-db" DB_HOST: "integration-test-db" services: - - name: mysql:8 + - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/mysql:8 alias: integration-test-db variables: MYSQL_RANDOM_ROOT_PASSWORD: "yes" @@ -71,7 +71,7 @@ e2e-test-job: # Runs e2e tests on the API endpoints DB_DATABASE: "e2e-test-db" DB_HOST: "e2e-test-db" services: - - name: mysql:8 + - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/mysql:8 alias: e2e-test-db variables: MYSQL_RANDOM_ROOT_PASSWORD: "yes" @@ -136,7 +136,7 @@ lint-test-job: # Runs linters checks on code publish-dev-docker-container-job: stage: deploy image: - name: gcr.io/kaniko-project/executor:v1.16.0-debug + name: gcr.io/kaniko-project/executor:v1.17.0-debug entrypoint: [""] dependencies: [] only: @@ -159,7 +159,7 @@ publish-dev-docker-container-job: publish-docker-container-job: stage: deploy image: - name: gcr.io/kaniko-project/executor:v1.16.0-debug + name: gcr.io/kaniko-project/executor:v1.17.0-debug entrypoint: [""] dependencies: [] only: diff --git a/app/git_repository/abstract_repository.py b/app/git_repository/abstract_repository.py index ec974ea..2ac6a39 100644 --- a/app/git_repository/abstract_repository.py +++ b/app/git_repository/abstract_repository.py @@ -145,12 +145,13 @@ class GitRepository(ABC): Flags if the files exist. """ with tracer.start_as_current_span("git_check_files_exists") as span: - span.set_attribute("repository", self.url) + span.set_attributes({"repository": self.url, "files": files}) tasks = [asyncio.ensure_future(self.check_file_exists(file, client=client)) for file in files] result = await asyncio.gather(*tasks) if raise_error: missing_files = [f for f, exist in zip(files, result) if not exist] if len(missing_files) > 0: + span.set_attribute("missing_files", missing_files) raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail=f"The files {', '.join(missing_files)} are missing in the repo {str(self)}", @@ -175,7 +176,8 @@ class GitRepository(ABC): with SpooledTemporaryFile(max_size=512000) as f: # temporary file with 500kB data spooled in memory await self.download_file(filepath, client=client, file_handle=f) f.seek(0) - obj.upload_fileobj(f) + with tracer.start_as_current_span("s3_upload_file"): + obj.upload_fileobj(f) async def download_file_stream(self, filepath: str, client: AsyncClient) -> AsyncIterator[bytes]: """ -- GitLab