6

我有一个简单的 Heroku 部署管道(查看应用程序 -> 开发 -> 登台 -> 生产)。如果我推送一些东西,master那么它将触发 CI(codeship),如果测试成功运行,Codeship 会将更改部署到developmentHeroku 应用程序。这很简单。

但是我们如何管理修补程序呢?如果我们master出于任何原因无法将当前部署到生产环境中会发生什么。

我刚刚阅读了一篇文章,它说我们应该使用 git 标签处理修补程序。它是管理修补程序的唯一方法吗?我们可以在不使用 git 标签的情况下处理这些吗?

4

3 回答 3

3

master是您的部署分支。所以修补程序也在master分支中完成。

我假设您也有一个开发分支。因此,如果您有正在进行的工作,您将继续在开发分支上进行,而不是将其合并到master.

如果master坏了 - 你必须修复它(因此是修补程序)。您修复问题,将其推送到 master,然后继续部署周期。

然后,您还应该将修补程序挑选回您的开发分支。

更新

如果您希望坚持使用单个master分支,那么我看不到使用修补程序分支的解决方法。

您不必每次都标记一个。但关键是要知道哪个版本是当前生产槽中的最后一个稳定版本。

开发人员继续工作master- 它进入暂存阶段,但您认为它无法继续掌握。

那么你:

  • 根据当前版本创建一个新分支 - 这是修补程序分支。
  • 创建修复
  • 部署它
  • 合并到master
于 2018-10-07T11:09:42.143 回答
2

对于仍然对此感到困惑的任何人,Heroku Pipelines 允许您从任何分支部署您的生产应用程序:

选择要部署的分支

您可以通过从当前部署到生产应用程序的代码手动创建分支并挑选您需要的修复程序来发布修补程序。

于 2019-08-28T18:07:59.783 回答
1

首先,我们需要准备遥控器:

git remote -v
# should contain the production remote with whatever name (better producation for sure), for example:
#
# production    https://git.heroku.com/your-repo-prod.git (fetch)
# production    https://git.heroku.com/your-repo-prod.git (push)
# staging   https://git.heroku.com/your-repo-staging.git (fetch)
# staging   https://git.heroku.com/your-repo-staging.git (push)

# if not, use this to add:
git remote add production https://git.heroku.com/your-repo.git

然后:您需要最新的远程分支:

git fetch production

然后:需要基于生产Heroku-branch创建新的分支:

git checkout -b hotfix/TICKET -t production/master

# where 'hotfix/TICKET' is your preferred branch name

然后您需要应用修补程序更改,例如:

1)手动:

# -> do something with codebase
git add .
git commit -m "hotfix: bla..."

2)通过cherry-pick特定提交:

git cherry-pick COMMIT_HASH

# or use this, if you need to cherry-pick the 'merge-commit':
git cherry-pick -m 1 MERGE_HASH

现在您需要推送更改:

git push production hotfix/TICKET:master
# where 'hotfix/TICKET' is your preferred branch name

而已。:tada:

于 2020-05-12T13:40:00.177 回答