Multiple VCS Trigger with different "Per-checkin Triggering" for different branches - teamcity

I need two VCS Triggers with different Per-Checkin Triggering rules based on a banch filter.
The reason: For the "release-*" & "master" branch when I merge everything in i don't want a build created per checkin, however i do when using any of the other branches. I though i could do this by adding a second trigger filtering the branches so they looked something like this:
The first VCS Trigger, this will build all of these branches with "Trigger a build on each check-in" checked
-:*
+:refs/heads/hotfix/hotfix-*
+:refs/heads/develop
+:refs/heads/feature/feature-*
The second VCS Trigger, this will build all of these branches with "Trigger a build on each check-in" unchecked
-:*
+:refs/heads/release/release-*
+:refs/heads/master
(Please excuse my not so epic paint skills)
Is there another way I can do this?
Thanks
Steve

I couldn't find how to add 2 VCS triggers on a single build configuration, have you tried that?
I'm on TC 10 though, but if that really doesn't work then only way i can think is just to create 2 separate builds. :|

The solution was to modify the build configuration XML. Steps were:
Locate your TeamCity Project folder which is a subdir of the TeamCity Data Directory, mine was C:\ApplicationData\TeamCity\config\projects.
Find the build configuration in which every project subfolder it lives under example: C:\ApplicationData\TeamCity\config\projects\parentProj_Proj\buildTypes\build_config_name.xml
At the bottom of this file was where i found the build triggers section, find in there the current build trigger you have an duplicate it, but remember to change the "id" attribute on the "build-trigger" element. So my final config looks like this:
<build-triggers>
<build-trigger id="vcsTrigger" type="vcsTrigger">
<parameters>
<param name="branchFilter"><![CDATA[-:*
+:refs/heads/hotfix/hotfix-*
+:refs/heads/develop
+:refs/heads/feature/feature-*]]></param>
<param name="groupCheckinsByCommitter" value="true" />
<param name="perCheckinTriggering" value="true" />
<param name="quietPeriodMode" value="DO_NOT_USE" />
</parameters>
</build-trigger>
<build-trigger id="vcsTrigger1" type="vcsTrigger">
<parameters>
<param name="branchFilter"><![CDATA[-:*
+:refs/heads/release/release-*
+:refs/heads/master]]></param>
<param name="quietPeriodMode" value="DO_NOT_USE" />
</parameters>
</build-trigger>
</build-triggers>
This although probably unsupported seems to work just fine.

Related

Apply patch to web.config in sitecore

I am little new to sitecore and I got a work thats bugging me. I was given a task to applying sitecore patches to the project and deploy to Dev. There were 3 patches. I completed the first two as it was to applied in Sitecore.config file. The third patch was to add config in "appSettings" node and "assemblyBinding" node in Web.config file. When I used the traditional way of patching like I used for the first two, I was getting an error and later I found out this:
My project doesn't use slowcheetah. I researched more about this and found that I have to do web config transforms. The more I researched how to do transforms more confused I got. Below are the config that I have to insert in Web.config :
In appSetting node :
<add key="Telerik.AsyncUpload.ConfigurationEncryptionKey" value="YOUR_ENCRYPTION_KEY_HERE" />
In assemblyBinding node :
<dependentAssembly>
<assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" />
<bindingRedirect oldVersion="2015.1.401.45" newVersion="2017.2.621.45" />
</dependentAssembly>
I was hoping to get a simple solution or references to articles on how to do insert these configs in web.config file.
You can benefit from web.config file transformations. Transformations will allow you to have different values for different environments.There is a short and informative blog post by Martin Miles. It contains everything that is needed.
https://blog.martinmiles.net/post/how-apply-xml-transform-works-in-helix-habitat
Official Microsoft documentation has an example on how to apply transformations.
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/web-config-transformations
As per the Sitecore Doc, we cannot create the patch for web.config
You can refer https://doc.sitecore.com/xp/en/developers/93/platform-administration-and-architecture/use-a-patch-file-to-customize-the-sitecore-configuration.html point 4 (Note)
enter image description here

