diff --git a/runtime/bamboo-pipeline/pipeline/__init__.py b/runtime/bamboo-pipeline/pipeline/__init__.py index b1d6c830..b23fe959 100644 --- a/runtime/bamboo-pipeline/pipeline/__init__.py +++ b/runtime/bamboo-pipeline/pipeline/__init__.py @@ -13,4 +13,4 @@ default_app_config = "pipeline.apps.PipelineConfig" -__version__ = "3.24.1" +__version__ = "3.24.4" diff --git a/runtime/bamboo-pipeline/pipeline/component_framework/base.py b/runtime/bamboo-pipeline/pipeline/component_framework/base.py index 6f472722..4358189b 100644 --- a/runtime/bamboo-pipeline/pipeline/component_framework/base.py +++ b/runtime/bamboo-pipeline/pipeline/component_framework/base.py @@ -65,6 +65,9 @@ def __new__(cls, name, bases, attrs): if not getattr(new_class, "version", None): setattr(new_class, "version", LEGACY_PLUGINS_VERSION) + if not getattr(new_class, "is_default_version", None): + setattr(new_class, "is_default_version", False) + # category/group name group_name = getattr(module, "__group_name__", new_class.__module__.split(".")[-1].title()) setattr(new_class, "group_name", group_name) @@ -85,7 +88,13 @@ def __new__(cls, name, bases, attrs): try: print("update {} component model".format(new_class.code)) ComponentModel.objects.update_or_create( - code=new_class.code, version=new_class.version, defaults={"name": new_name, "status": __debug__} + code=new_class.code, + version=new_class.version, + defaults={ + "name": new_name, + "status": __debug__, + "is_default_version": new_class.is_default_version, + }, ) except Exception as e: if not isinstance(e, ProgrammingError): diff --git a/runtime/bamboo-pipeline/pipeline/component_framework/migrations/0008_componentmodel_is_default_version.py b/runtime/bamboo-pipeline/pipeline/component_framework/migrations/0008_componentmodel_is_default_version.py new file mode 100644 index 00000000..d4586ec2 --- /dev/null +++ b/runtime/bamboo-pipeline/pipeline/component_framework/migrations/0008_componentmodel_is_default_version.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.15 on 2023-12-07 13:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('component_framework', '0007_auto_20201112_2244'), + ] + + operations = [ + migrations.AddField( + model_name='componentmodel', + name='is_default_version', + field=models.BooleanField(default=False, verbose_name='是否是默认版本'), + ), + ] diff --git a/runtime/bamboo-pipeline/pipeline/component_framework/models.py b/runtime/bamboo-pipeline/pipeline/component_framework/models.py index 09aad88f..d490c968 100644 --- a/runtime/bamboo-pipeline/pipeline/component_framework/models.py +++ b/runtime/bamboo-pipeline/pipeline/component_framework/models.py @@ -64,6 +64,7 @@ class ComponentModel(models.Model): code = models.CharField(_("组件编码"), max_length=255, db_index=True) version = models.CharField(_("组件版本"), max_length=64, default=LEGACY_PLUGINS_VERSION, db_index=True) name = models.CharField(_("组件名称"), max_length=255) + is_default_version = models.BooleanField(_("是否是默认版本"), default=False) status = models.BooleanField(_("组件是否可用"), default=True) objects = ComponentManager() diff --git a/runtime/bamboo-pipeline/pyproject.toml b/runtime/bamboo-pipeline/pyproject.toml index bd83eeee..16fbc202 100644 --- a/runtime/bamboo-pipeline/pyproject.toml +++ b/runtime/bamboo-pipeline/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bamboo-pipeline" -version = "3.24.3" +version = "3.24.4" description = "runtime for bamboo-engine base on Django and Celery" authors = ["homholueng "] license = "MIT"