不同分支中的相同配置文件的不同版本 [英] Different versions of the same configuration file in different branches

查看:157
本文介绍了不同分支中的相同配置文件的不同版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用虚拟主机dotCloud运行我们的一些应用程序。 dotCloud直接从git仓库部署应用程序,并从该仓库读取名为dotcloud.yml的配置文件来配置和运行堆栈。

我们有两个分支(一个生产,一个分期),它们是同一个回购协议的一部分,并且这些分支推动分离dotCloud实例。在dotcloud.yml文件中运行这些实例中的每一个都有一点小小的区别。

管理这个dotcloud.yml文件的最佳方法是什么?目前,我们只是确保我们确保dotcloud.yml在每个分支上都是正确的,但是当我们将分段的更改合并到master时,它会不断被覆盖。

解决方案

您可以:


  • 版本a dotcloud.yml.template

  • 版本a dotcloud.yml.value.prod 和a dotcloud.yml.value .stage 与每个环境的相关值。

  • 版本一个涂抹脚本负责构建正确的 dotcloud.ym l文件(根据dotCloud实例不再进行版本控制)。



您会将该污迹脚本声明为a (过滤内容驱动程序)在一个(也是版本化的) .gita ttribute 文件





在任何git签出时,smudge脚本都会被调用,如果它识别出 dotcloud.yml.template 内容,将构建正确的 dotcloud.yml 文件。


We are using dotCloud, a virtual host, to run some of our apps. dotCloud deploys apps directly from a git repo, and reads a configuration file called dotcloud.yml from that repo to configure and run the stack.

We have two branches (one production, one staging) that are part of the same repo, and these push to separate dotCloud instances. There is a minor difference in the dotcloud.yml file to run each of these instances.

What is the best way to manage this dotcloud.yml file? Currently we simply make sure we're making sure the dotcloud.yml is correct on each branch, but it constantly gets overwritten as we merge changes from staging to master.

解决方案

You could:

  • version a dotcloud.yml.template
  • version a dotcloud.yml.value.prod and a dotcloud.yml.value.staging with the pertinent values for each environment.
  • version a smudge script in charge of building the right dotcloud.yml file (which wouldn't be versioned anymore) depending on dotCloud instance.

You would declare that smudge script as a filter content driver in a (also versioned) .gitattribute file:

On any git checkout, the smudge script will be called and, if it recognized the dotcloud.yml.template content, will build the right dotcloud.yml file.

这篇关于不同分支中的相同配置文件的不同版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