See parameters that are overridden from TeamCity template

Is there a way to see TeamCity configurations that override parameter defined in template?
I don't think so. What's worked for me in the past was to search through the project files on the filesystem. If you have many build configs, this will be faster than opening each of them in the GUI.
Search for something like this:
<param name="myParamInheritedFromTemplate" value="myOverrideValue" />
in <TeamCity data directory>/config/projects/**/*.xml. If it's absent in an XML file, that build config just inherits the value. If it's present, it overrides it.
It's hacky but it's quick.
There is a feature request https://youtrack.jetbrains.com/issue/TW-21212, please vote. Current workaround are to either search the raw XML files with the settings stored under TeamCity Data Directory on the server as #sferencik suggested, or use REST API to get settings of all the build configurations and search for the parameter there. Let me know if you need help on any of these.

How To Remove Display Rule From a Ribbon Command in CRM Online?

I have a command for a button defined as follows:
<CommandDefinition Id="new.lead.CreditCheck.Command">
<EnableRules>
<EnableRule Id="new.lead.CreditCheck.EnableRule" />
</EnableRules>
<DisplayRules>
<DisplayRule Id="new.lead.CreditCheck.DisplayRule" />
</DisplayRules>
<Actions>
<JavaScriptFunction FunctionName="new.LeadDynamic.creditCheck" Library="$webresource:new_Lead_dyn.js" />
</Actions>
</CommandDefinition>
If I go and remove the Display Rule from the command, (but keep the actual Display Rule definition) it looks like this:
<CommandDefinition Id="new.lead.CreditCheck.Command">
<EnableRules>
<EnableRule Id="new.lead.CreditCheck.EnableRule" />
</EnableRules>
<DisplayRules />
<Actions>
<JavaScriptFunction FunctionName="new.LeadDynamic.creditCheck" Library="$webresource:new_Lead_dyn.js" />
</Actions>
</CommandDefinition>
I get an error when attempting to import (attempted to use the Ribbon Workbench and got the same error as well)
The ribbon item 'new.lead.CreditCheck.Command' is dependent on
.
I'm attempting to remove the dependency, but apparently I can't remove it since it exists! What am I missing?
I would consider this a bug in CRM, but in order to perform this operation, you have to delete the command, and then publish the solution! Once the command is deleted, you can delete the Display Rule. You can't do this in one step!
If your command is especially complicated, you can export the solution, delete the command, import the solution, remove the Display Rule and add back the command without the display rule and import.
Your solution has a CommandDefinition which depends on a DisplayRule with the ID "new.lead.CreditCheck.DisplayRule". You cannot remove the DisplayRule from the RibbonDiffXml as long there is a published and/or unpublished component depending on it, in this case the CommandDefinition.
Therefore you need to remove all references to the DisplayRule first and then publish these customizations. Having this done, you should be able to remove the DisplayRule itself.
The same procedure must be followed when you need to remove an obsolete attribute from an entity:
Remove the attribute from all forms, views etc.
Publish customizations
Remove the attribute from the entity model
Publish customizations
In this respect the behaviour of Dynamics CRM is i.m.o. 'by design'.

How to Implement TFS InvokeProcess to run under other credentials

