I have a build definition in TFS 2012 and its currently dropping the build onto a network share which will be used as the website root folder.
The problem is it's creating a new folder based on the version number each time. I'd like to keep the version numbering but just make it clear out and deploy to the same folder over and over so I don't have to change anything in IIS. Folders are like -
Build20130123.1
Build20130123.2
each containing a complete deployment. I just need one folder that gets everything dumped in it for every build.
What you are trying to do is counterintuitive to the build system, because not only does it drop the artifacts of the build into that folder, but when the retention policy is fulfilled it will try to delete those artifacts back out. So if you do this you will need to set your retention policy to keep always so it never tries to delete out the contents of this folder. You are better off, adding after the copy to drop step a Manual copy to this static folder that won't be subject to retention policy as it will know nothing about it. But if you wish when you open the template in the main sequence you will see a sub-sequence called Update Drop Location. In there is 3 items, the middle one is an If statement for if drop build and Build Reason is triggered, dig down into the then side and you will find a sequence which contains an activity called Set Drop Location. Right click on its properties and you will see how the path string is currently put together, adjust this string to what you wish and then this value will be propagated through out the build template
You could use the new feature in 2012 sp1 that lets you place the output within TFS source control then you would just need to run a TFS GET command manually or via an updated workflow call to update the latest files and binaries for your website location. Option number 3 in the picture below.
2012 MSDN-Select a Staging Location and Setting Up a Drop Folder
Related
I have a folder in TFS which has SQL Scripts. At the moment I am manually adding a comment and updating a version number inside the comment every time i make a change and check it back it. This works however was hoping there might be a better way. Is there a way to automate this in TFS?
I have read the following article
Version control project files
do i have to go through such a process for simple .sql files? Are there any other simple ways.
There are a few ways you can do this:
Create an automated build in TFS and write a custom build step / PowerShell script to parse the appropriate SQL scripts, read the version, increment it, and store the new version by either checking in the updated file or a local store
Use a database project (part of SQL Server Data Tools) which will output a DACPAC. Inside the database project, you can set the version as specified here. This stores the version in the project file. If you update your TFS build number to be digits only, you can then update the project file to set that value to match the build using a custom build task. For example, if your build number was yyyy.m.d.R where R is the number of times that build was run today (TFS manages that - it's the revision variable). Or, you could set the the <DacVersion> tag to something like 2.1.0.0 and your build replaces the last digit with yyyymmddr.
I'd recommend using a database project. It's pretty easy to create a new database project off an existing database.
The first way mentioned by Jacob above can achieve that if you just want to incremental the version number of the script/folder, just create a CI build definition.
Actually you can just enable Label sources and set the Label format with predefined environment variables such as $(build.buildNumber), and set without publish any artifacts during build process.
Thus, it will automatically trigger the CI build when you check in files, and the source (SQL Script /folder) will be labeled with the incremental number.
Then you can find the specific versions with the label.
I have asked a similar question
TFS Build Configuration: get all the Work Items Details for a particular build
And based on the answer of above question I have the below query. I decided to start a new thread for new question rather than confusing people in same thread.
I am using a default XAML template for workflow of TFS build configuration. Now my requirement is that I need all the Work Items since beginning whenever I trigger a build event for any build definition regardless of last successful build.
Let say I have triggered first TFS build and it is succeeded then I triggered 2nd build and that is also succeeded.
Then I have opened the log file of 2nd successful build and goes to Diagnostics Tab of last build. Inside Diagnostics tab there is a section as “Associate the changesets that occurred since the last good build”
Inside this it will display a message like
"No change sets are submitted to build 'ABC…..'"
Whereas I require list of all the work items since beginning.
Please suggest me the changes which need to be done in XAML template so that I can get all the work items since the beginning of source code.
As we know, associate the changesets and work items only occurs since the last good build.
There is a simple workaround to achieve what you want, you can specify a previous changeset to queue a build, then build the latest changeset again, then you'll get the associated changesets and work items again. Refer to this blog: http://chamindac.blogspot.sg/2013/09/tfs-2012-get-release-build-with.html
Otherwise, you need to create a MSBuild custom task that makes a call to TFS for the items. Check the links below:
https://volatilecoding.com/2013/06/11/tfs-build-how-to-customize-work-item-association/
(this solution is for TFS2010/TF2012 build process template, you'll
need to work on TFS 2013 build process template).
http://devgorilla.net/?p=104
We are using the "new, scriptable build system" of TFS 2015 and all of a sudden one of our build definitions is gone. It seems that it deleted itself.
Is there a way to undelete/recover a build definition?
Where are the build definitions (those JSON files) acutally stored?
If you are on prem and you just chose delete from the GUI... run this in the TFS database for your specific id:
update Build.tbl_Definition
set Deleted = 0 --was 1
where DefinitionId = <your build ID goes here>
You will loose your build history without some extra work i did not take the time to dig into, but that might also be do-able.
NOTE: You will also loose credentials stored as build parameters you will need to recreate. Might even be best for you to recreate a new build using this as a template to avoid other unknowns.
TFS build definitions are not version controlled items. So, It's not possible to restore the deleted build definitions for now.
There has been a feature request in uservoice: provide a way to version-control build definitions According to the response from PM, this is still in process.
In the new build system coming with TFS 2015 you can see the full
history of the changes to your build definition. The feature that is
currently missing is the ability to undo or rollback to a previous
revision.
We expect to get the rollback deployed to our service in the next few
months.
Chris Patterson
Program Manager
Moreover, the build definitions are stored in the TFS database.
From the console If 1 were to update the application what 1 does is..
1. Click on deployments.
2. Selects the application name and clicks update option.
3. Here he may change:
i. Source Path
ii. Deployment Plan
Now in my application No Plan path is specified so to update the application I only change the source path. The application gets successfully updated.
I want to update the application using wlst command by giving the new source path.
Is it possible?
like
updateApplication('backoffice','path\to\the\ear\file')
In this case I believe the command you are looking for is redeploy:
progress = redeploy('myAppName', appPath='new/path/to/file')
progress.getState()
If you run into errors, you may need to put the new ear file into the original location OR execute an undeploy first, then do a normal deploy.
Reference:
http://docs.oracle.com/cd/E13222_01/wls/docs92/config_scripting/reference.html#wp1024321
Another example:
http://zachxu.blogspot.com/2010/08/how-to-use-weblogic-wlst-to-redeploy.html
We've been using TFS since around 2009 when we installed TFS2008. We upgraded to TFS2010 at some point and we've been using it for source control, work item management, builds etc.
Our TFSVersionControl.mdf file is 287,120,000 KB (273GB). We ran some queries and found that our tbl_BuildInformationField table is massive. It has 1,358,430,452 rows which takes up 150,988,624 KB (143GB). We have multiple active products over multiple active builds which more than one solution per build and the solutions aren't free of warning messages.
My questions:
Is it possible to stop MSBuild from spamming the
tbl_BuildInformationField table so much? I.e. only write errors and
general build information and not all the warnings for every
project?
Is there a way to purge or clean up old data from this
table?
Is 273GB for 4 years of TFS use an average size?
Is 143GB for tbl_BuildInformationField a "normal" size?
The table holds the values and output of build process. Take note that build retention policy doesnt actualy delete the build object like everything else in TFS the object is marked deleted and only public visibility and drop location is cleared.
I would suggest if you have retainened same build definitions for very long time (when build definition is deleted the related objects get removed as well) you should query for build info including deleted ones using TFS api, the same api will also alow you to remove them for good. Deleting build definitions probably will not work and will fail with timeout error.
You can consult the following:
http://blogs.msdn.com/b/adamroot/archive/2009/06/12/working-with-deleted-build-data-in-team-foundation-server-2010-beta-1.aspx