Continuous Delivery - Part 3: Running custom rake tasks during deploymentleena
July 31, 2011
One problem we faced with the pipeline setup what I had mentioned in my first post was that - it was not handling how to run the extra tasks that we need to do in some of the deployments. Some examples are:
- Reindex the solr/lucene indexes if any new field has been added to the index
- Some custom rake tasks , say for eg: task to update values in the DB, which you don’t want to add to migrations
We do have Cap tasks for running the required rake tasks, but again it was done manually. So we’ve to remember to run them after deploying to production. And also there is no way to track what steps were followed for a certain deployment.
I used the build parameter again for fixing the above issue i.e. after accepting the extra tasks as parameter for the build for the first job, they will be passed on to the downstream jobs. In this way the same deployment steps will be automatically followed for rest of the jobs in the pipeline.
The only difference in this case is that - sometimes the parameter can be empty. This check has to be done in the scripts i.e. if the value exists for the parameter, execute the extra tasks along with the normal deployment else just do a normal deployment.