TLDR: This is a TypeScript SDK for building TeamCity pipelines, instead of using Kotlin or XML.
import { Project } from "https://deno.land/x/teamcity-ts/mod.ts";
const myPipeline = new Project({ id: "MyPipeline" }, (p) => {
const host = p.Parameter({ name: "host", value: "1.1.1.1" });
p.Build({ id: "MyBuild" }, (b) => {
const count = b.Parameter({ name: "count", value: "3" });
b.CommandLineRunner({
id: "MyStep",
cmd: "ping",
args: ["-c", `${count}`, `${host}`],
executionPolicy: "default",
});
});
});
HINT: This SDK targets Deno. Node.js support may be possible in the future...
This SDK is primarily concerned with the generation of the XML & does not provide any further infrastructure to get that XML into the right place at the right time.
Given the above example, it is up to you to do something like this:
const jobs = [];
for (const [filename, doc] of Object.entries(myPipeline.toXml())) {
jobs.push(Deno.writeTextFile(filename, doc.toString(true)));
}
await Promise.all(jobs);
filename
will always begin with .teamcity/
so assuming you tacked the above
on to the example & ran it from the root of your repo you would get the expected
outcome, that is the following files would be written:
./.teamcity/MyPipeline/project-config.xml
./.teamcity/MyPipeline/buildTypes/MyBuild.xml
For a more complete solution checkout https://github.com/brad-jones/axe
- The TeamCity Kotlin DSL documentation has poor coverage.
- Outside of Java/Android circles, Kotlin as a language is not super well known.
- The tooling (VsCode Extension /
Language Server) for Kotlin
is buggy/not very mature.
- IMO Jetbrains IDEs are bloatware.
-
Through a painstaking process this TypeScript DSL is thoroughly documented & refers to the existing documentation for the TeamCity UI.
-
JavaScript & by extension TypeScript is one of the most ubiquitous languages on the planet. Other projects like the AWS CDK have successfully built similar, arguably much more complex, yet accessible DSLs on top of TypeScript.
-
The tooling for JavaScript/TypeScript is leaps and bounds ahead of the Kotlin developer experience.
read more: ./docs/dsl-design.md
I'll be up front right now that I haven't modeled every thing TeamCity provides, only the things that I think are going to matter most but the DSL has escape hatches, similar to the likes of the CDK, so if there is some obscure TeamCity feature that is not modeled, this DSL should still allow you define it in a type safe manner & not stand in your way.
read more: ./docs/extending.md
Legend:
- βοΈ: This means the feature is fully modeled.
- π§ͺ: This means the feature also has a test case that proves it works with the latest version of TeamCity.
- β: This means the DSL provides zero support for this feature & you would have to model this yourself with an escape hatch.
Construct | Status |
---|---|
Build | βοΈ |
Build / Dependencies | β |
Build / Extensions / Agent Free Space | βοΈ |
Build / Extensions / Assembly Info | βοΈ |
Build / Extensions / Auto Merge | βοΈ |
Build / Extensions / Commit Status Publishers / Atlassian Stash | β |
Build / Extensions / Commit Status Publishers / Bitbucket Cloud | β |
Build / Extensions / Commit Status Publishers / Gerrit | β |
Build / Extensions / Commit Status Publishers / Github | βοΈ |
Build / Extensions / Commit Status Publishers / Gitlab | β |
Build / Extensions / Commit Status Publishers / Jetbrains Space | β |
Build / Extensions / Commit Status Publishers / Tfs (AzureDevOps) | β |
Build / Extensions / Commit Status Publishers / Upsource | β |
Build / Extensions / Docker Support | βοΈ |
Build / Extensions / Failure on Message | βοΈ |
Build / Extensions / Failure on Metric | βοΈ |
Build / Extensions / File Content Replacer | βοΈ |
Build / Extensions / Golang | βοΈ |
Build / Extensions / Investigations Auto Assigner | βοΈ |
Build / Extensions / Jira Cloud | βοΈ |
Build / Extensions / Keep Rules | βοΈ |
Build / Extensions / Notifiers / Email | βοΈ |
Build / Extensions / Notifiers / Slack | βοΈ |
Build / Extensions / Nuget Auth | βοΈ |
Build / Extensions / Nuget Packages Indexer | βοΈ |
Build / Extensions / Perfmon | βοΈ |
Build / Extensions / PR Listeners / Bitbucket Cloud | βοΈ |
Build / Extensions / PR Listeners / Bitbucket Server | βοΈ |
Build / Extensions / PR Listeners / Github | βοΈ |
Build / Extensions / PR Listeners / Gitlab | βοΈ |
Build / Extensions / PR Listeners / Tfs (AzureDevOps) | βοΈ |
Build / Extensions / Ruby Env Configurator | βοΈ |
Build / Extensions / Shared Resources | βοΈ |
Build / Extensions / SSH Agent | βοΈ |
Build / Extensions / Swabra | βοΈ |
Build / Extensions / Vcs Labeling | βοΈ |
Build / Extensions / Xml Report Plugin | βοΈ |
Build / Options | βοΈ |
Build / Requirements | βοΈ |
Build / Runners / Ant | β |
Build / Runners / Cargo | β |
Build / Runners / Command Line | βοΈ |
Build / Runners / Conditions | βοΈ |
Build / Runners / Docker | β |
Build / Runners / Docker Compose | β |
Build / Runners / Dotnet | β |
Build / Runners / Dotnet DupFinder | β |
Build / Runners / Dotnet Inspector | β |
Build / Runners / Duplicator | β |
Build / Runners / FTP | β |
Build / Runners / FxCop | β |
Build / Runners / Gradle | β |
Build / Runners / Inspection | β |
Build / Runners / JPS | β |
Build / Runners / Maven2 | β |
Build / Runners / MSpec | β |
Build / Runners / NAnt | β |
Build / Runners / Nuget Installer | β |
Build / Runners / Nuget Pack | β |
Build / Runners / Nuget Publish | β |
Build / Runners / NUnit | β |
Build / Runners / PowerShell | β |
Build / Runners / Python | β |
Build / Runners / Rake | β |
Build / Runners / SBT | β |
Build / Runners / SMB | β |
Build / Runners / SSH | β |
Build / Triggers / Cron | βοΈ |
Build / Triggers / Dependency | βοΈ |
Build / Triggers / Maven Artifact | βοΈ |
Build / Triggers / Maven Snapshot | βοΈ |
Build / Triggers / Nuget | βοΈ |
Build / Triggers / Remote Branch | βοΈ |
Build / Triggers / Retry | βοΈ |
Build / Triggers / Vcs | βοΈ |
Build / Vcs Settings | βοΈ |
Cleanup | βοΈ |
Parameter | βοΈ |
Project | βοΈ |
Project / Extensions / Issue Trackers / BitBucket | βοΈ |
Project / Extensions / Issue Trackers / Bugzilla | βοΈ |
Project / Extensions / Issue Trackers / Github | βοΈ |
Project / Extensions / Issue Trackers / Jira | βοΈ |
Project / Extensions / Issue Trackers / Tfs (AzureDevOps) | βοΈ |
Project / Extensions / Issue Trackers / YouTrack | βοΈ |
Project / Extensions / Keep Rules | βοΈ |
Project / Extensions / OAuth Providers / Amazon Docker | βοΈ |
Project / Extensions / OAuth Providers / BitBucket Cloud | βοΈ |
Project / Extensions / OAuth Providers / Docker | βοΈ |
Project / Extensions / OAuth Providers / Github | βοΈ |
Project / Extensions / OAuth Providers / Gitlab | βοΈ |
Project / Extensions / OAuth Providers / Jetbrains Space | βοΈ |
Project / Extensions / OAuth Providers / Slack | βοΈ |
Project / Extensions / OAuth Providers / Tfs (AzureDevOps) | βοΈ |
Project / Extensions / Package Repositories / Nuget | βοΈ |
Project / Extensions / Report Tabs / Build Report | βοΈ |
Project / Extensions / Report Tabs / Project Report | βοΈ |
Project / Extensions / Shared Resources | βοΈ |
Project / Extensions / Versioned Settings | βοΈ |
VCS Roots / Cvs | β |
VCS Roots / Git | βοΈ |
VCS Roots / Mercurial | β |
VCS Roots / Perforce | β |
VCS Roots / Star Team | β |
VCS Roots / Svn | β |
VCS Roots / Tfs | β |
A quick note about the missing build runners, I am of the strong belief that your pipeline should not rely on magic from the builder server. All functionality can be built in your pipeline on top of the Command Line Runner. All of those other types of build runners are magic IMO.
That said if I get PRs for the other build runners, I'm not going to reject them.