从本地代码scm info中获取scm url :param scm_info: :return:
(self, scm_info)
| 140 | return task_rules, task_result_paths |
| 141 | |
| 142 | def _get_scm_url(self, scm_info): |
| 143 | """ |
| 144 | 从本地代码scm info中获取scm url |
| 145 | :param scm_info: |
| 146 | :return: |
| 147 | """ |
| 148 | if not scm_info.url: |
| 149 | err_msg = "本地代码库获取不到 [origin标签] 远程代码库链接," \ |
| 150 | "请在代码目录下检查确认是否为空: git config --get remote.origin.url," \ |
| 151 | "并执行以下命令进行设置:git remote add origin ${代码库链接}" |
| 152 | raise NodeError(code=errcode.E_NODE_TASK_SCM_FAILED, msg=err_msg) |
| 153 | format_url = BaseScmUrlMgr.format_url(scm_info.url) |
| 154 | if self._scm_type == "git": |
| 155 | if "master" == scm_info.branch: # 为了兼容旧版,master分支直接只用url,不加分支名 |
| 156 | return format_url |
| 157 | else: |
| 158 | return "%s#%s" % (format_url, scm_info.branch) |
| 159 | else: |
| 160 | raise NodeError(code=errcode.E_NODE_TASK_SCM_FAILED, msg="不支持的scm类型: %s!" % self._scm_type) |
| 161 | |
| 162 | def _check_config_info(self): |
| 163 | """ |
nothing calls this directly
no test coverage detected