Skip to content

Commit 3782261

Browse files
committed
Downstream merge: removed source trigger.
1 parent 62b6e54 commit 3782261

File tree

4 files changed

+92
-22
lines changed

4 files changed

+92
-22
lines changed

.teamcity/settings.kts

Lines changed: 76 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
// This file is automatically generated by `Build.ps1 generate-scripts`.
22

3-
// Both Swabra and swabra need to be imported
43
import jetbrains.buildServer.configs.kotlin.*
5-
import jetbrains.buildServer.configs.kotlin.buildFeatures.sshAgent
6-
import jetbrains.buildServer.configs.kotlin.buildFeatures.Swabra
7-
import jetbrains.buildServer.configs.kotlin.buildFeatures.swabra
4+
import jetbrains.buildServer.configs.kotlin.buildFeatures.*
85
import jetbrains.buildServer.configs.kotlin.buildSteps.powerShell
96
import jetbrains.buildServer.configs.kotlin.failureConditions.*
107
import jetbrains.buildServer.configs.kotlin.triggers.*
8+
import jetbrains.buildServer.configs.kotlin.projectFeatures.*
119

12-
version = "2024.03"
10+
version = "2025.07"
1311

1412
project {
1513

@@ -37,11 +35,11 @@ object DebugBuild : BuildType({
3735
params {
3836
text("Build.Arguments", "", label = "DockerBuild.ps1 Arguments", description = "Arguments to append to the 'Build' build step.", allowEmpty = true)
3937
param("Build.Timeout", "30")
40-
text("DefaultBranch", "develop/2023.2", label = "Default Branch", description = "The default branch of this build configuration.")
4138
}
4239

4340
vcs {
4441
root(AbsoluteId("Engineering_PostSharpEngineering"))
42+
checkoutMode = CheckoutMode.ON_AGENT
4543
}
4644

4745
steps {
@@ -61,7 +59,7 @@ object DebugBuild : BuildType({
6159
path = "DockerBuild.ps1"
6260
}
6361
noProfile = false
64-
scriptArgs = "-ImageName postsharpengineering-2023.2 -NoBuildImage test --configuration Debug --buildNumber %build.number% --buildType %system.teamcity.buildType.id% %Build.Arguments% --timeout %Build.Timeout%"
62+
scriptArgs = "-Script Build.ps1 -ImageName postsharpengineering-2023.2 -NoBuildImage test --configuration Debug --buildNumber %build.number% --buildType %system.teamcity.buildType.id% %Build.Arguments% --timeout %Build.Timeout%"
6563
}
6664
}
6765

@@ -74,6 +72,27 @@ object DebugBuild : BuildType({
7472
lockingProcesses = Swabra.LockingProcessPolicy.KILL
7573
verbose = true
7674
}
75+
commitStatusPublisher {
76+
vcsRootExtId = "Engineering_PostSharpEngineering"
77+
publisher = github {
78+
githubUrl = "https://api.github.com"
79+
authType = personalToken {
80+
token = "%env.GITHUB_TOKEN%"
81+
}
82+
}
83+
}
84+
pullRequests {
85+
vcsRootExtId = "Engineering_PostSharpEngineering"
86+
provider = github {
87+
authType = token {
88+
token = "%env.GITHUB_TOKEN%"
89+
}
90+
filterTargetBranch = "+:refs/heads/develop/2023.2"
91+
filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY
92+
}
93+
}
94+
95+
7796
}
7897

7998
triggers {
@@ -101,11 +120,11 @@ object ReleaseBuild : BuildType({
101120
params {
102121
text("Build.Arguments", "", label = "DockerBuild.ps1 Arguments", description = "Arguments to append to the 'Build' build step.", allowEmpty = true)
103122
param("Build.Timeout", "30")
104-
text("DefaultBranch", "develop/2023.2", label = "Default Branch", description = "The default branch of this build configuration.")
105123
}
106124

107125
vcs {
108126
root(AbsoluteId("Engineering_PostSharpEngineering"))
127+
checkoutMode = CheckoutMode.ON_AGENT
109128
}
110129

111130
steps {
@@ -125,7 +144,7 @@ object ReleaseBuild : BuildType({
125144
path = "DockerBuild.ps1"
126145
}
127146
noProfile = false
128-
scriptArgs = "-ImageName postsharpengineering-2023.2 -NoBuildImage test --configuration Release --buildNumber %build.number% --buildType %system.teamcity.buildType.id% %Build.Arguments% --timeout %Build.Timeout%"
147+
scriptArgs = "-Script Build.ps1 -ImageName postsharpengineering-2023.2 -NoBuildImage test --configuration Release --buildNumber %build.number% --buildType %system.teamcity.buildType.id% %Build.Arguments% --timeout %Build.Timeout%"
129148
}
130149
}
131150

@@ -138,6 +157,27 @@ object ReleaseBuild : BuildType({
138157
lockingProcesses = Swabra.LockingProcessPolicy.KILL
139158
verbose = true
140159
}
160+
commitStatusPublisher {
161+
vcsRootExtId = "Engineering_PostSharpEngineering"
162+
publisher = github {
163+
githubUrl = "https://api.github.com"
164+
authType = personalToken {
165+
token = "%env.GITHUB_TOKEN%"
166+
}
167+
}
168+
}
169+
pullRequests {
170+
vcsRootExtId = "Engineering_PostSharpEngineering"
171+
provider = github {
172+
authType = token {
173+
token = "%env.GITHUB_TOKEN%"
174+
}
175+
filterTargetBranch = "+:refs/heads/develop/2023.2"
176+
filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY
177+
}
178+
}
179+
180+
141181
}
142182

143183
})
@@ -156,11 +196,11 @@ object PublicBuild : BuildType({
156196
params {
157197
text("Build.Arguments", "", label = "DockerBuild.ps1 Arguments", description = "Arguments to append to the 'Build' build step.", allowEmpty = true)
158198
param("Build.Timeout", "30")
159-
text("DefaultBranch", "develop/2023.2", label = "Default Branch", description = "The default branch of this build configuration.")
160199
}
161200

162201
vcs {
163202
root(AbsoluteId("Engineering_PostSharpEngineering"))
203+
checkoutMode = CheckoutMode.ON_AGENT
164204
}
165205

166206
steps {
@@ -180,7 +220,7 @@ object PublicBuild : BuildType({
180220
path = "DockerBuild.ps1"
181221
}
182222
noProfile = false
183-
scriptArgs = "-ImageName postsharpengineering-2023.2 -NoBuildImage test --configuration Public --buildNumber %build.number% --buildType %system.teamcity.buildType.id% %Build.Arguments% --timeout %Build.Timeout%"
223+
scriptArgs = "-Script Build.ps1 -ImageName postsharpengineering-2023.2 -NoBuildImage test --configuration Public --buildNumber %build.number% --buildType %system.teamcity.buildType.id% %Build.Arguments% --timeout %Build.Timeout%"
184224
}
185225
}
186226

@@ -193,6 +233,27 @@ object PublicBuild : BuildType({
193233
lockingProcesses = Swabra.LockingProcessPolicy.KILL
194234
verbose = true
195235
}
236+
commitStatusPublisher {
237+
vcsRootExtId = "Engineering_PostSharpEngineering"
238+
publisher = github {
239+
githubUrl = "https://api.github.com"
240+
authType = personalToken {
241+
token = "%env.GITHUB_TOKEN%"
242+
}
243+
}
244+
}
245+
pullRequests {
246+
vcsRootExtId = "Engineering_PostSharpEngineering"
247+
provider = github {
248+
authType = token {
249+
token = "%env.GITHUB_TOKEN%"
250+
}
251+
filterTargetBranch = "+:refs/heads/develop/2023.2"
252+
filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY
253+
}
254+
}
255+
256+
196257
}
197258

198259
})
@@ -206,11 +267,11 @@ object PublicDeployment : BuildType({
206267
params {
207268
text("Publish.Arguments", "", label = "DockerBuild.ps1 Arguments", description = "Arguments to append to the 'Publish' build step.", allowEmpty = true)
208269
param("Publish.Timeout", "30")
209-
text("DefaultBranch", "develop/2023.2", label = "Default Branch", description = "The default branch of this build configuration.")
210270
}
211271

212272
vcs {
213273
root(AbsoluteId("Engineering_PostSharpEngineering"))
274+
checkoutMode = CheckoutMode.ON_AGENT
214275
}
215276

216277
steps {
@@ -230,7 +291,7 @@ object PublicDeployment : BuildType({
230291
path = "DockerBuild.ps1"
231292
}
232293
noProfile = false
233-
scriptArgs = "-ImageName postsharpengineering-2023.2 -NoBuildImage publish --configuration Public %Publish.Arguments% --timeout %Publish.Timeout%"
294+
scriptArgs = "-Script Build.ps1 -ImageName postsharpengineering-2023.2 -NoBuildImage publish --configuration Public %Publish.Arguments% --timeout %Publish.Timeout%"
234295
}
235296
}
236297

@@ -267,11 +328,11 @@ object VersionBump : BuildType({
267328
params {
268329
text("Bump.Arguments", "", label = "DockerBuild.ps1 Arguments", description = "Arguments to append to the 'Bump' build step.", allowEmpty = true)
269330
param("Bump.Timeout", "15")
270-
text("DefaultBranch", "develop/2023.2", label = "Default Branch", description = "The default branch of this build configuration.")
271331
}
272332

273333
vcs {
274334
root(AbsoluteId("Engineering_PostSharpEngineering"))
335+
checkoutMode = CheckoutMode.ON_AGENT
275336
}
276337

277338
steps {
@@ -291,7 +352,7 @@ object VersionBump : BuildType({
291352
path = "DockerBuild.ps1"
292353
}
293354
noProfile = false
294-
scriptArgs = "-ImageName postsharpengineering-2023.2 -NoBuildImage bump %Bump.Arguments% --timeout %Bump.Timeout%"
355+
scriptArgs = "-Script Build.ps1 -ImageName postsharpengineering-2023.2 -NoBuildImage bump %Bump.Arguments% --timeout %Bump.Timeout%"
295356
}
296357
}
297358

DockerBuild.ps1

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ param(
1313
[string]$BuildAgentPath = 'C:\BuildAgent',
1414
[switch]$LoadEnvFromKeyVault, # Forces loading environment variables form the key vault.
1515
[switch]$StartVsmon, # Enable the remote debugger.
16+
[string]$Script = 'Build.ps1', # The build script to be executed inside Docker.
1617
[Parameter(ValueFromRemainingArguments)]
1718
[string[]]$BuildArgs # Arguments passed to `Build.ps1` within the container.
1819
)
@@ -26,6 +27,8 @@ $EnvironmentVariables = 'AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AZ_IDENTITY_USE
2627
$ErrorActionPreference = "Stop"
2728
$dockerContextDirectory = "$EngPath/docker-context"
2829

30+
Set-Location $PSScriptRoot
31+
2932
# Function to create secrets JSON file
3033
function New-EnvJson
3134
{
@@ -90,6 +93,12 @@ function New-EnvJson
9093
return $jsonPath
9194
}
9295

96+
if ($env:RUNNING_IN_DOCKER)
97+
{
98+
Write-Error "Already running in Docker."
99+
exit 1
100+
}
101+
93102
# Generate ImageName from script directory if not provided
94103
if ( [string]::IsNullOrEmpty($ImageName))
95104
{
@@ -103,7 +112,8 @@ if ( [string]::IsNullOrEmpty($ImageName))
103112
$ImageTag = "docker-build-image"
104113
}
105114
Write-Host "Generated image name from directory: $ImageTag" -ForegroundColor Cyan
106-
} else
115+
}
116+
else
107117
{
108118
# Generate a hash of the repo directory tagging (4 bytes, 8 hex chars)
109119
$hashBytes = (New-Object -TypeName System.Security.Cryptography.SHA256Managed).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($PSScriptRoot))
@@ -264,7 +274,7 @@ Write-Host "Git directories: " $gitDirectoriesAsString -ForegroundColor Gray
264274
# Kill all containers
265275
docker ps -q --filter "ancestor=$ImageTag" | ForEach-Object {
266276
Write-Host "Killing container $_"
267-
docker kill $_
277+
docker kill $_
268278
}
269279

270280
# Building the image.
@@ -316,9 +326,9 @@ if (-not $BuildImage)
316326
$dockerArgsAsString = $dockerArgs -join " "
317327

318328

319-
Write-Host "Executing: ``docker run --rm --memory=12g $dockerArgsAsString $VolumeMappingsAsString -w $SourceDirName $ImageTag pwsh $pwshArgs -Command `"& .\Build.ps1 $buildArgsString`; $pwshExitCommand`"" -ForegroundColor Cyan
329+
Write-Host "Executing: ``docker run --rm --memory=12g $dockerArgsAsString $VolumeMappingsAsString -w $SourceDirName $ImageTag pwsh $pwshArgs -Command `"& .\$Script $buildArgsString`; $pwshExitCommand`"" -ForegroundColor Cyan
320330

321-
docker run --rm --memory=12g $dockerArgs @VolumeMappings -w $SourceDirName @dockerArgs $ImageTag pwsh $pwshArgs -Command "& .\Build.ps1 $buildArgsString`; $pwshExitCommand; "
331+
docker run --rm --memory=12g $dockerArgs @VolumeMappings -w $SourceDirName @dockerArgs $ImageTag pwsh $pwshArgs -Command "& .\$Script $buildArgsString`; $pwshExitCommand; "
322332
if ($LASTEXITCODE -ne 0)
323333
{
324334
Write-Host "Docker run (build) failed with exit code $LASTEXITCODE" -ForegroundColor Red

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ RUN if ($env:GITDIRS) { `
8383
} `
8484
} `
8585
}
86-
RUN git config --global user.name $env:GIT_USER_NAME; `
87-
git config --global user.email $env:GIT_USER_EMAIL;
86+
RUN if ( $env:GIT_USER_NAME ) { git config --global user.name $env:GIT_USER_NAME } `
87+
if ( $env:GIT_USER_EMAIL ) { git config --global user.email $env:GIT_USER_EMAIL }

src/PostSharp.Engineering.BuildTools/ContinuousIntegration/TeamCity/Generation/TeamCitySettingsFile.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ private static TeamCityBuildConfiguration CreateDownstreamMergeConfiguration( Pr
232232
timeout: product.DownstreamMergeTimeout )
233233
],
234234
SnapshotDependencies = snapshotDependencies.ToArray(),
235-
BuildTriggers = [new SourceBuildTrigger()],
236235
IsSshAgentRequired = productProperties.IsRepoRemoteSsh
237236
};
238237

0 commit comments

Comments
 (0)