-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: aggregate release by git branch (#3941)
- Loading branch information
1 parent
2e10655
commit b1351dc
Showing
13 changed files
with
238 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
""" | ||
Generated by Erda Migrator. | ||
Please implement the function entry, and add it to the list entries. | ||
""" | ||
|
||
import json | ||
|
||
import django.db.models | ||
|
||
|
||
class DiceRelease(django.db.models.Model): | ||
""" | ||
generated by erda-cli | ||
""" | ||
|
||
release_id = django.db.models.CharField(primary_key=True) | ||
release_name = django.db.models.CharField() | ||
desc = django.db.models.TextField() | ||
dice = django.db.models.TextField() | ||
addon = django.db.models.TextField() | ||
labels = django.db.models.CharField() | ||
version = django.db.models.CharField() | ||
org_id = django.db.models.BigIntegerField() | ||
project_id = django.db.models.BigIntegerField() | ||
application_id = django.db.models.BigIntegerField() | ||
project_name = django.db.models.CharField() | ||
application_name = django.db.models.CharField() | ||
user_id = django.db.models.CharField() | ||
cluster_name = django.db.models.CharField() | ||
cross_cluster = django.db.models.BooleanField() | ||
resources = django.db.models.TextField() | ||
reference = django.db.models.BigIntegerField() | ||
created_at = django.db.models.DateTimeField() | ||
updated_at = django.db.models.DateTimeField() | ||
changelog = django.db.models.TextField() | ||
is_stable = django.db.models.BooleanField() | ||
is_formal = django.db.models.BooleanField() | ||
is_project_release = django.db.models.BooleanField() | ||
application_release_list = django.db.models.TextField() | ||
tags = django.db.models.CharField() | ||
git_branch = django.db.models.CharField() | ||
|
||
class Meta: | ||
db_table = "dice_release" | ||
|
||
|
||
def entry(): | ||
releases = DiceRelease.objects.all() | ||
|
||
for release in releases: | ||
try: | ||
fmt_labels = json.loads(release.labels) | ||
gitBranch = fmt_labels["gitBranch"] | ||
release.git_branch = gitBranch | ||
release.save() | ||
except Exception as e: | ||
print("release %s git branch parse error, exception: %s, skip" % (release.release_id, e)) | ||
pass | ||
|
||
entries: [callable] = [ | ||
entry, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2021 Terminus, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
ALTER table `dice_release` | ||
ADD COLUMN `git_branch` varchar(255) NOT NULL DEFAULT '' COMMENT '分支' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Django==3.2.4 | ||
mysql-connector-python==8.0.26 | ||
pytz==2021.1 | ||
sqlparse==0.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.