mirror of
https://github.com/Dannecron/netology-devops-teamcity-example.git
synced 2025-12-25 23:32:35 +03:00
add confbuild
This commit is contained in:
7
.teamcity/README
vendored
Normal file
7
.teamcity/README
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
The archive contains settings for a TeamCity project.
|
||||||
|
|
||||||
|
To edit the settings in IntelliJ Idea, open the pom.xml and
|
||||||
|
select the 'Open as a project' option.
|
||||||
|
|
||||||
|
If you want to move this dsl to version control, save it in the
|
||||||
|
.teamcity directory.
|
||||||
40
.teamcity/pluginData/_Self/metaRunners/Example_Build.xml
vendored
Normal file
40
.teamcity/pluginData/_Self/metaRunners/Example_Build.xml
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<meta-runner name="Build">
|
||||||
|
<description>554645</description>
|
||||||
|
<settings>
|
||||||
|
<parameters>
|
||||||
|
<param name="env.name" value="%name%" spec="text display='hidden' validationMode='not_empty'" />
|
||||||
|
<param name="name" value="" spec="text validationMode='not_empty' display='normal'" />
|
||||||
|
</parameters>
|
||||||
|
<build-runners>
|
||||||
|
<runner name="Package" type="Maven2">
|
||||||
|
<conditions>
|
||||||
|
<contains name="teamcity.build.branch" value="master" />
|
||||||
|
</conditions>
|
||||||
|
<parameters>
|
||||||
|
<param name="goals" value="package" />
|
||||||
|
<param name="localRepoScope" value="agent" />
|
||||||
|
<param name="maven.path" value="%teamcity.tool.maven.DEFAULT%" />
|
||||||
|
<param name="pomLocation" value="pom.xml" />
|
||||||
|
<param name="runnerArgs" value="-Dmaven.test.failure.ignore=true" />
|
||||||
|
<param name="teamcity.step.mode" value="execute_if_failed" />
|
||||||
|
<param name="userSettingsSelection" value="userSettingsSelection:default" />
|
||||||
|
</parameters>
|
||||||
|
</runner>
|
||||||
|
<runner name="Build & Test" type="Maven2">
|
||||||
|
<conditions>
|
||||||
|
<does-not-contain name="teamcity.build.branch" value="master" />
|
||||||
|
</conditions>
|
||||||
|
<parameters>
|
||||||
|
<param name="goals" value="clean test" />
|
||||||
|
<param name="localRepoScope" value="agent" />
|
||||||
|
<param name="maven.path" value="%teamcity.tool.maven.DEFAULT%" />
|
||||||
|
<param name="pomLocation" value="pom.xml" />
|
||||||
|
<param name="runnerArgs" value="-Dmaven.test.failure.ignore=true" />
|
||||||
|
<param name="teamcity.step.mode" value="execute_if_failed" />
|
||||||
|
<param name="userSettingsSelection" value="userSettingsSelection:default" />
|
||||||
|
</parameters>
|
||||||
|
</runner>
|
||||||
|
</build-runners>
|
||||||
|
<requirements />
|
||||||
|
</settings>
|
||||||
|
</meta-runner>
|
||||||
104
.teamcity/pom.xml
vendored
Normal file
104
.teamcity/pom.xml
vendored
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<name>Example Config DSL Script</name>
|
||||||
|
<groupId>Example</groupId>
|
||||||
|
<artifactId>Example_dsl</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.jetbrains.teamcity</groupId>
|
||||||
|
<artifactId>configs-dsl-kotlin-parent</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>jetbrains-all</id>
|
||||||
|
<url>https://download.jetbrains.com/teamcity-repository</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>teamcity-server</id>
|
||||||
|
<url>http://localhost:8111/app/dsl-plugins-repository</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>JetBrains</id>
|
||||||
|
<url>https://download.jetbrains.com/teamcity-repository</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>${basedir}</sourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>kotlin-maven-plugin</artifactId>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
|
||||||
|
<configuration/>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>compile</id>
|
||||||
|
<phase>process-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>test-compile</id>
|
||||||
|
<phase>process-test-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>test-compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jetbrains.teamcity</groupId>
|
||||||
|
<artifactId>teamcity-configs-maven-plugin</artifactId>
|
||||||
|
<version>${teamcity.dsl.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<format>kotlin</format>
|
||||||
|
<dstDir>target/generated-configs</dstDir>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.teamcity</groupId>
|
||||||
|
<artifactId>configs-dsl-kotlin</artifactId>
|
||||||
|
<version>${teamcity.dsl.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.teamcity</groupId>
|
||||||
|
<artifactId>configs-dsl-kotlin-plugins</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-script-runtime</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
168
.teamcity/settings.kts
vendored
Normal file
168
.teamcity/settings.kts
vendored
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.maven
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.python
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot
|
||||||
|
|
||||||
|
/*
|
||||||
|
The settings script is an entry point for defining a TeamCity
|
||||||
|
project hierarchy. The script should contain a single call to the
|
||||||
|
project() function with a Project instance or an init function as
|
||||||
|
an argument.
|
||||||
|
|
||||||
|
VcsRoots, BuildTypes, Templates, and subprojects can be
|
||||||
|
registered inside the project using the vcsRoot(), buildType(),
|
||||||
|
template(), and subProject() methods respectively.
|
||||||
|
|
||||||
|
To debug settings scripts in command-line, run the
|
||||||
|
|
||||||
|
mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate
|
||||||
|
|
||||||
|
command and attach your debugger to the port 8000.
|
||||||
|
|
||||||
|
To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
|
||||||
|
-> Tool Windows -> Maven Projects), find the generate task node
|
||||||
|
(Plugins -> teamcity-configs -> teamcity-configs:generate), the
|
||||||
|
'Debug' option is available in the context menu for the task.
|
||||||
|
*/
|
||||||
|
|
||||||
|
version = "2020.2"
|
||||||
|
|
||||||
|
project {
|
||||||
|
|
||||||
|
vcsRoot(HttpsGithubComAragastmatbExampleTeamcityGitRefsHeadsMaster)
|
||||||
|
|
||||||
|
buildType(Build)
|
||||||
|
buildType(MyNewBuild)
|
||||||
|
|
||||||
|
template(id123)
|
||||||
|
|
||||||
|
params {
|
||||||
|
text("name", "", allowEmpty = false)
|
||||||
|
text("env.name", "%name%", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object Build : BuildType({
|
||||||
|
name = "Build"
|
||||||
|
|
||||||
|
artifactRules = "target/*.jar => target"
|
||||||
|
publishArtifacts = PublishMode.SUCCESSFUL
|
||||||
|
|
||||||
|
vcs {
|
||||||
|
root(HttpsGithubComAragastmatbExampleTeamcityGitRefsHeadsMaster)
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
maven {
|
||||||
|
name = "Package"
|
||||||
|
executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE
|
||||||
|
|
||||||
|
conditions {
|
||||||
|
contains("teamcity.build.branch", "master")
|
||||||
|
}
|
||||||
|
goals = "package"
|
||||||
|
runnerArgs = "-Dmaven.test.failure.ignore=true"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = "Build & Test"
|
||||||
|
executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE
|
||||||
|
|
||||||
|
conditions {
|
||||||
|
doesNotContain("teamcity.build.branch", "master")
|
||||||
|
}
|
||||||
|
goals = "clean test"
|
||||||
|
runnerArgs = "-Dmaven.test.failure.ignore=true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
vcs {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
object MyNewBuild : BuildType({
|
||||||
|
name = "My New Build"
|
||||||
|
|
||||||
|
params {
|
||||||
|
text("env.some", "one", display = ParameterDisplay.HIDDEN, readOnly = true, allowEmpty = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
python {
|
||||||
|
name = "Get version"
|
||||||
|
command = custom {
|
||||||
|
arguments = "-V"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
script {
|
||||||
|
name = "Get Environment"
|
||||||
|
scriptContent = """
|
||||||
|
echo ${'$'}name
|
||||||
|
echo ${'$'}some
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
requirements {
|
||||||
|
equals("teamcity.agent.jvm.os.name", "MAcos", "RQ_1")
|
||||||
|
}
|
||||||
|
|
||||||
|
disableSettings("RQ_1")
|
||||||
|
})
|
||||||
|
|
||||||
|
object id123 : Template({
|
||||||
|
id("123")
|
||||||
|
name = "123"
|
||||||
|
|
||||||
|
artifactRules = "target/*.jar => target"
|
||||||
|
publishArtifacts = PublishMode.SUCCESSFUL
|
||||||
|
|
||||||
|
vcs {
|
||||||
|
root(HttpsGithubComAragastmatbExampleTeamcityGitRefsHeadsMaster)
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
maven {
|
||||||
|
name = "Package"
|
||||||
|
id = "RUNNER_3"
|
||||||
|
executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE
|
||||||
|
|
||||||
|
conditions {
|
||||||
|
contains("teamcity.build.branch", "master")
|
||||||
|
}
|
||||||
|
goals = "package"
|
||||||
|
runnerArgs = "-Dmaven.test.failure.ignore=true"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = "Build & Test"
|
||||||
|
id = "RUNNER_4"
|
||||||
|
executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE
|
||||||
|
|
||||||
|
conditions {
|
||||||
|
doesNotContain("teamcity.build.branch", "master")
|
||||||
|
}
|
||||||
|
goals = "clean test"
|
||||||
|
runnerArgs = "-Dmaven.test.failure.ignore=true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
vcs {
|
||||||
|
id = "vcsTrigger"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
object HttpsGithubComAragastmatbExampleTeamcityGitRefsHeadsMaster : GitVcsRoot({
|
||||||
|
name = "https://github.com/aragastmatb/example-teamcity.git#refs/heads/master"
|
||||||
|
url = "https://github.com/aragastmatb/example-teamcity.git"
|
||||||
|
branch = "refs/heads/master"
|
||||||
|
branchSpec = "refs/heads/*"
|
||||||
|
authMethod = password {
|
||||||
|
userName = "aragastmatb"
|
||||||
|
password = "credentialsJSON:324ac48d-364a-448d-9ba5-b42efb076fe6"
|
||||||
|
}
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user