Using 2 SVN repositories for website - publishing question - visual-studio-2010

I am a complete noob to this so if there is a completely obvious answer by all means make fun and point and laugh then give the answer.
We use Visual Studio 2010 to compile our published website. I have a repository that I use for my source code and one which I publish the compiled code to. I then check out the publish repository on the testing server and once it tests good I check out the repository on my main server. This is fine and all but I am using Tortoise SVN and automating the commit. Problem is, I really need to wipe the publish SVN repository, then copy the files, then commit. I just can't get that to happen and have it still recognize it as a SVN repository. Suggestions?

First of all, don't put compiled code into your source repository. It's bad form.
Look at Jenkins as a build server. Jenkins can use the msbuild.exe command to build .NET projects using the .sln file your project creates.
When you do a commit in Subversion, Jenkins will automatically fire off the build. If you have NUnit tests, Jenkins will run those and give you the results. You can have Jenkins store the compiled files for you in its archive. If someone wants to install a particular build, they can directly download it from Jenkins without having to do a checkout in Subversion first.
Jenkins offer all of these advantages:
It shows you all the changes in your repository and what changed in each commit.
It can run all sorts of tests automatically for you.
You can mark builds that are released using the "Simple Promotion" plugin.
You can tag builds in Subversion directly in Jenkins without needing a command line or working directory.
It can alert the developers if a build fails due to bad code, or if testing fails. These alerts can be done via Email, instant messaging, phone text messages, Twitter, and many other ways. All it takes is the right plugin which Jenkins makes easy to install.
Jenkins can act as a release repository which makes it easy to find the release, what's in the release and why.
Jenkins integrates with Bamboo, ViewVC, and Sventon. These are web-based repository browsers. This way Jenkins not only shows you the file changed, but what changed in the file.
Jenkins is easy to use and install. Download it and give it a try.

Unless you have a hard and fast requirement which forces you to use two separate repositories, i'd suggest taking a look at SVN tagging and branching functionality.
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-branchtag.html

Having a repository for the published code really doesn't buy you anything. IMO, you would be better off with a bunch of zip files (one per release) with the date and SVN branch reflected in the name. DO have a changelog .txt file in the zip, and also check that into the repo.

Problem is, I really need to wipe the publish SVN repository, then copy the files, then commit.
You don't need wiping in repo. Just make commit to production repo with exported HEAD from dev-repo (post-commit hook for commit message)
And tags, yes, are more natural and bulletproof way.

Related

TFS Team Build with VSO - Git Commit/Push files that have been altered by the build process

I have created a build definition that uses the Default Template(GitTemplate.12.xaml). I have a Pre-Build Script that updates the version numbers for all of the assemblies in the build.
I would like to be able to commit and push the files that have been altered by the build definition to the git repository.
I have tried doing this using a PowerShell script but was not able to do this because Git with VSO requires that you pass in user credentials.
I have downloaded the template to see if I can customise it to complete this task but can see no obvious way of solving my problem.
My next step will be to investigate writing a custom piece of code that can be called by the template.Just wanted to find out before I delve into this any deeper if I am wasting my time.
I am using VSO and VS2013.
Does anybody have a solution to my problem?
You should not commit those changes as it allows a developer to build an identical version numbered assembly locally.It is not a good practice to push the results back into Source Control.
You should set all of your assemblyinfo.* files to 0.0.0.0 and push. Then the only way for your assemblies to get a "good" version number is through the build process.
If you do want to go ahead you will need to authenticate using the "alternative" credentials that you can get from your profile page.

Automatic execute plugin after svn commit

Is it possible to execute maven plugin (created by me (for fun)) after or before commit from svn?
Maybe there is suitable maven lifecycle to things like this?
Thanks for help!
Edit
Can pre-commit hook execute maven plugin?
Remember this one simple fact about Subversion hooks:
Subversion hooks run on the Subversion server and not on your local system and have no access to the user's local working directory and cannot manipulate that working directory in any way.
So, you have a pre-commit hook run some maven plugin on a pre-commit because it won't have access to the changes you've made.
Now, what is this Maven plugin doing? Is it running unit tests? Reformatting your code? Outputting some pithy quotation? Why does this have to be run before the commit?
You can use a continuous integration tool (and I highly recommend that you use one) to run your Maven plugin after each commit, and then email the group responsible for the project if there are any issues. Yes, this will take place after the commit, but this is version control: Commits can be undone.
As indicated a continuous integration tool is the way to go for any sizable work or team project.
However there are reasons why you might see continuous integration tool as overkill (not least because it adds another tool to the ever growing stack of things to learn and you don't feel you have time for that right now)
So it is of course possible to trigger builds from your svn server. Remember that these will be compiled for whatever architecture the server is running. If you're just compiling java then you'll be fine.
You'll need to use post-commit hooks as there are a number of problems with pre-commit hooks:
Users committing to the SVN will have to wait for the hook to complete every time they commit.
A failed build could cause the commit to fail (is that what you want?).
Content from a commit isn't stable until it's committed (on a pre-commit hook, you don't yet have a stable version number. Someone else starting a commit just after may manage to commit first especially if your built takes a while to complete).
It's not easy to determine the exact state of files as they will be after the commit (see previous).
So if you use a post-commit hook things are much easier.
Look into svnlook. This command can be used to interrogate changes from a commit: svnlook changed ${1} -r ${2} > myTest.log within the post-commit hook will print a list of changes out to a file for you. You could easily search this to see if a directory has been touched in the last commit, then use svn checkout and mvn deploy to build that project.

Publish a specific revision using CruiseControl.Net

I am setting up a CruiseControl.Net server. So far, it only builds a project (.Net website), and I kind-of know how to set up unit testing, code coverage, etc in the future.
What I will need to have soon is this:
The developers commit changes to SVN continually, thus CCNet builds often.
CCNet will publish the latest version to the development server, as soon as a commit is validated (with unit tests etc).
The project manager validates a specific version, in order to publish it to the pre-production server, and create a SVN tag from this revision.
The last point is where my problem lies: how exactly can I set up things so the project manager can, for instance, browse to the CCNet web dashboard, select a previous specific build, and says "this is the build I want to publish" ?
I believe that my thinking is flawed somewhere, but I can't put my finger on it. Maybe CCNet is not the right place to do these manipulations ?
In my mind, I can create a SVN tag using CCNet, and mostly work from the trunk, but maybe I can't ? Maybe it's the other way around, and I should add a CCNet project every time a tag is created under SVN ?
The final goal is that I want to automate the publication process: zip creation (for archiving), web.config modification (using Nant for instance), and website publication (using FTP).
In all these steps, I want to limit the manual intervention to the maximum. If I can avoid to add a new project to CCNet every time a tag or branch is created in SVN, that would be awesome.
Thanks for your help, and sorry if it's not very easy to read, but it's not very clear in my head either...
Since you can create any task, you should be able to achieve the goal, though unfortunately not out-of-the-box.
Since you use SVN, it all depends actually on revision. I think I'd create a separate project for your third scenario and added a parameter where PM would provide revision number. Then based on that I'd tag sources etc. in my own task.
Regarding the other points, I think this is similar. Recently for web projects we started using MSDeploy, and in each stage build the MSDeploy package was created. Then there was a separate build called Deploy, that when forced allows us to select which package we want to deploy using MSDeploy.
Having several environments, however, started a little bit like overkill for managing with CCNet, and I'll be looking into kwakee at some time.

How to add some prebuild steps to jenkins?

I am a Jenkins newbie and need a little hand holding because we only maintain parts of our app in SVN. I have basic Jenkins install setup.
This is what I do to get a local DEV environment setup and need that translated to Jenkins in order to make a build:
DO SVN checkout (and get the 2 folders that are under SVN)
Delete the folders
Copy over the full app from FTP location
Do SVN restore
download sql file
Import into MySQL
How would I get the above mentioned steps in Jenkins? I know there are some post build steps that I can use. Just not sure how to put it all together. Any help will be much appreciated.
Tell Jenkins about the SVN repository and it will check it out automatically when a new build is started. That should take care of 1. 2-5 would be build steps (i.e. execute shell commands). Basically, you can set up Jenkins to do exactly what you do on the command line, except that the first step is taken care of automatically if you tell Jenkins about the repository.
Rather than trying to do these sort of things in Jenkins, you'll likely save yourself some trouble if you make use of something like Ant or NAnt to handle the complexities for your build.
I've found that doing my builds this way gives me added flexibility (ie, if it can be done via the command-line, I can use it in my build, rather than needing a Jenkins plugin to support it), and makes maintenance easier as well (since my NAnt scripts become part of the project and are checked into the VCS system, I can go back if I make a change that doesn't work out.
Jenkins has some build-history plugins, but over time I've found it easier to keep the majority of my 'build' logic and complexity outside of the CI environment and just call into it instead.

TeamCity Visual Studio plugin with Git

We'd like to implement CI using TeamCity.
We use Git for source control and would like to make use of the "pre tested commits" or "personal builds" feature of TeamCity.
Does anyone have experience with the VS plugin for Teamcity?
As far as I've seen, it only supports Subversion, no word about Git.
Anyone used this setup with any success?
As explained in Pre-tested “Commits” using Git by JoergM, you can emulate a solution similar to the TeamCity6.x "Personal builds on branches", by using personal repos:
.
There is one central Git-repository that only contains pre-tested changes. I call this “Green Repository” because it should only contain changes that lead to green builds.
Every developer pulls from this repository but nobody is allowed to push to it.
Instead everybody has a personal repository (think fork if you were on GitHub). The CI Server watches those personal repositories. After a commit it starts the compile and test. If that was successful it pushes the changes to the Green Repository.
JoergM adds:
The question is whether we will continue using our own solution or switch to the new feature of Teamcity.
So far I can’t see any advantage of the Teamcity feature.
With our solution we are even more flexible in regard of branch design.
This kind of setup is similar to what I described in "What is the cleverest use of source repository that you have ever seen?".
TeamCity 6.5 has new feature: remote run on a branch. It works for Git and Mercurial and does not require IDE, see more here: http://confluence.jetbrains.net/display/TCD65/Branch+Remote+Run+Trigger
Note that support for Git branches has been considerably improved in TeamCity 7.1. In my opinion, this is far better than the personal build feature.
The relevant docs are available here: http://confluence.jetbrains.net/display/TCD7/Working+with+Feature+Branches

Resources