I'm working to get my head wrapped around ANT, CI, SVN and deploying. I have a dev server, a staging/qa server and a production server and the build server.
In theory, the CI Build server (bamboo) will run builds and (FTP??) then to the dev server. At some point, we'll decide to deploy a build to the staging server. How would I update the FTP information that is part of the ANT task? Same question applies when we deploy to the production server.
I think you are looking for
configuration management
? Your scripts themselves should do the same thing irrespective of where they are running - dev, staging or production. But you can have config files for each of your environments which will have configuration values specific to the respective environment. The scripts will read the values from these config files and configure your application appropriately.And to answer your direct question of multiple build files, no, have single build file with single target for deploy ( multiple targets are not necessary, but can be used depending on situation ), details below:
So to give some details:
Have config files like dev.config, stage.config, prod.config ( or
.properties
file) etc. The config will have machine ips, values for other parts of the environment, etc..anything needed for your app to be configured and run in that environment.Say you have a "deploy" target in ant. Let it read some property "environment" from the command line ( -Denvironment=stage)
Use this property to read the config file and the values and use these values to deploy. Use
convention over configuration
based approach, whereby there are some sane defaults which the config files may override only if the value is different from the default for that particular environment.There will be a single target, with "environment" property value specifying the environment config to use.
You can make two tasks, e.g. "ftp_to_dev" and "ftp_to_staging", then just call the one you want.