New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do developers stage database changes locally when using global versioning? #113
Comments
You mean local dev? |
How are you guys keeping local databases up to date? are you using one of the refresh database projects that is out there to make it super simple? Or are you building and running a batch file? |
And now to answer your question - I don't agree with taking a dependency on a build server for your automated build. Sure, one of those numbers is probably the build number, but locally that number could always be zero and the other numbers filled out. Having the revision as one of the numbers should give you confidence that you are very close to the same version out there (although you haven't committed yet so if you have changes there is nothing that will give you a completely accurate number). I'm of the mind and recommendation that your automated build should be executable locally so that it is repeatable on all dev computers. It also reduces the setup of the build server (jenkins, team city, etc) to a simple contract instead of having it do more than it should. What happens when your build server goes down? How do you ensure you are not breaking the build (I know, private checkin verification with Team City VSIX, but it doesn't apply to all build servers)? What about bringing up a new build server of a different type like Jenkins? Having the automated build be able to execute locally gives you a much quicker and reliable feedback cycle into knowing you have not broken the build, which builds confidence and stronger teams who check in more often. ;) Okay, now that I've ranted a bit - If you must pull the versioning from TC, you will likely need to check it in so that local folks can get it. |
yes, local dev...I'm moving them away from a single shared database. |
building and running a batch file at the moment, I've lifted the schema and can build a minimal dataset that allows the application to come alive. All other data loading for test is/to be automated through the application API. |
"I'm of the mind and recommendation that your automated build should be executable locally so that it is repeatable on all dev computers." I suppose I should really just accept that I need to decouple specific local dev database versions from production, simple as that, i.e. checkin in a star to the AssemblyVersion (0.0.0.*) in AssemblyInfo.cs and be done with it and don't try to compare local dev versions to Test or Prod? The database versioning in TeamCity is then used to provide an immutable database version number, as we do with the deployable application assemblies themselves. Simples!!?? |
There is a tremendous value in being able to test the bugs in a version of prod. Not having that global variable would be a bad thing. |
As long as you keep the immutable version builds that do go to production and don't delete them at some point in Team City you should be good to repro bugs. |
Agreed, I wasn't suggesting not utilizing a global variable, rather questioning what the scope of that global variable is, as our previous comments seem to suggest it isn't really possible to use the global variable on local dev databases?
Are you suggesting you use those immutable version builds to deploy to dev locally and build a new db from scratch (minus prod data) for debugging issues? We can always run a custom build in TeamCity to generate those artifacts again so that isn't of a major concern to me. I can't help but think I'm missing something fundamental about configuring global versioning, I've re-read the wiki but feel the outcome for Global versioning is the same as you mention here https://github.com/chucknorris/roundhouse/wiki/Versioning#why-is-script-number-versioning-non-global i.e. the local dev databases can't match the same global version numbers as all the environments we formerly deploy to. Some implementation examples would be ideal but I can't seem to find any relevant resources. |
We use uppercut to ensure versioning matches where it matters. The only number that would be off is the build number, and that's just an education thing. You can also set up for using semantic versioning with uc and then carry some dev tag with a date on it until it is ready to release. |
We are building a shared assembly file that all of the projects get their version number from. That's the key in affecting a good versioning strategy. That might be the piece you are missing. |
Cheers Rob, it's becoming clearer now I understand that you don't expect to keep the build number in sync downstream to devs, saying that though, are you checking that shared assembly in each time, I expect not? We too share versions across all projects so that's not a problem. |
Our build infrastructure (in our source control) takes care of the product Regarding assembly information, I usually see folks generate the Cheers, Mario Pareja On Thu, Jun 20, 2013 at 11:31 AM, lholman notifications@github.com wrote:
|
We don't check it in since it is generated by the automated build. It detects the environment variable BUILD_NUMBER (I believe for TC) and adds the build number if present, otherwise leaves a zero. |
@mpareja nailed it. 👍 |
Cheers guys. I think the missing piece was that I was concerned about getting the latest build number locally and I couldn't stitch together the missing link, that makes sense to grab it from your build server of choice if available. To summarise, how it all comes together. Major -> Relatively static, provided by build scripts And the following is stitched together locally when you run your build on the commandline, which in our case gets latest, compiles, runs tests and drops/creates the db (optional).
@mpareja We overwrite it as part of the build but the checked in version is always 0.0.0.0, so horses for courses really. Thank you both for your time on this. |
Cool, closing... :) |
I've created a simple gist of my implementation of this https://gist.github.com/lholman/5982608 |
That's pretty much what we do. Include TeamCity's build number if available On Fri, Jul 12, 2013 at 3:38 AM, lholman notifications@github.com wrote:
|
EDITED: from original as frankly it was a poor question first time around....
We have a batch script called DEV.DBDeployment.DropCustomCreate.bat, as the name suggests this drops and creates our db from a fresh, a useful tool in Dev but we don't always want to drop the database, sometimes just get the latest changes.
It's worth noting currently every CI checkin triggers a build in TeamCity which pumps the current Major.Minor.BuildNumber.Revision (e.g. 1.0.123.1568) number in to all AssemblyInfo.cs files within all Visual Studio projects. This obviously allows us to stamp the resultant dll's with the build number, pretty standard stuff for sure. We also overwrite a BuildInfo.txt file in a similar way, most importantly this BuildInfo.txt file is included within every deployment package and sits within the RoundhousE\deployment folder and is referenced by /vf=%version.file% when we run rh.exe as mentioned above from the .bat file. So we're sorted for deploying to existing databases in Test and Prod.
However in dev the AssemblyVersion is always 0.0.0.0 in AssemblyInfo.cs, as is the version number in BuildInfo.txt (for obvious reasons), therefore how do devs stage their changes locally against their database. For example, with this setup when we run rh.exe all changes will be stamped with the version number 0.0.0.0, regardless. Is the expectation that in dev you will always drop and create? If that's the case I'm assuming we need TeamCity to checkin the BuildInfo.txt file so RoundhousE can reference it from source control when executed in dev?
Is there something I'm missing here?
The text was updated successfully, but these errors were encountered: