From 4a5b0f0e5edebd933652ebbf2e2fee38957b10f4 Mon Sep 17 00:00:00 2001 From: Michael Harbarth Date: Tue, 19 Nov 2024 19:17:38 +0100 Subject: [PATCH] feat: Add envvars and a first version of the ci-template --- capella_ros_tools/__main__.py | 3 +++ ci-templates/gitlab/export.yml | 18 ++++++++++++++++++ pyproject.toml | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 ci-templates/gitlab/export.yml diff --git a/capella_ros_tools/__main__.py b/capella_ros_tools/__main__.py index 7f008fd..c156d9c 100644 --- a/capella_ros_tools/__main__.py +++ b/capella_ros_tools/__main__.py @@ -125,18 +125,21 @@ def import_msgs( type=cli_helpers.ModelCLI(), required=True, help="Path to the Capella model.", + envvar="CAPELLA_ROS_TOOLS_MODEL", ) @click.option( "-l", "--layer", type=click.Choice(["oa", "la", "sa", "pa"], case_sensitive=False), help="The layer to export the model objects from.", + envvar="CAPELLA_ROS_TOOLS_LAYER", ) @click.option( "-r", "--root", type=click.UUID, help="The UUID of the root package to import the messages from.", + envvar="CAPELLA_ROS_TOOLS_ROOT_PACKAGE", ) @click.option( "-o", diff --git a/ci-templates/gitlab/export.yml b/ci-templates/gitlab/export.yml new file mode 100644 index 0000000..d8e5759 --- /dev/null +++ b/ci-templates/gitlab/export.yml @@ -0,0 +1,18 @@ +# Copyright DB InfraGO AG and contributors +# SPDX-License-Identifier: Apache-2.0 + +variables: + CAPELLA_ROS_TOOLS_MODEL: "." + CAPELLA_ROS_TOOLS_LAYER: "LA" + # Optional variables: + # $CAPELLA_ROS_TOOLS_VERSION - Use a specific version of the ROS tools + # $CAPELLA_ROS_TOOLS_ROOT_PACKAGE - UUID of the package to get classes from + +capella_ros_exporter: + script: + # - pip install "capella-ros-tools{CAPELLA_ROS_TOOLS_VERSION:+==$CAPELLA_ROS_TOOLS_VERSION}" + - pip install git+https://github.com/DSD-DBS/capella-ros-tools.git@add-ci-pipeline + - capella-ros-tools export -o ros-export + artifacts: + paths: + - ros-export diff --git a/pyproject.toml b/pyproject.toml index df64128..02029fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,9 @@ test = [ "pytest-cov", ] +[project.scripts] +capella-ros-tools = "capella_ros_tools.__main__:cli" + [tool.black] line-length = 79 target-version = ["py310"]