Is it okay to build artifact specific to environment?

I’m building a web application project that in my view behaves differently in specific environments. I have dev, int, uat, prod environments. DEV is a local environment for developer and ‘int’ is the integration environment that gets deployed on a remote machine on every commit and runs automated test cases communicating to real staging systems.

Following are differences in the environments,

  • captcha is disabled in ‘int’
  • JavaScript and CSS are not minified in ‘dev’.
  • HTTP headers are not cached in ‘dev’. (May be I should not do this.)

Is it okay to build separately for each environment by passing the environment as argument to build job ? Or the artifact should work for any environment with only changing an external configuration file ? What is the industry conscience on this ?

2

Many development environments have “Debug” and “Release” modes which you can use for this purpose. In those environments, they include compiler directives that allow you to, for example, remove features in debug mode.

If your environment doesn’t have these provisions, I think it is better to control them with configuration files. Otherwise, you have two different builds, which means you’re maintaining two different programs, not one.

2

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *