TeamCity trigger on specific parameter value - teamcity

I have set an automatic teamcity flow. I have 2 projects A and B.
Project B will trigger when Project A has a successful build finish.
In project A I can select a build configuration (development, test or production). I want project B to trigger when Project A build finish AND only if selected configuration is development.
How can I manage it to check the configuration type on the trigger? Is it a new one?
TeamCity version I use is 2022.04.1

Related

Team City build configuration for Continuous integration

I have a team city build configuration , which picks up data from bit bucket and packages it to transfer to udeploy. There is no code build process , it is just simple package and transfer process. All i want is that my team city build configuration should pick files only which are newly committed and never been picked up in previous team city builds. How do i configure this build component to enable this feature.Appreciate you help !
Checkout the Configure and Run Your First Build documentation. The steps you will need to pay attention to are:
Setting the VCS Root. This is how Team City will know when source code
changes.
Automatic Build Trigger. Even though you are not going to
build code, you will trigger your "build" steps on changes in this
repository.
Configure your "build" steps to do whatever packaging
logic you need. You can add a deployment configuration to deploy the packaged product at this point.

Allow project run on master only in teamcity

I'm setting up teamcity and I have 2 Projects using the same VCS root, Build and Deploy.
Is there a way I can:
Trigger the build project on all branches except master
Trigger the deploy project only on master
I have it set to automatically trigger but both projects still show pending changes and a user can still manually run deploy on any branch they wish.
Build Trigger Branch filter:
+:*
-:<default>
Deploy Trigger Branch filter:
+:<default>
-:*
Do I need to configure the VCS root twice with different branch specifications?
Please let me know if I need anything else.
Thanks for your help.
Kurtis
unfortunately, you can't.
But you have to do the follows:
Delete ability to run Build and Deploy configuration from users.
Set trigger +:*; -:<default> for a Build
I hope the Deploy has dependencies from a Build.
create the new Deploy configuration, let's say Deploy only master
Add snapshot dependency from Deploy
define hidden variable reverse.dep.*.teamcity.build.branch with value <default>
So, nobody cannot run Build, and Deploy. If someone runs Deploy only master and select another branch it will not work because you will replace the teamcity.build.branch to master

run release tasks selectively based on project code changes

We are using VSTS for build and release management, and using CI/CD. Typically, our solutions consist of a web application project, and a database project.
Our current release tasks take the application offline (using app_offline.htm), publish the database, then publish the web application. Publishing the database project often results in no changes, as due to CI/CD we are much more frequently updating code on the web app than changing the db schema.
Is there a way to only run the database publish task (using WinRM) when it detects a change in the database project code, in our git repository?
EDIT: This in itself isn't a problem, as typically when the DACPAC gets published, there will be no activity. HOWEVER, I've been requesting that the database is backed up using the /p:BackupDatabaseBeforeChanges=true flag - which seems to back up the database even if there are no changes. This is an issue for large databases.
The simple way is that you can separate web project and database project to two build definitions.
Create a new build definition
Enable Continuous Integration in Triggers tab
Specify Path filter to include database project
Modify Visual Studio Build task, specify /t:[database project name] argument in MSBuild Arguments box to just build database project
The same steps for web project
Create a new related definition
Add artifacts for previous two build definitions and enable Continuous deployment trigger
Add two environments (e.g. database, web)
Open Pre-deployment conditions of an environment (e.g. database)
Enable Artifact filters and select corresponding artifact (e.g. database build artifact), specify build branch (can specify *, it means all branches)
Add tasks to just deploy database in this environment
The same steps for web environment
The answer is - exactly what I want isn't possible.

Octopus deployment from Teamcity not using the latest packages

I have set up a build step on TeamCity,as described here, to do automatic release deployments to our test server. But it is not using the latest nuget packages that was build in TeamCity.
Use Case :
Teamcity will create nuget package with version 1.0.0.9, all the dlls that is in the package is the correct version, and the Release in Octopus, that was deployed has got the same version number , but the packages that octopus uses is of an earlier package eg 1.0.0.5.
I have specified the --force parameter on the build step so it should use the latest packages but it is not.
If I manually create a release in Octopus, and select the latest packages it is working 100%
Please can someone tell me if I am missing something.
thanks in advance
I think what you need to do is create two build configurations in TeamCity, one to build and one to deploy with Octopus. Refer to this link that has a small blurb toward the end:
Note that NuGet packages created from your build won't appear in TeamCity until after the build completes. This means you'll usually need to configure a secondary build configuration, and use a snapshot dependency and build trigger in TeamCity to run the deployment build configuration after the first build configuration completes.
So in my case I created 2 build configurations, then setup a snapshot dependency from the build to the deploy config and also a trigger to kick off the deploy after a successful build.
It looks like --force is just to force packages to the be re-installed if they have already been installed. Are you using the --packageversion parameter?
My organization uses Jenkins CI. We use the unique build number as our package version and then deploy that specific package version using the --packageversion paramater.
In the case where we have multiple services that need to be deployed. We have an upstream job / main job that provides the unique build number.
I'd imagine you can do the same thing with TeamCity
Master Job (unique build number) calls jobs A and jobs B with parameter (unique build). Jobs A and B build version (from Master Job). Jobs A and B complete then publish their respective versions.
It could be a few things.
Check out.
http://octopusdeploy.com/documentation/integration/teamcity
You haven't mentioned how your consuming the feeds from Octopus in Teamcity. I would start there.
Next I would use the teamcity action to do your deploy. You asked "Where should the --waitfordeployment flag be added" there is a check box to make sure the deploy has worked before the action can continue.
In TeamCity I use a Octo Push Packages step and in the Additional Parameters field I specify the --defaultpackgeversion {VERSION} parameter.
This will force Octo to use a specific version of packages instead of just choosing the 'Latest Version'.
There are more possible reasons for the problem.
To see the problems with Octopus go to Configuration -> Diagnostics
Another common problem is to use a Package Name #{variable} in a deploy step
Currently it is not possible and Package Name should be set manually, for example MyWebSite or MyWindowsService. See UserVoice for this feature.

Personal build with dependencies

I've started using TeamCity personal builds, via the new Git remote run feature in TeamCity 6.5. Doing a single build works fine; I have a project that compiles from source, and I gave it a Branch Remote Run trigger.
However, it looks like TeamCity only triggers the one project that has the Branch Remote Run trigger applied. I have several unit test projects, set up in a chain with Finish Build triggers, and none of these get run. Furthermore, if I try to start a custom build of one of these unit test projects, I can't use the artifacts from my personal build: I can only pick artifacts from one of the 'official' builds.
Can I get TeamCity personal builds to work with build chains?
With the setup that you have (snapshot dependencies and finish build triggers), you can achieve build chaining by submitted your personal changes to the builds you are looking to trigger. For example, if you have projects A and B where B depends on A - run the remote build against project B and A will be triggered first and B will be added to the queue. Both of these builds will have your personal changes.
If you are using the TeamCity Visual Studio plugin you can select which builds you want to send your changes to and you just need to tick the box for B instead of A.
The finished build trigger won't be fired, but the build chaining means that A must be built first.
More info - http://confluence.jetbrains.net/display/TCD7/Build+Chain
(You have tagged TeamCity 6.5, but 7 has now been released so I have included the documentation for the newer version)
I suppose you should setup your chain not with Finish Build trigger, but with "Snapshot dependencies" feature of TeamCity. And, setup artifacts dependency basing on the snapshots.
Please read about snapshot dependencies in TeamCity here.

Resources