2018-12-19 14:50:36 -05:00
|
|
|
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 {
|
2018-12-22 13:48:18 -05:00
|
|
|
feature {
|
|
|
|
type = "OAuthProvider"
|
|
|
|
param("providerType", "GitHub")
|
|
|
|
param("displayName", "GitHub.com")
|
|
|
|
param("gitHubUrl", "https://github.com/")
|
|
|
|
param("clientId", "1abfd46417d7795298a1")
|
|
|
|
param("secure:clientSecret", "credentialsJSON:5fe99dc3-4d1d-4fd6-9f5c-e87fbcbd9a4e")
|
|
|
|
param("defaultTokenScope", "public_repo,repo,repo:status,write:repo_hook")
|
|
|
|
}
|
2018-12-19 14:50:36 -05:00
|
|
|
feature {
|
|
|
|
type = "IssueTracker"
|
2018-12-22 13:48:18 -05:00
|
|
|
param("name", "packer-builder-vsphere")
|
2018-12-19 14:50:36 -05:00
|
|
|
param("type", "GithubIssues")
|
|
|
|
param("repository", "https://github.com/jetbrains-infra/packer-builder-vsphere")
|
2018-12-22 13:48:18 -05:00
|
|
|
param("authType", "anonymous")
|
2018-12-19 14:50:36 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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({
|
2018-12-17 17:05:31 -05:00
|
|
|
val golangImage = "jetbrainsinfra/golang:1.11.4"
|
2018-12-19 14:50:36 -05:00
|
|
|
|
|
|
|
name = "Build"
|
|
|
|
|
|
|
|
vcs {
|
2018-12-17 17:05:31 -05:00
|
|
|
root(GitHub)
|
2018-12-19 14:50:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
requirements {
|
|
|
|
equals("docker.server.osType", "linux")
|
|
|
|
exists("dockerCompose.version")
|
|
|
|
|
|
|
|
doesNotContain("teamcity.agent.name", "ubuntu-single-build")
|
|
|
|
}
|
|
|
|
|
|
|
|
params {
|
2018-12-17 17:05:31 -05:00
|
|
|
param("env.GOPATH", "%teamcity.build.checkoutDir%/build/modules")
|
|
|
|
param("env.GOCACHE", "%teamcity.build.checkoutDir%/build/cache")
|
|
|
|
|
2018-12-19 14:50:36 -05:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
name = "Build"
|
|
|
|
scriptContent = "./build.sh"
|
|
|
|
dockerImage = golangImage
|
|
|
|
dockerPull = true
|
|
|
|
}
|
|
|
|
|
|
|
|
dockerCompose {
|
|
|
|
name = "Start VPN tunnel"
|
2018-12-17 17:05:31 -05:00
|
|
|
file = "teamcity-services.yml"
|
2018-12-19 14:50:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
script {
|
|
|
|
name = "Test"
|
|
|
|
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
|
|
|
|
scriptContent = "./gofmt.sh"
|
|
|
|
dockerImage = golangImage
|
|
|
|
dockerPull = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
features {
|
|
|
|
commitStatusPublisher {
|
|
|
|
publisher = github {
|
|
|
|
githubUrl = "https://api.github.com"
|
|
|
|
authType = personalToken {
|
2018-12-22 13:48:18 -05:00
|
|
|
token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc"
|
2018-12-19 14:50:36 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pullRequests {
|
|
|
|
provider = github {
|
|
|
|
authType = token {
|
2018-12-22 13:48:18 -05:00
|
|
|
token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc"
|
2018-12-19 14:50:36 -05:00
|
|
|
}
|
|
|
|
filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
triggers {
|
|
|
|
vcs {
|
2018-12-22 13:48:18 -05:00
|
|
|
triggerRules = """
|
|
|
|
-:*.md
|
|
|
|
-.teamcity/
|
|
|
|
""".trimIndent()
|
2018-12-19 14:50:36 -05:00
|
|
|
branchFilter = """
|
|
|
|
+:*
|
|
|
|
-:temp-*
|
|
|
|
-:pull/*
|
|
|
|
""".trimIndent()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
maxRunningBuilds = 2
|
|
|
|
|
2018-12-17 17:05:31 -05:00
|
|
|
artifactRules = "bin/* => packer-builder-vsphere-%build.number%.zip"
|
2018-12-19 14:50:36 -05:00
|
|
|
allowExternalStatus = true
|
|
|
|
})
|