Enable TeamCity DSL
This commit is contained in:
parent
5014e46b48
commit
d634c32fd4
|
@ -0,0 +1,2 @@
|
|||
*.iml
|
||||
target/
|
|
@ -0,0 +1,104 @@
|
|||
<?xml version="1.0"?>
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>PackerVSphere Config DSL Script</name>
|
||||
<groupId>PackerVSphere</groupId>
|
||||
<artifactId>PackerVSphere_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>https://teamcity.jetbrains.com/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>.</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>
|
|
@ -0,0 +1,137 @@
|
|||
import jetbrains.buildServer.configs.kotlin.v2018_2.*
|
||||
import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.PullRequests
|
||||
import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.commitStatusPublisher
|
||||
import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.pullRequests
|
||||
import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.dockerCompose
|
||||
import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.script
|
||||
import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.vcs
|
||||
import jetbrains.buildServer.configs.kotlin.v2018_2.vcs.GitVcsRoot
|
||||
|
||||
version = "2018.2"
|
||||
|
||||
project {
|
||||
description = "https://github.com/jetbrains-infra/packer-builder-vsphere"
|
||||
|
||||
vcsRoot(GitHub)
|
||||
|
||||
buildType(Build)
|
||||
|
||||
features {
|
||||
|
||||
feature {
|
||||
type = "IssueTracker"
|
||||
param("type", "GithubIssues")
|
||||
param("repository", "https://github.com/jetbrains-infra/packer-builder-vsphere")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object GitHub : GitVcsRoot({
|
||||
name = "packer-builder-vsphere"
|
||||
url = "https://github.com/jetbrains-infra/packer-builder-vsphere"
|
||||
branch = "master"
|
||||
branchSpec = "+:refs/heads/(*)"
|
||||
userNameStyle = GitVcsRoot.UserNameStyle.FULL
|
||||
})
|
||||
|
||||
object Build : BuildType({
|
||||
val path = "src/github.com/jetbrains-infra/packer-builder-vsphere"
|
||||
val golangImage = "jetbrainsinfra/golang:1.10.4"
|
||||
|
||||
name = "Build"
|
||||
|
||||
vcs {
|
||||
root(GitHub, "+:. => $path")
|
||||
}
|
||||
|
||||
requirements {
|
||||
equals("docker.server.osType", "linux")
|
||||
exists("dockerCompose.version")
|
||||
|
||||
doesNotContain("teamcity.agent.name", "ubuntu-single-build")
|
||||
}
|
||||
|
||||
params {
|
||||
password("env.VPN_PASSWORD", "credentialsJSON:8c355e81-9a26-4788-8fea-c854cd646c35")
|
||||
param ("env.VSPHERE_USERNAME", """vsphere65.test\teamcity""")
|
||||
password("env.VSPHERE_PASSWORD", "credentialsJSON:3e99d6c8-b66f-410a-a865-eaf1b12664ad")
|
||||
|
||||
param("env.GOPATH", "%teamcity.build.checkoutDir%")
|
||||
param("env.GOCACHE", "%teamcity.build.checkoutDir%/build")
|
||||
}
|
||||
|
||||
steps {
|
||||
script {
|
||||
name = "Build"
|
||||
workingDir = path
|
||||
scriptContent = "./build.sh"
|
||||
dockerImage = golangImage
|
||||
dockerPull = true
|
||||
}
|
||||
|
||||
dockerCompose {
|
||||
name = "Start VPN tunnel"
|
||||
file = "$path/teamcity-services.yml"
|
||||
}
|
||||
|
||||
script {
|
||||
name = "Test"
|
||||
workingDir = path
|
||||
scriptContent = """
|
||||
set -eux
|
||||
|
||||
go test -c ./driver
|
||||
go test -c ./iso
|
||||
go test -c ./clone
|
||||
|
||||
./test.sh | go-test-teamcity
|
||||
""".trimIndent()
|
||||
dockerImage = golangImage
|
||||
dockerPull = true
|
||||
dockerRunParameters = "--network=container:vpn"
|
||||
}
|
||||
script {
|
||||
name = "gofmt"
|
||||
executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE
|
||||
workingDir = path
|
||||
scriptContent = "./gofmt.sh"
|
||||
dockerImage = golangImage
|
||||
dockerPull = true
|
||||
}
|
||||
}
|
||||
|
||||
features {
|
||||
commitStatusPublisher {
|
||||
publisher = github {
|
||||
githubUrl = "https://api.github.com"
|
||||
authType = personalToken {
|
||||
token = "credentialsJSON:95bbfc46-3141-4bed-86ec-f8ec751f3e94"
|
||||
}
|
||||
}
|
||||
param("github_oauth_user", "mkuzmin")
|
||||
}
|
||||
pullRequests {
|
||||
provider = github {
|
||||
authType = token {
|
||||
token = "credentialsJSON:39727f26-62ed-4152-ab9a-f6845076a979"
|
||||
}
|
||||
filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
triggers {
|
||||
vcs {
|
||||
triggerRules = "-:*.md"
|
||||
branchFilter = """
|
||||
+:*
|
||||
-:temp-*
|
||||
-:pull/*
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
maxRunningBuilds = 2
|
||||
|
||||
artifactRules = "$path/bin/* => packer-builder-vsphere-%build.number%.zip"
|
||||
allowExternalStatus = true
|
||||
})
|
Loading…
Reference in New Issue