简体   繁体   English

如何在单个 Bitbucket 管道中跟踪多个存储库的部署和提交?

[英]How to track deployment and commits of multiple repositories in a single Bitbucket pipeline?

We host a project's source code on Bitbucket, in multiple repositories, one for the backend, one from the frontend, and one for server configuration and deployment.我们在 Bitbucket 上托管了一个项目的源代码,在多个存储库中,一个用于后端,一个来自前端,一个用于服务器配置和部署。

The deployment is done with a Bitbucket custom pipeline hosted in the latter repository (where "custom" means triggered manually or by a scheduler, not by pushing to branch).部署是通过托管在后一个存储库中的 Bitbucket 自定义管道完成的(其中“自定义”意味着手动触发或由调度程序触发,而不是通过推送到分支)。 In the pipeline, we clone the other repositories (using an SSH key for authentication), build Docker images, push them to a Docker repository, and then trigger the deployment on the server.在管道中,我们克隆其他存储库(使用 SSH 密钥进行身份验证),构建 Docker 图像,将它们推送到 Docker 存储库,然后触发服务器上的部署。

This is all working well, except for how it's tracked in Bitbucket and Jira.这一切都运行良好,除了在 Bitbucket 和 Jira 中的跟踪方式。 In Bitbucket, in the pipelines overview, it shows the latest commit that was deployed by a pipeline run.在 Bitbucket 中,在管道概述中,它显示了管道运行部署的最新提交。 However, since the pipeline is in the config repository, this will only show commits of the config repository.但是,由于管道位于配置存储库中,因此这只会显示配置存储库的提交。 Since the config rarely changes, most of our commits are in the backend and frontend repositories, so this "latest commit" rarely represents the latest change that was deployed.由于配置很少更改,我们的大部分提交都在后端和前端存储库中,因此这个“最新提交”很少代表已部署的最新更改。

Similarly, and more annoyingly, when connecting Jira with Bitbucket , Jira only associates commits in the config repository with a deployment.同样,更烦人的是,当将 Jira 与 Bitbucket 连接时,Jira 仅将配置存储库中的提交与部署相关联。 All the interesting work done in the backend and frontend repositories isn't seen.没有看到在后端和前端存储库中完成的所有有趣工作。

Is there away to tell Bitbucket that multiple repositories are involved in a pipeline deploy?是否可以告诉 Bitbucket 管道部署涉及多个存储库? I believe this is currently not possible, so this would have to be a feature request for Atlassian.我相信这目前是不可能的,所以这必须是 Atlassian 的功能请求。

Does anybody know of a workaround?有人知道解决方法吗? I was thinking, maybe having the backend and frontend repos as git submodules of the config repo might work?我在想,也许将后端和前端回购作为配置回购的 git 子模块可能会起作用吗? Git submodules scare me, so I don't want to try only to find out that Bitbucket/Jira would not see the commits/issues in the submodules anyway. Git 子模块吓到我了,所以我不想只尝试发现 Bitbucket/Jira 无论如何都看不到子模块中的提交/问题。

Another workaround could be to push a dummy commit with a commit message that summarizes all commits done in all repos.另一种解决方法是使用总结所有回购中完成的所有提交的提交消息来推送虚拟提交。 That commit would have to be already pushed to the config repo when the pipeline is started, so that would maybe have to be done in a separate pipeline: the first pipeline pushes the summary commit and then triggers the second pipeline for the actual deployment.当管道启动时,该提交必须已经推送到配置存储库,因此可能必须在单独的管道中完成:第一个管道推送摘要提交,然后触发第二个管道进行实际部署。

Put everything, all software components plus configuration and infrastructure, together in a monorepository.把所有的东西,所有的软件组件加上配置和基础设施,放在一个单一的存储库中。

Otherwise, yes, use git submodules in a parent repo and track submodules refs updates as meaningful commits.否则,是的,在父仓库中使用 git 个子模块并将子模块引用更新跟踪为有意义的提交。 If that scares you, you should really not be splitting your code in multiple repos.如果这让您感到害怕,那么您真的不应该将您的代码拆分为多个存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM