Skip to content

Commit

Permalink
Merge pull request #209 from normal-wls/feature_component_support_def…
Browse files Browse the repository at this point in the history
…ault_version_3.24lts

feature: 插件支持默认版本标记
  • Loading branch information
hanshuaikang authored Dec 8, 2023
2 parents bf8bfd0 + 44ead0f commit a442fad
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion runtime/bamboo-pipeline/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

default_app_config = "pipeline.apps.PipelineConfig"

__version__ = "3.24.1"
__version__ = "3.24.4"
11 changes: 10 additions & 1 deletion runtime/bamboo-pipeline/pipeline/component_framework/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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='是否是默认版本'),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion runtime/bamboo-pipeline/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit a442fad

Please sign in to comment.