We have a TFS structure below. I will try my best to give scenario and what I'm trying to achieve:
Source
|- Solution 1
|- Solution 2
|- files.....
Note: Solution 2 includes both Solution 1 and 2. This means if we build Solution 2 it builds both 1 and 2.
Build Definition:
|- Build Definition Dev (Builds Solution 2)
|- Build Definition QAT (builds solution 2)
|- etc...
Now, the solution 1 is going live this week and we need to label it and branch. Whereas Solution 2 will go live in few
months time.
Question:
What is the best way to branch and Label Solution 1 so that we can
a. Always deploy the solution 1 branched for specific environment.
Do we need to create separate Build Definition?
Is there way to configure Build Definition so that it builds and deployes the branched version?
Idea is to be able to deploy the branched version for support and bug fixes and be able to deploy it to given environment. At the same time keep Solution 2 as it is.
Finally merge both Solution 2 and branched version.
Thank you.
If solution 1 is referenced by solution 2, i.e. share some of the projects then branch Source so you will have each version in a dedicated branch. If there's no project sharing, separate the solutions into seperated branches.
Option 1:
Branch 1.0
|- Source
|- Solution 1
|- Solution 2
Branch 2.0
|- Source
|- Solution 1
|- Solution 2
Option 2:
Branch 1.0
|- Source
|- Solution 1
Branch 2.0
|- Source
|- Solution 2
2. Yes. There's no reason not to.
3. Yes. This is a big one. There are many ways to achieve that. Community TFS Build Extensions and VS Lab Management can help you get started.
Related
Related to TFS 2017 release management artifact files from version control
I'm asking a new question because I believe I have an edge case the answers don't directly address and I don't want to derail that OP. Specifically, how do I allow an independent, offsite team building required supporting scripts in a separate TFS Team Project supply their scripts as an artifact in the Release definition of a separate TFS Team Project? The separate team projects are built by independent customers and we are not allowed to append content to their source control. Further, updates to the scripts must automatically spread to all Release definitions using them on the TFS.
We have about 40 team projects in TFS all running on different schedules. A separate operations team handles all build and release management tasks in TFS.
Because of the constant bouncing between team projects and because ops also wanted to use the version control and work item tracking features in TFS, we created a separate team project for them to store scripts, installers, and license files. These are referenced in other projects' RM tasks for automatic installation/execution. There is also a separate version control folder tree for tracking project specific scripts - like this:
Common
Applications
App1
App2
...
App43
This makes it significantly easier for them to manage their scripts and associate them with work items themselves without having to shuffle across all the other team projects. The dev teams do not have access to the ops project.
However, when linking a version control artifact in RM from their project, it will only bind to the root and appears to copy the entirety of the version control structure to the agent, even though most of this content is not relevant to the app being deployed.
Is there a way to add specific, not all, folders from their project in version control as artifacts to a release definition in a separate project? We have our QA release start the process to production and it pulls in the artifacts from the ops project and the project being released. All subsequent releases reuse the artifacts that succeeded in the QA build instead of going back to the server for new versions of the artifacts.
Build definitions don't let us pick workspace paths outside of the team project so I don't see a way to pull in their scripts in a build step, either.
Is there a way to do this? How are other organizations handling this issue?
No.
The same answer I provided in the other answer applies here: Don't. Publish them as NuGet packages or as separate build artifacts; a release definition can have multiple artifacts linked to it.
I appreciate Daniel's answer and I believe what he is stating is best practice. However, I believe I found a more direct technical answer to my question through the use of additional repositories.
Release Management allows you to reference Git repos and branches independently, like I had originally hoped to do with folders under the TFVC repo already in a separate project. In this way, we configured the TFVC repo to handle large binaries (installers), license files, etc. which we version and put in a Team Project Nuget feed for reference from RM. To address the folder issue, we created separate Git repos for our operations team project in the same TFS project. Like this:
Binaries (TFVC-based repo)
Git Repositories
CommonDeploymentScripts
Environment Scripts
App1 Scripts
App2 Scripts
etc.
This way TFS RM from any other project can be configured to pull in any one or multiple of these repos as artifacts for use by the agents, bringing down only those scripts that were placed in them.
Also, the ops team doesn't have to cross reference app-specific scripts while bouncing around in a bunch of independent team projects. Note: Daniel is right when he says app-specific stuff should really be versioned and stored with the app project itself. However, some environments may not yet have that luxury so this can fill that need.
RM lets you reference branches under a single Git repo as well so this might be overkill. However, we didn't like the idea of branches under a repo not really having any business ever being merged up into the master - felt like too much room for error.
I have setup a CI Workflow in Jenkins to build project from bitbucket server.
I followed this Excluded Regions in Jenkins with Git
I made configuration such that ,when ever any changes are pushed into the repository, Jenkins will trigger a build.
I felt Repository is having too many checkins and each project is having separate workflows in Jenkins. So I used the "Polling ignores commits in certain places" option
But it seems not working.
I think this may be a bug as well.
Please see screenshot attached.
Scenario
I have 3 projects named Project1,Project2 and Project3
I want to look only changes in Project1 and then build.
For that i gave "Project1/.*" in the Included Regions. But even when changes are done to Project2 / Project 3, Jenkins triggers a build.
Doubt:
The Repository structure is as below
Project : TestForJenkins
Repository : JenkinsRepo
Project1,Project2,Project3,Packages,.gitignore
Since Project1 is at toplevel in repository, please let me know if i am giving wrong lookup path by providing "Project1/.*" in included region section.
I have a fairly complex solution in Visual Studio 2015. It's source controlled using Visual Studio Online with TFS as the source control mechanism.
The structure is as follows:
DefaultCollection
Team Project Root
|
----Web Apps Folder
|
----Web Application 1
|
----WebApplication1.csproj
|
----Web Service 1
|
----Web Service 2
|
----Winforms Folder
|
----Winforms App 1
|
----Winforms App 2
|
----Common Files Folder
MySolution.sln
MySolution.sln is in the Team Project Root, and the solution contains all the various applications within it which are a mixture of web apps, web services and Windows applications.
The problem I have is that I am new to branching and I want to branch the entire solution, but I think that the way my SLN file is in the root will make this difficult?
What I need is to have Web Application 1 branched, and I understand I can branch Web Application 1. But in order to run it I would need to create a new solution file to contain it which would mess things up.
Is there a way I can Branch the entire solution from this scenario, or will I have to try to re-structure things somehow?
I would Create a new Folder at Team Project Root called Main (TFS Convention, SVN it's trunk, git it's master).
Then move all the items in the Team Project Root into that Main folder.
So your structure is now:
DefaultCollection
Team Project Root
|--Main
|--Web A pps Folder
|--stuff
|--Winforms Folder
|--stuff
|--Common Files Folder
MySolution.sln
Now you can right click on the Main folder and from the Branching and Merging sub-menu select Convert to Branch.
Now you can right click on Main branch, and from the Branching and Merging sub-menu select Branch...
Your structure should be:
Team Project Collection Root
Team Project A Root
Source folder
Source folder
Team Project B Root
Source folder
Source folder
You cannot branch at the Team Project Collection or Team Project Root level. You will have to move the source to a new folder first and then you can branch.
I have a repository in VS Team Services which is setup as :
-root
|
| -Dev (.sln)
|
| -Releases
|
| - Test (.sln)
| - Live (.sln)
Each build is working fine, however its pulling the entire repo and I just want it to pull a specific branch (Dev, Test or Live)
So I'm selecting the Solution.sln file in the dev branch...
On the Repository tab you can specify your workspace mappings, the default mapping grabs your whole repository excluding the $/project/drops folder.
By changing the first mapping to not take $/Project, but $/project/dev you'll limit the scope of the get operation. If you no longer get the root of your team project, you can remove the cloak of the drop folder, that will only raise a warning otherwise:
The next thing you should do, if you're setting this build up to be a CI build, it to specify the folders that will trigger this build on the Tiggers tab, because, again by default, CI builds will trigger on any change in the whole team project.
To allow you to keep your build definition as a template, I suggest to use the $(Build.SourcesDirectory)\MySolution.sln instead of $/project/dev/Mysolution.sln, that way you only need to update the mappings of a build definition after cloning it to another branch root or when saving it as a template.
We're using TFS to follow a pretty standard agile build process:
Nightly builds from latest source code
Build to staging server every 2 weeks
Build to production server every 4 weeks
I've got 1 and 2 set up in TFS and working great. However, I'm struggling a little with #3. If I just set up a "normal" build, it will pull the most recent source code and use that to push to the production server. But what I really want is to move the code from step #2 to the production server since it's already been vetted by the QA team.
I thought about doing a custom build template that uses XCopy or something along those lines, but then the issue is how to update the configuration strings.
I was following this article, which seems to be exaclty what I want, http://www.asp.net/web-forms/tutorials/deployment/configuring-team-foundation-server-for-web-deployment/deploying-a-specific-build, but it is not working.
How do you all accomplish this?
So this is a slightly easier way to achieve 3. if you have achieved 2.
Let your production build definition stay as it is. However to compile the same changeset that was used to compile your staging build in step 2 (which has now been vetted by QA), when you queue a prod build then on the parameters tab expand the Advanced section and find the "Get Version" property as shown below.
In here you can specify the same TFS changeset that was used to build your build in step 2. Assuming this changeset is number 84, you would write (exactly)
C84
if you compile labels then for a label named - "For build xyz" you specify
LFor build xyz
Note that "C" and "L" above are intentional.
Hope this helps.
We have a different branch for production and code only gets merged into the production branch after passing Q&A.
That allows us to apply hot-fixes to production code with changes directly on the production branch (those will eventually get reverse integrated into main then dev) while development continues on the development branches.
Once code in the development branches are ready for Q&A, it is merged into the Main trunk.
CI and nightly builds are done on the development branches - the difference being nightly builds having more comprehensive automated tests