コード例 #1
0
 def create_version(project, user):
     version = Version()
     version.VProjectID = project.id
     version.VVersion = '1.0.0'
     version.CFTCommitor = user.id
     version.save()
     VersionService.log_create_activity(user, version)
コード例 #2
0
def delete_version(request, projectid, version_id):
    result = True
    try:
        VersionService.delete_version(request, version_id)
    except Exception as ex:
        result = Version.version_delete_fail
        SimpleLogger.error(ex)
    return HttpResponse(result)
コード例 #3
0
 def create_version(project, user):
     version = Version()
     version.VProjectID = project.id
     version.VVersion = '1.0.0'
     version.CFTCommitor = user.id
     version.VStartDate = str(datetime.date.today())
     print(str(datetime.date.today()))
     version.VReleaseDate = str(datetime.date.today())
     version.save()
     VersionService.log_create_activity(user, version)
コード例 #4
0
 def get_latest_projects(request):
     result = list()
     latest_project_ids = VersionService.get_latests_project_ids(request)
     for project_id in latest_project_ids:
         temp_project = Project.objects.get(project_id)
         result.append(temp_project)
     return result
コード例 #5
0
ファイル: ci_task_service.py プロジェクト: zzzz123321/Teamcat
 def start_ci_task(request, task_id, parameter_group_id, project_version):
     ci_task = CITask.objects.get(int(task_id))
     queuetask = TaskQueue()
     queuetask.EnqueueTime = DateTimeHelper.get_local_now()
     queuetask.TaskType = ci_task.TaskType
     queuetask.Command = TaskQueueCommandTypeEnum.TaskQueueCommandType_Start
     queuetask.Priority = 2
     queuetask.Status = TaskQueueStatusEnum.QueueTaskStatus_New
     queuetask.TaskID = int(task_id)
     queuetask.TaskUUID = uuid.uuid1()
     if parameter_group_id:
         queuetask.BuildParameterID = parameter_group_id
     else:
         queuetask.BuildParameterID = CITaskParameterService.default_parameter_group(
             int(task_id))
     queuetask.save()
     ci_task.BuildVersion = ci_task.BuildVersion + 1
     if str(project_version) == '0':
         project_version = VersionService.get_latest_version(
             ci_task.Project)
         if project_version:
             project_version = project_version.id
         else:
             project_version = 0
     ci_task.LastHistory = CITaskService.save_ci_taskhistory(
         request, queuetask, ci_task, project_version)
     ci_task.save(update_fields=['BuildVersion', 'LastHistory'])
     message = "任务ID为:" + str(task_id) + "的执行指令已经下发,请耐心等待。"
     user_id = 0
     if request.user.id:
         user_id = request.user.id
     CITaskService.log_build_activity(user_id, ci_task)
     CITaskService.send_task_enqueue_message()
     return [queuetask.id, message, queuetask.TaskUUID]
コード例 #6
0
 def get_version_dropdown_menu(self, project_id, selected_version):
     vm_versions = list()
     for dm_version in VersionService.get_project_version(project_id):
         temp_version = VM_ProjectVersion(dm_version, selected_version)
         vm_versions.append(temp_version)
     pagefileds = {"versions": vm_versions}
     return self.get_webpart(
         pagefileds, ProjectCommonControllPath.version_dropdown_menu)
コード例 #7
0
 def get_version_dropdown_list(self,project_id):
     vm_versions=list()
     print(1)
     for dm_version in VersionService.get_project_version(project_id):
         print(dm_version.id)
         temp_version=VM_ProjectVersion(dm_version)
         vm_versions.append(temp_version)
     pagefileds={"versions":vm_versions}
     return self.get_webpart(pagefileds,ProjectCommonControllPath.version_dropdown_list_path)
コード例 #8
0
 def get_version_dropdown_list(self,
                               project_id,
                               selected_version=0,
                               default_none=True):
     if str(selected_version) == "0":
         default = "<option selected value=\"0\">无</option>"
     else:
         default = "<option  value=\"0\">无</option>"
     vm_versions = list()
     for dm_version in VersionService.get_project_version(project_id):
         temp_version = VM_ProjectVersion(dm_version, selected_version)
         vm_versions.append(temp_version)
     pagefileds = {"versions": vm_versions}
     if default_none:
         result = default + self.get_webpart(
             pagefileds,
             ProjectCommonControllPath.version_dropdown_list_path)
     else:
         result = self.get_webpart(
             pagefileds,
             ProjectCommonControllPath.version_dropdown_list_path)
     return result
コード例 #9
0
 def get_latest_version(self, project_id):
     result = '--'
     latest_version = VersionService.get_latest_version(project_id)
     if latest_version:
         result = latest_version.id
     return result
コード例 #10
0
ファイル: ci_serializer.py プロジェクト: zzzz123321/Teamcat
 def get_ProjectVersionFormat(self, obj):
     result = '--'
     version = VersionService.get_version(obj.ProjectVersion)
     if version:
         result = version.VVersion
     return result
コード例 #11
0
 def get_project_latest_version(project_id):
     result = 0
     version = VersionService.get_latest_version(project_id)
     if version:
         result = version.id
     return result
コード例 #12
0
ファイル: vm_project.py プロジェクト: zzzz123321/Teamcat
 def lastest_version(self):
     result = "--"
     version = VersionService.get_latest_version(self.project.id)
     if version:
         result = version.VVersion
     return result