I'm using TFS (VS 2010) Build Definitions and XAMLs to build apps to different environments. Now, we need to push these builds to Production servers which require different credentials than what the Build Controller has.
I have been working on implementing the steps found at "Customize Team Build 2010 – Part 9: Impersonate activities (run under other credentials)" from http://www.ewaldhofman.nl/post/2010/05/28/Customize-Team-Build-2010-e28093-Part-9-Impersonate-activities-(run-under-other-credentials).aspx but I cannot figure out how to use the credentials within the XAML file.
So, I have implemented the provided solution, and have made build definitions require the credentials, but how do I implement the credentials code (which appears to be in C#) into the XAML (which is XML)?
Thanks,
Stephanie
I have solved my issue here. I wasn't aware that the activities were coded in C#, although organized through the XML.
You can use a TryCatch activity to wrap the impersonation object and dispose it in the Finally.
The XAML should look like:
<TryCatch>
<TryCatch.Variables>
<Variable x:TypeArguments="bl:Impersonation" Name="Impersonation" />
</TryCatch.Variables>
<TryCatch.Try>
<Sequence>
<mtbwa:WriteBuildMessage Message="Impersonating..." />
<ba:CreateImpersonationContext Credentials="[Credentials]" Result="[Impersonation]" />
<!-- Your activities go here -->
</Sequence>
</TryCatch.Try>
<TryCatch.Finally>
<Sequence>
<ba:DisposeImpersonationContext Impersonation="[Impersonation]" />
<mtbwa:WriteBuildMessage Message="Done with impersonation!" />
</Sequence>
</TryCatch.Finally>
</TryCatch>

Sharepoint List added to Create -> Custom Lists on Feature deployment

I am building a SharePoint Feature to deploy a simple WebPart and a custom list within the "Web" scope.
When the solution is deployed my list is immediately available in Site Actions -> Site Settings -> Custom Lists.
If you try and create an instance of the list I receive "File Not Found"
If you activate the feature a second copy of the list template is added to the Custom Lists heading.
Neither list can be created with the same "File Not Found" error
On deactivating the feature one list template disappears
On retracting the solution the last list template disappears
Files Involved:
schema.xml is 5000 lines long
feature.xml is as follows
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="78a8eaad-2160-434c-81c2-6c5f7ce94ade" Title="WeekWidget" Description="Displays A, B or H based upon a configurable SharePoint List." Version="1.0.0.0" Creator="Cardinal Newman Catholic School // Richard Slater" Scope="Web" ImageUrl="WeekWidget\WeekWidgetLogo.jpg" xmlns="http://schemas.microsoft.com/sharepoint/" DefaultResourceFile="core">
<ElementManifests>
<ElementManifest Location="ListTemplates\WeekCalendar.xml" />
<ElementFile Location="WeekCalendar\Schema.xml" />
</ElementManifests>
</Feature>
WeekCalendar.xml is as follows
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate Name="WeekCalendar" DisplayName="Week Calendar" Description="List of Weeks." BaseType="0" Type="100" OnQuickLaunch="TRUE" SecurityBits="11" Sequence="410" Image="/_layouts/images/itgen.gif" />
</Elements>
I think the "File Not Found" error is symptomatic of another problem, however the addition of the list template shouldn't happen on solution deployment. What am I doing wrong?
are you wiring up all of the feature files yourself or using a tool? typically, the 404 means one of the 'magic strings' in your configuration files is off. Also, the directory structure specified here looks suspicious:
<ElementManifests>
<ElementManifest Location="ListTemplates\WeekCalendar.xml" />
<ElementFile Location="WeekCalendar\Schema.xml" />
</ElementManifests>
You should try deploying all of your feature support files to the same directory. Have you located the error in the ULS log (<12 hive>/LOGS)? That may provide some clues too.
I think the problem could be related to the separate directory structure--I usually deploy all list files to the same folder (schema.xml and weekcalendar.xml, in your case; keep feature.xml out of the list directory).
Turn on verbose logging and check the 12-hive logs to see what file is not found.
Check schema.xml and ensure the name attribute on the list element matches the name of the folder housing your feature. Also watch out for the Url attribute on this element... VSeWSS will set the URL to the name of the list being reverse engineered so I change it to "pages\viewpage.axp".
On the default view element within schema.xml, try adding SetupPath="pages\viewpage.aspx". Ensure there's a WebPartZoneId="Main" attribute on there as well.

Resources