Skip to content

Commit

Permalink
Merge branch 'teamcity-versioned-settings' into donat/teamcity/move-p…
Browse files Browse the repository at this point in the history
…lay-tests-to-master-accept
  • Loading branch information
donat committed Jul 9, 2018
2 parents 3c42bae + d280cbf commit 4847612
Show file tree
Hide file tree
Showing 40 changed files with 198 additions and 150 deletions.
6 changes: 3 additions & 3 deletions .teamcity/Gradle_AgentTest/settings.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Gradle_AgentTest

import jetbrains.buildServer.configs.kotlin.v2017_2.*
import jetbrains.buildServer.configs.kotlin.v2018_1.*
import model.*
import projects.RootProject

Expand Down Expand Up @@ -33,7 +33,7 @@ node (Plugins -> teamcity-configs -> teamcity-configs:generate),
the 'Debug' option is available in the context menu for the task.
*/

version = "2017.2"
version = "2018.1"
val buildModel = CIBuildModel(
projectPrefix = "Gradle_AgentTest_",
rootProjectName = "Test Build Agents",
Expand All @@ -50,4 +50,4 @@ val buildModel = CIBuildModel(
functionalTests = listOf(TestCoverage(TestType.quick, OS.linux, JvmVersion.java8)))
)
)
project(RootProject(buildModel))
project(RootProject(buildModel))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2017_2.BuildType
import jetbrains.buildServer.configs.kotlin.v2018_1.BuildType
import model.BuildCache
import model.CIBuildModel
import model.Stage
Expand Down
5 changes: 3 additions & 2 deletions .teamcity/Gradle_Check/configurations/BuildDistributions.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import model.CIBuildModel
import model.Stage

