开发者

using phing to deploy different environments

We're using phing to deploy our php application and we got into a little issue with deploying our environments.

We have 2 different production environments (each one with different config files), and a separate testing environment. We don't have an issue with 开发者_开发知识库the testing environment, as we have a different branch for the testing environment. The problem is that we're using the same branch for both our production environments.

Anyone has suggestions on how we can deploy into our production environments with different config / setting files? We rather keep the production branch as a single branch, but somehow separate the config files. We use zend framework, and I know about the different section we can have in the config files, but we also have a setting file for phing.

I looked around, but I can't seem to find a way to pass command line arguments to phing. Something like this could be really useful:

  phing -f build.xml production_live1


You can use -D to set custom properties

phing -Denvironment=production_live1

You can access it within your build file like every other property

${environment}

Another solution would be, that you create different build files for every environment, which both includes the "main" build file build.xml and only contains the differences.

phing -f production_live1.xml

(and in production_live1.xml

<project name="production_live1" basedir="." default="all">
  <import file="main.xml" />
  <!-- different tasks here -->
</project>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