From 099a695f88e8efb3dcdf4ef3ced8bf9886a300b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= <remi.cresson@inrae.fr> Date: Tue, 11 Feb 2025 11:17:42 +0100 Subject: [PATCH 1/5] use collection ID after storage location --- .gitlab-ci.yml | 6 ++---- theia_dumper/__init__.py | 2 +- theia_dumper/stac.py | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6301451..737ecee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,9 +59,7 @@ pypi: stage: Pip only: - tags - before_script: - - python -m pip install --upgrade build twine script: + - python -m pip install --upgrade build twine - python -m build - after_script: - - python -m twine upload --repository-url https://upload.pypi.org/legacy/ --non-interactive --verbose -u __token__ -p $PYPI_TOKEN dist/* + - python -m twine upload --repository-url https://upload.pypi.org/legacy/ --non-interactive --verbose -u __token__ -p ${PYPI_TOKEN} dist/* diff --git a/theia_dumper/__init__.py b/theia_dumper/__init__.py index 6439e20..4c4eaf0 100644 --- a/theia_dumper/__init__.py +++ b/theia_dumper/__init__.py @@ -1,3 +1,3 @@ """Theia dumper package.""" -__version__ = "0.2.1" +__version__ = "0.2.2" diff --git a/theia_dumper/stac.py b/theia_dumper/stac.py index 29ec7fc..ee8154f 100644 --- a/theia_dumper/stac.py +++ b/theia_dumper/stac.py @@ -286,7 +286,7 @@ class StacUploadTransactionsHandler(StacTransactionsHandler): item: Stac item to publish assets_root_dir: Common path to all files, defined as assets root dir """ - tgt_bucket_root_url = urljoin(self.storage_endpoint, self.storage_bucket) + "/" + tgt_root_url = urljoin(self.storage_endpoint, f"{self.storage_bucket}/{item.collection_id}/") _check_naming_is_compliant(self.storage_bucket) _check_naming_is_compliant(item.id) @@ -295,7 +295,7 @@ class StacUploadTransactionsHandler(StacTransactionsHandler): logger.debug("Local file: %s", local_filename) file_relative_path = local_filename.replace(assets_root_dir, "") - target_url = urljoin(tgt_bucket_root_url, file_relative_path) + target_url = urljoin(tgt_root_url, file_relative_path) print(target_url) # Check that url part after storage bucket is compliant -- GitLab From 79bea4acfbb785de91c2cc29a1d203f706d3f652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= <remi.cresson@inrae.fr> Date: Tue, 11 Feb 2025 11:26:01 +0100 Subject: [PATCH 2/5] use collection id in tgt path --- theia_dumper/stac.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/theia_dumper/stac.py b/theia_dumper/stac.py index ee8154f..fca0814 100644 --- a/theia_dumper/stac.py +++ b/theia_dumper/stac.py @@ -286,7 +286,9 @@ class StacUploadTransactionsHandler(StacTransactionsHandler): item: Stac item to publish assets_root_dir: Common path to all files, defined as assets root dir """ - tgt_root_url = urljoin(self.storage_endpoint, f"{self.storage_bucket}/{item.collection_id}/") + tgt_root_url = urljoin( + self.storage_endpoint, f"{self.storage_bucket}/{item.collection_id}/" + ) _check_naming_is_compliant(self.storage_bucket) _check_naming_is_compliant(item.id) -- GitLab From b3d311067b3790bb1f0c2985822af6dae59c29d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= <remi.cresson@inrae.fr> Date: Tue, 11 Feb 2025 12:07:15 +0100 Subject: [PATCH 3/5] use collection id in tgt path --- .gitlab-ci.yml | 2 +- theia_dumper/cli.py | 3 ++- theia_dumper/stac.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 737ecee..d65747d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ variables: PYTHON_IMG: python:3.12-slim PACKAGE_INSTALL_EXTRAS: "[test]" - + LOGLEVEL: DEBUG DOC_BUILD_SELF: true stages: diff --git a/theia_dumper/cli.py b/theia_dumper/cli.py index 6902de8..bca8f44 100644 --- a/theia_dumper/cli.py +++ b/theia_dumper/cli.py @@ -9,6 +9,7 @@ from .stac import ( StacTransactionsHandler, DEFAULT_S3_EP, DEFAULT_STAC_EP, + DEFAULT_S3_STORAGE, ) from . import diff @@ -37,7 +38,7 @@ def theia_dumper() -> None: "--storage_bucket", help="Storage bucket assets will be sent to", type=str, - default="sm1-gdc", + default=DEFAULT_S3_STORAGE, ) @click.option( "-o", diff --git a/theia_dumper/stac.py b/theia_dumper/stac.py index fca0814..60c8fa0 100644 --- a/theia_dumper/stac.py +++ b/theia_dumper/stac.py @@ -19,6 +19,7 @@ from .logger import logger DEFAULT_STAC_EP = "https://stacapi-cdos.apps.okd.crocc.meso.umontpellier.fr" DEFAULT_S3_EP = "https://s3-data.meso.umontpellier.fr" +DEFAULT_S3_STORAGE = "sm1-gdc-ext" class STACObjectUnresolved(Exception): -- GitLab From d1e83f4f14b14d2057a2e6e41bcc3bac832f2e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= <remi.cresson@inrae.fr> Date: Tue, 11 Feb 2025 12:10:51 +0100 Subject: [PATCH 4/5] use collection id in tgt path --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d65747d..737ecee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ variables: PYTHON_IMG: python:3.12-slim PACKAGE_INSTALL_EXTRAS: "[test]" - LOGLEVEL: DEBUG + DOC_BUILD_SELF: true stages: -- GitLab From e409ee66df20f8b216f5d2aced10a4f451b712c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= <remi.cresson@inrae.fr> Date: Tue, 11 Feb 2025 12:43:12 +0100 Subject: [PATCH 5/5] use collection id in tgt path --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 737ecee..f038f63 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -62,4 +62,4 @@ pypi: script: - python -m pip install --upgrade build twine - python -m build - - python -m twine upload --repository-url https://upload.pypi.org/legacy/ --non-interactive --verbose -u __token__ -p ${PYPI_TOKEN} dist/* + - python -m twine upload --repository-url https://upload.pypi.org/legacy/ --non-interactive --verbose -u __token__ -p ${pypi_token} dist/* -- GitLab