class BuildDistributions(model: CIBuildModel, stage: Stage) : BaseGradleBuildType(model, stage = stage, init = {
uuid = "${model.projectPrefix}BuildDistributions"
id = uuid
id = AbsoluteId(uuid)
name = "Build Distributions"
description = "Creation and verification of the distribution and documentation"

applyDefaults(model, this, "packageBuild", extraParameters = buildScanTag("BuildDistributions"))
applyDefaults(model, this, "packageBuild", extraParameters = buildScanTag("BuildDistributions") + " -PtestJavaHome=%linux.java8.oracle.64bit%")

artifactRules = """$artifactRules
build/distributions/*.zip => distributions
Expand Down
3 changes: 2 additions & 1 deletion .teamcity/Gradle_Check/configurations/DependenciesCheck.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import model.CIBuildModel
import model.Stage

class DependenciesCheck(model: CIBuildModel, stage: Stage) : BaseGradleBuildType(model, stage = stage, init = {
uuid = "${model.projectPrefix}DependenciesCheck"
id = uuid
id = AbsoluteId(uuid)
name = "Dependencies Check - Java8 Linux"
description = "Checks external dependencies in Gradle distribution for known, published vulnerabilities"

Expand Down
9 changes: 5 additions & 4 deletions .teamcity/Gradle_Check/configurations/FunctionalTest.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import model.CIBuildModel
import model.OS
import model.Stage
Expand All @@ -8,7 +9,7 @@ import model.TestType

class FunctionalTest(model: CIBuildModel, testCoverage: TestCoverage, subProject: String = "", stage: Stage) : BaseGradleBuildType(model, stage = stage, init = {
uuid = testCoverage.asConfigurationId(model, subProject)
id = uuid
id = AbsoluteId(uuid)
name = testCoverage.asName() + if (!subProject.isEmpty()) " ($subProject)" else ""
val testTask = if (!subProject.isEmpty()) {
subProject + ":"
Expand All @@ -20,18 +21,18 @@ class FunctionalTest(model: CIBuildModel, testCoverage: TestCoverage, subProject
val buildScanValues = mapOf(
"coverageOs" to testCoverage.os.name,
"coverageJvmVendor" to testCoverage.vendor.name,
"coverageJvmVersion" to testCoverage.version.name
"coverageJvmVersion" to testCoverage.testJvmVersion.name
)
applyDefaults(model, this, testTask, notQuick = !quickTest, os = testCoverage.os,
extraParameters = (
listOf(""""-PtestJavaHome=%${testCoverage.os}.${testCoverage.version}.${testCoverage.vendor}.64bit%"""")
listOf(""""-PtestJavaHome=%${testCoverage.os}.${testCoverage.testJvmVersion}.${testCoverage.vendor}.64bit%"""")
+ buildScanTags.map { buildScanTag(it) }
+ buildScanValues.map { buildScanCustomValue(it.key, it.value) }
).joinToString(separator = " "),
timeout = testCoverage.testType.timeout)

params {
param("env.JAVA_HOME", "%${testCoverage.os}.java8.oracle.64bit%")
param("env.JAVA_HOME", "%${testCoverage.os}.${testCoverage.buildJvmVersion}.oracle.64bit%")
if (testCoverage.os == OS.linux) {
param("env.ANDROID_HOME", "/opt/android/sdk")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2017_2.BuildFeatures
import jetbrains.buildServer.configs.kotlin.v2017_2.BuildStep
import jetbrains.buildServer.configs.kotlin.v2017_2.BuildSteps
import jetbrains.buildServer.configs.kotlin.v2017_2.BuildType
import jetbrains.buildServer.configs.kotlin.v2017_2.CheckoutMode
import jetbrains.buildServer.configs.kotlin.v2017_2.FailureAction
import jetbrains.buildServer.configs.kotlin.v2017_2.ProjectFeatures
import jetbrains.buildServer.configs.kotlin.v2017_2.buildFeatures.commitStatusPublisher
import jetbrains.buildServer.configs.kotlin.v2017_2.buildSteps.GradleBuildStep
import jetbrains.buildServer.configs.kotlin.v2017_2.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import jetbrains.buildServer.configs.kotlin.v2018_1.BuildFeatures
import jetbrains.buildServer.configs.kotlin.v2018_1.BuildStep
import jetbrains.buildServer.configs.kotlin.v2018_1.BuildSteps
import jetbrains.buildServer.configs.kotlin.v2018_1.BuildType
import jetbrains.buildServer.configs.kotlin.v2018_1.CheckoutMode
import jetbrains.buildServer.configs.kotlin.v2018_1.FailureAction
import jetbrains.buildServer.configs.kotlin.v2018_1.ProjectFeatures
import jetbrains.buildServer.configs.kotlin.v2018_1.buildFeatures.commitStatusPublisher
import jetbrains.buildServer.configs.kotlin.v2018_1.buildSteps.GradleBuildStep
import jetbrains.buildServer.configs.kotlin.v2018_1.buildSteps.script
import model.CIBuildModel
import model.GradleSubproject
import model.OS
Expand All @@ -21,6 +22,13 @@ private val java7Homes = mapOf(
OS.macos to "-Djava7Home=%macos.java7.oracle.64bit%"
)

private val java9Homes = mapOf(
OS.windows to """"-Djava9Home=%windows.java9.oracle.64bit%"""",
OS.linux to "-Djava9Home=%linux.java9.oracle.64bit%",
OS.macos to "-Djava9Home=%macos.java9.oracle.64bit%"
)


fun shouldBeSkipped(subProject: GradleSubproject, testConfig: TestCoverage): Boolean {
// TODO: Hacky. We should really be running all the subprojects on macOS
// But we're restricting this to just a subset of projects for now
Expand All @@ -34,7 +42,9 @@ val gradleParameters = listOf(
"--daemon",
"--continue",
"""-I "%teamcity.build.checkoutDir%/gradle/init-scripts/build-scan.init.gradle.kts"""",
java7Homes[OS.linux]!!
java7Homes[OS.linux]!!,
java9Homes[OS.linux]!!,
"-Dorg.gradle.internal.tasks.createops"
)

val m2CleanScriptUnixLike = """
Expand Down Expand Up @@ -66,7 +76,7 @@ fun applyDefaultSettings(buildType: BuildType, os: OS = OS.linux, timeout: Int =
""".trimIndent()

buildType.vcs {
root(vcsRoot)
root(AbsoluteId(vcsRoot))
checkoutMode = CheckoutMode.ON_AGENT
buildDefaultBranch = !vcsRoot.contains("Branches")
}
Expand Down Expand Up @@ -111,8 +121,12 @@ fun applyDefaults(model: CIBuildModel, buildType: BaseGradleBuildType, gradleTas
applyDefaultSettings(buildType, os, timeout)

val java7HomeParameter = java7Homes[os]!!
val gradleParameterString = gradleParameters.joinToString(separator = " ")
val java9HomeParameter = java9Homes[os]!!

var gradleParameterString = gradleParameters.joinToString(separator = " ")
.replace(java7Homes[OS.linux]!!, java7HomeParameter)
.replace(java9Homes[OS.linux]!!, java9HomeParameter)

val buildScanTags = model.buildScanTags + listOfNotNull(buildType.stage?.id)

buildType.steps {
Expand Down Expand Up @@ -181,7 +195,7 @@ fun applyDefaultDependencies(model: CIBuildModel, buildType: BuildType, notQuick
if (notQuick) {
// wait for quick feedback phase to finish successfully
buildType.dependencies {
dependency("${model.projectPrefix}Stage_QuickFeedback_Trigger") {
dependency(AbsoluteId("${model.projectPrefix}Stage_QuickFeedback_Trigger")) {
snapshot {
onDependencyFailure = FailureAction.CANCEL
onDependencyCancel = FailureAction.CANCEL
Expand All @@ -195,14 +209,14 @@ fun applyDefaultDependencies(model: CIBuildModel, buildType: BuildType, notQuick
buildType.dependencies {
val sanityCheckId = SanityCheck.buildTypeId(model)
// Sanity Check has to succeed before anything else is started
dependency(sanityCheckId) {
dependency(AbsoluteId(sanityCheckId)) {
snapshot {
onDependencyFailure = FailureAction.CANCEL
onDependencyCancel = FailureAction.CANCEL
}
}
// Get the build receipt from sanity check to reuse the timestamp
artifacts(sanityCheckId) {
artifacts(AbsoluteId(sanityCheckId)) {
id = "ARTIFACT_DEPENDENCY_$sanityCheckId"
cleanDestination = true
artifactRules = "build-receipt.properties => incoming-distributions"
Expand Down
7 changes: 4 additions & 3 deletions .teamcity/Gradle_Check/configurations/Gradleception.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2017_2.BuildSteps
import jetbrains.buildServer.configs.kotlin.v2017_2.buildSteps.GradleBuildStep
import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import jetbrains.buildServer.configs.kotlin.v2018_1.BuildSteps
import jetbrains.buildServer.configs.kotlin.v2018_1.buildSteps.GradleBuildStep
import model.CIBuildModel
import model.Stage

class Gradleception(model: CIBuildModel, stage: Stage) : BaseGradleBuildType(model, stage = stage, init = {
uuid = "${model.projectPrefix}Gradleception"
id = uuid
id = AbsoluteId(uuid)
name = "Gradleception - Java8 Linux"
description = "Builds Gradle with the version of Gradle which is currently under development (twice)"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2017_2.BuildStep
import jetbrains.buildServer.configs.kotlin.v2017_2.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import jetbrains.buildServer.configs.kotlin.v2018_1.BuildStep
import jetbrains.buildServer.configs.kotlin.v2018_1.buildSteps.script
import model.CIBuildModel
import model.OS

class IndividualPerformanceScenarioWorkers(model: CIBuildModel) : BaseGradleBuildType(model, init = {
uuid = model.projectPrefix + "IndividualPerformanceScenarioWorkersLinux"
id = uuid
id = AbsoluteId(uuid)
name = "Individual Performance Scenario Workers - Linux"

applyDefaultSettings(this, timeout = 420)
Expand Down
7 changes: 4 additions & 3 deletions .teamcity/Gradle_Check/configurations/PerformanceTest.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2017_2.BuildStep
import jetbrains.buildServer.configs.kotlin.v2017_2.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import jetbrains.buildServer.configs.kotlin.v2018_1.BuildStep
import jetbrains.buildServer.configs.kotlin.v2018_1.buildSteps.script
import model.CIBuildModel
import model.OS
import model.PerformanceTestType
import model.Stage

class PerformanceTest(model: CIBuildModel, type: PerformanceTestType, stage: Stage) : BaseGradleBuildType(model, stage = stage, init = {
uuid = type.asId(model)
id = uuid
id = AbsoluteId(uuid)
name = "Performance ${type.name.capitalize()} Coordinator - Linux"

applyDefaultSettings(this, timeout = type.timeout)
Expand Down
4 changes: 3 additions & 1 deletion .teamcity/Gradle_Check/configurations/SanityCheck.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import model.CIBuildModel
import model.Stage

class SanityCheck(model: CIBuildModel, stage: Stage) : BaseGradleBuildType(model, stage = stage, usesParentBuildCache = true, init = {
uuid = buildTypeId(model)
id = uuid
id = AbsoluteId(uuid)
name = "Sanity Check"
description = "Static code analysis, checkstyle, release notes verification, etc."

params {
param("system.java9Home", "%linux.java9.oracle.64bit%")
param("env.JAVA_HOME", "%linux.java8.oracle.64bit%")
}

Expand Down
3 changes: 2 additions & 1 deletion .teamcity/Gradle_Check/configurations/SmokeTests.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import model.CIBuildModel
import model.Stage

class SmokeTests(model: CIBuildModel, stage: Stage) : BaseGradleBuildType(model, stage = stage, init = {
uuid = "${model.projectPrefix}SmokeTests"
id = uuid
id = AbsoluteId(uuid)
name = "Smoke Tests with 3rd Party Plugins - Java8 Linux"
description = "Smoke tests against third party plugins to see if they still work with the current Gradle version"

Expand Down
35 changes: 18 additions & 17 deletions .teamcity/Gradle_Check/configurations/StagePasses.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package configurations

import jetbrains.buildServer.configs.kotlin.v2017_2.BuildStep
import jetbrains.buildServer.configs.kotlin.v2017_2.FailureAction
import jetbrains.buildServer.configs.kotlin.v2017_2.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.ScheduleTrigger
import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.VcsTrigger
import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.schedule
import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.vcs
import jetbrains.buildServer.configs.kotlin.v2018_1.AbsoluteId
import jetbrains.buildServer.configs.kotlin.v2018_1.BuildStep
import jetbrains.buildServer.configs.kotlin.v2018_1.FailureAction
import jetbrains.buildServer.configs.kotlin.v2018_1.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2018_1.triggers.ScheduleTrigger
import jetbrains.buildServer.configs.kotlin.v2018_1.triggers.VcsTrigger
import jetbrains.buildServer.configs.kotlin.v2018_1.triggers.schedule
import jetbrains.buildServer.configs.kotlin.v2018_1.triggers.vcs
import model.CIBuildModel
import model.Stage
import model.TestType
import model.Trigger

class StagePasses(model: CIBuildModel, stage: Stage, prevStage: Stage?, containsDeferredTests: Boolean) : BaseGradleBuildType(model, init = {
class StagePasses(model: CIBuildModel, stage: Stage, prevStage: Stage?, containsDeferredTests: Boolean, rootProjectUuid: String) : BaseGradleBuildType(model, init = {
uuid = "${model.projectPrefix}Stage_${stage.id}_Trigger"
id = uuid
id = AbsoluteId(uuid)
name = stage.name + " (Trigger)"

applyDefaultSettings(this)
Expand Down Expand Up @@ -68,7 +69,7 @@ class StagePasses(model: CIBuildModel, stage: Stage, prevStage: Stage?, contains
gradleWrapper {
name = "GRADLE_RUNNER"
tasks = "createBuildReceipt"
gradleParams = "-PtimestampedVersion -Djava7Home=%linux.jdk.for.gradle.compile% --daemon"
gradleParams = "-PtimestampedVersion -Djava7Home=%linux.jdk.for.gradle.compile% -Djava9Home=%linux.java9.oracle.64bit% --daemon"
}
script {
name = "CHECK_CLEAN_M2"
Expand All @@ -88,7 +89,7 @@ class StagePasses(model: CIBuildModel, stage: Stage, prevStage: Stage?, contains

dependencies {
if (!stage.runsIndependent && prevStage != null) {
dependency("${model.projectPrefix}Stage_${prevStage.id}_Trigger") {
dependency(AbsoluteId("${model.projectPrefix}Stage_${prevStage.id}_Trigger")) {
snapshot {
onDependencyFailure = FailureAction.ADD_PROBLEM
}
Expand All @@ -102,7 +103,7 @@ class StagePasses(model: CIBuildModel, stage: Stage, prevStage: Stage?, contains
}

stage.performanceTests.forEach { performanceTest ->
dependency(performanceTest.asId(model)) {
dependency(AbsoluteId(performanceTest.asId(model))) {
snapshot {}
}
}
Expand All @@ -118,22 +119,22 @@ class StagePasses(model: CIBuildModel, stage: Stage, prevStage: Stage?, contains
return@forEach
}
if (subProject.unitTests && testCoverage.testType.unitTests) {
dependency(testCoverage.asConfigurationId(model, subProject.name)) { snapshot {} }
dependency(AbsoluteId(testCoverage.asConfigurationId(model, subProject.name))) { snapshot {} }
} else if (subProject.functionalTests && testCoverage.testType.functionalTests) {
dependency(testCoverage.asConfigurationId(model, subProject.name)) { snapshot {} }
dependency(AbsoluteId(testCoverage.asConfigurationId(model, subProject.name))) { snapshot {} }
} else if (subProject.crossVersionTests && testCoverage.testType.crossVersionTests) {
dependency(testCoverage.asConfigurationId(model, subProject.name)) { snapshot {} }
dependency(AbsoluteId(testCoverage.asConfigurationId(model, subProject.name))) { snapshot {} }
}
}
} else {
dependency(testCoverage.asConfigurationId(model)) {
dependency(AbsoluteId(testCoverage.asConfigurationId(model))) {
snapshot {}
}
}
}

if (containsDeferredTests) {
dependency("deferred_tests") { snapshot {} }
dependency(AbsoluteId("${rootProjectUuid}_deferred_tests")) { snapshot {} }
}
}
})
Loading

0 comments on commit 4847612

Please sign in to comment.