Suppose I have a list of changesets 1 to 10. Is it possible to specify that it build till changeset no. 5, instead of building just for a particular changeset or all the changesets 1-10?
I know It's possible to specify a particular version of the files to build, like changesetId,Date,Label,latest and workspace versions. So how do I specify "Build till C5" when triggering a custom build in my application?
Yes, you can do that using the default build process template. In the "Advanced" section of the build process parameters (in the Process tab of the build definition editor), set the "Get Version" parameter to the changeset you want to build (e.g. "C5"). More logically, you would do this in the Queue Build dialog's "Parameters" tab.
Related
Situation: we have a set of build configurations based on the same build template. So, all the configs are marked as "based on MySuperTemplate" and all build steps are marked as (inherited). So far so good.
Eventually I introduced a change in a step of a particular build config, not in the template itself. After figuring this out, I applied the change to the template, however corresponding step of that particular build config is still marked as (inherited, overridden).
Question: how to undo that "override state" back to "just inherited" so the step will accept all the changes from the template origin again?
P.S. TeamCity version is 2021.2.3 (build 99711) if it matters...
No idea why I didn't notice it before:
Open the build configuration, go to the grid of steps
At a grid row with "overridden" step, find "Edit" hotlink accompanied with a small combo-button aside (right-side of the row)
Open a drop-down for this combo-button and click "Reset" option (it appears for overridden steps only, regular ones are provided with "copy" and "disable" choices)
As simple as that. Now the step is reverted back to the template-defined content.
I am new to TeamCity.
I need to create a configuration parameters for build (android).
Configuration parameters should consists from git branch (branch to build), build type and where to push the build (if i choose to push at all).
Example.
How to automatically populate "Build Branch" field with git branches from my repo?
Depending on what is selected in "Build Type" [Release|Debug] how to automatically change what is available for selection in "Make Public" field.
Example:
If "Build Type" is Debug then A and B should be available to select in "Make Public" field.
If "Build Type" is Release then C and D should be available to select in "Make Public" field.
TeamCity version: "TeamCity Professional 2018.1.1 (build 58406)".
First of all, you should use the VCS Roots.
Go to
Create VCS Root
Attach this VCS to your build
General Settings
Version Control Settings
Attach VCS root
Now your project able to build on the different branch
Create the Parameter Build_Type
Click to Spec: Edit
The construction
Debug => A,B
Release => C,D
means if I choose Debug, the real value of the parameter %Build_Type% is A,B
TC hasn't an opportunity to create a depends parameters what you want. But you can use the real value of Build_Type.
The second way is:
User selects the Build_Type and Make_Public.
Run the custom script to determine the needed value and pass it to project.
One more way:
Create a template of builds
Create 2 projects where 1th has one parameter, the second project has another
I'm using perforce in my project. I would like to ask, how can I set the build branch in teamcity? Right now if I want to make a build it is taking code from trunk, when I hit the "run" button it is asking me for my username/password/perforce job, I also need to ask me for a branch name. I know that is needs to be set in the build configuration in build parameters.
I'd suggest using the "Run Custom Build" button to achieve it. It's located next to the "Run" button and titled with ellipsis (three dots in a row).
I might be mistaken in case of the particular VCS you're using (Perforce) though, but for me it works pretty good. When you run a custom build you can either specify the value of your %BranchName% parameter (needs to be specified in your VCS' settings) in "Parameters" tab or select a branch in "Changes" tab.
Hope this helps.
i am looking for a way to share build number between multiple build configurations. The goal is to have an global counter of some sort and all build configurations would be incrementing it and use it in its own the build number.
If one of build configurations A has snapshot or artifact dependency on build configuration B, then you can obtain build number from B in A with help of dependency parameter:
%dep.<B id>.build.number%
Where <B id> is id of build configuration B (see buildTypeId parameter in URL).
This solution works for me:
Create Build Configuration. Let say "GenerateBuildNumber", do not attach template. Do not specify any build steps. Click Save.
Edit configuration for your project. Go to "Build Configuration Settings->Dependencies". Click "Add new snapshot dependecy".
Select previously created "GenerateBuildNumber" in "Depend on" section. Uncheck option "Do not run new build if there is a suitable one". Click Save.
Go to "General Settings", clear "Build number format:", click the button on the left side with 3 lines. Select "%dep.YouProjName_GenerateBuildNumber.env.BUILD_NUMBER%". Click Save.
Run your project build. Firstly it should start "GenerateBuildNumber" project then your project with a generated number.
Do the steps 2-4 for every project you want to have unique generated number.
Profit!
I believe the AutoIncrementer plugin should do the trick. It lets you share build numbers between configurations. http://confluence.jetbrains.com/display/TW/Autoincrementer
You can make one Team City project use the build number from another project by following these steps:
Open the TeamCity project configuration's properties for the configuration where you want to import the build number.
Go to the "Dependencies" section.
Add an "Artifact Dependency" and choose the project configuration that you want to get the build number from as the dependent project.
In the "Get artifacts from" field choose "Build with specified build number"
Next to the "Build number" input box there is a button you can click to choose where to get the build number. In this list you should see an option like "dep.bt2.build.number" (the number might not be 2 for your configuration).
AutoIncrementer is good, but now there is a new plugin that has tried to do what some users said they can't do with AutoIncrementer:
http://java.nicholaswilliams.net/TeamCityPlugins/introduction#SharedBuildNumber
It has a UI when you add it to TeamCity, and can also handle the use of dates in the format that you might want to use.
The easiest way by far is to use the variable that gets exposed:
%dep.<build configuration id here>.build.number%
You can use any parameter from the dependency using that variable. If you start typing % in a field with the square box next to it that lets you choose a variable it will pop up with the build configuration id there.
How to set parameter
Step 1: Using IDE to pick up which one you want to use
Step 2: %dep.[B id].build.number% from another project name
How to get parameter
echo %CAPR_number% <-- Parameter Name
We're using the Sql Server 2012 SSDT which removed the deploy option in Visual Studio for the database projects (now sql projects). We'd like to automate the Publish step as we had for deploy, but it's not clear how to do this. so thA couple of questions:
I've added the .publish.xml to the project (after the first manual publish, checking add to project). Even after that, and setting it to the default, when I double click it, it builds, but always pops up settings window, where I need to click the "Publish" button to continue. Is there a setting that would skip this prompt and use the current values?
It seems that each publish generates a version of the sql output. How can I suppress this- i.e. overwrite the base file each time?
And lastly, any pointers for updating the build to use the new project type and publish command for the automated builds would be appreciated.
How to restore the Deploy option: (Visual Studio 2010/2012 only -- this is no longer supported in Visual Studio 2013)
The Deploy option is still present but for some reason it's not available in the menus. (Cursed Visual Studio team!) I've worked around this by adding the Deploy option to one of the toolbars as follows:
Click the arrow on the right-hand side of a toolbar.
Click "Add or Remove Buttons", then Customize.
In the Customize dialog click Add Command.
Select the "Build" category, then select the "Deploy Selection" command.
After saving your selection the "Deploy [project name]" option will appear on the toolbar. You'll need to select your project in Solution Explorer for the button to become enabled.
Note that the deployment settings are different than the publish settings. The deployment settings are configured in the project's properties on the Debug tab.
To answer your questions about the Publish option:
1) How to use a specific publish file by default and avoid the annoying prompt
I don't think there's a way around this.
2) How to publish the entire database, not just the changes
Open your .publish.xml file in a text editor and add <AlwaysCreateNewDatabase>true</AlwaysCreateNewDatabase>.
For example:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetDatabaseName>MyDatabase</TargetDatabaseName>
<DeployScriptFileName>MyDatabaseProject.sql</DeployScriptFileName>
<TargetConnectionString>Data Source=localhost\SQL2012;Integrated Security=True;Pooling=False</TargetConnectionString>
<PublishDependentProjects>False</PublishDependentProjects>
<ProfileVersionNumber>1</ProfileVersionNumber>
<AlwaysCreateNewDatabase>true</AlwaysCreateNewDatabase>
</PropertyGroup>
</Project>
3) Command-line syntax for automated builds
First build your project with msbuild as you normally would so that the .dacpac file is created in the bin.
Then use sqlpackage.exe to publish using your .publish.xml file:
C:\Program Files\Microsoft Visual Studio 10.0\Microsoft SQL Server Data Tools\sqlpackage.exe /Action:Publish /SourceFile:C:\[path to my project]\bin\Debug\MyDatabaseProject.dacpac /Profile:C:\[path to my project]\MyDatabaseProject.publish.xml
Note that the path to sqlpackage.exe may be different.
A bit late to the party, I admit, but maybe this will help others who stumble across this discussion. My company is presently moving to VS2012 and we have all three of the same issues as Keith. I have found workarounds for #1 and #2.
For #1, I use AutoHotKey to monitor for the existence of the publish window, and automatically click the "Create Script" button. You could of course have the script automatically click the "Publish" button instead. In this example if the publish profile is not "XYZ" (I always prefer manual intervention for production server deployments) then go ahead and send an Alt+G to generate the script.
#Persistent
SetTimer, ClosePopups, 5000
return
ClosePopups:
if WinExist("Publish Database ")
{
WinActivate, Publish Database
WinGetTitle, TitleText, A
If not TitleText = "Publish Database XYZ.publish.xml" {
Send, !G
}
}
return
For #2, every time we publish it increments the filename with a number suffix and we end up with lots of files in our deployment folder. I just used pre-build events to clear out the .sql and .txt files before the build:
if exist "$(ProjectDir)$(OutputPath)*.publish.sql" del $(ProjectDir)$(OutputPath)*.publish.sql
if exist "$(ProjectDir)$(OutputPath)*.txt" del $(ProjectDir)$(OutputPath)*.txt
The best way I have found to automate the deployment of SSDT database projects is to use msbuild. Originally we were using VSTSDB and used msbuild against the *.dbproj file. As it turned out the arguments for deploying sqlproj files is exactly the same.
Because the old argument list works for us, I didnt swap to using the public.xml file style. There quite a bit of documentation for the vsdbcmd.exe and msbuild against dbproj. I would use that as reference.
Here's argument list, and execution output as we define it for FinalBuilder execution
[ MSBuild Project [ C:\xx\xxx\xx\xx\MyProject.sqlproj ] ]
Configuration : Release
OutDir : C:\Builds\1\xxxxx\builddefname\Binaries\Release\
DeployToDatabase : True
TargetDatabase : ExistingDatabaseName
TargetConnectionString : Data source=.;Integrated Security=SSPI;**
Build started 3/23/2012 2:17:08 PM.
Deployment script generated to:
C:\Builds\1\xxxx\builddefname_FB\Binaries\Release\MyProject.sql
Dropping FK_at_lusys_assetCategory_at_lusys_image...
Creating FK_dcb28374eeabe8e715038984419...
Creating FK_d82897e4acd966d4b136c242cef...
Checking existing data against newly created constraints
Update complete.
Done Building Project "C:\xxx\xxxxxxx\xxxxxxxxx\MyProject.sqlproj" (Deploy target(s)).
Build succeeded.
0 Warning(s)
0 Error(s)
and putting together the msbuild command line looks like this:
msbuild XXX.sqlproj /target:Deploy /p:Configuration=xxx;OutDir=xxx;DeployToDatabase=True;TargetDatabase=xxxx;TargetConnectionString="xxxxx";AlwaysCreateNewDatabase=True