Skip to content

Commit

Permalink
pipeline fixes (#56)
Browse files Browse the repository at this point in the history
* fail build on failed dependencies

* split docker auto and release builds

* Revert "split docker auto and release builds"

This reverts commit b26768e

* test variables inheritance

* try overriding RELEASE_VERSION

* try overriding RELEASE_VERSION

* build docker images in the release job

* fix docker auto-build job

* fix application build process, fixes #52

* arm artifacts

* adjust log level

* configurable retry options

* add app and version fields to logs

* check if runs in k8s and adjust checksum workers number accordingly

* by default run only 2 checksum workers in k8s

* fix go build recipes

* pass version to the docker build

* logstash/filebeat compatible logging

* add version to the build

* more advanced build chain

* fixed RELEASE_VERSION property

* fix dependencies

* fix reverse dep parameter

* simplify pipeline for now

* godeps build step

* params adjustment

* enable godeps
  • Loading branch information
mazay authored Oct 7, 2020
1 parent f89d72a commit 315f9e9
Showing 1 changed file with 48 additions and 30 deletions.
78 changes: 48 additions & 30 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ project {

vcsRoot(GitGithubComMazayS3syncServiceGit)

buildType(GoDeps)
buildType(UnitTesting)
buildType(DockerBuild)
buildType(Build)
Expand All @@ -67,6 +68,35 @@ project {
}
}

object GoDeps : BuildType({
name = "Go dependencies"

params {
param("teamcity.build.default.checkoutDir", "src/s3sync-service")
param("env.GOPATH", "/opt/buildagent/work")
password(
"s3sync-service.github.token",
"credentialsJSON:38d0338a-0796-4eaa-a625-d9b720d9af17",
label = "Github Token",
display = ParameterDisplay.HIDDEN,
readOnly = true
)
}

vcs {
root(DslContext.settingsRoot)
}

steps {
script {
workingDir = "src"
name = "Go get dependencies"
scriptContent = "go mod vendor"
formatStderrAsError = true
}
}
})

object UnitTesting : BuildType({
name = "Unit Testing"

Expand Down Expand Up @@ -100,12 +130,6 @@ object UnitTesting : BuildType({
""".trimIndent()
formatStderrAsError = true
}
script {
workingDir = "src"
name = "Go get dependencies"
scriptContent = "go mod vendor"
formatStderrAsError = true
}
script {
workingDir = "src"
name = "Go run unit tests"
Expand All @@ -120,6 +144,12 @@ object UnitTesting : BuildType({
}
}

dependencies {
snapshot(GoDeps){
onDependencyFailure = FailureAction.FAIL_TO_START
}
}

features {
pullRequests {
vcsRootExtId = "${DslContext.settingsRoot.id}"
Expand Down Expand Up @@ -172,13 +202,8 @@ object DockerBuild : BuildType({
scriptContent = """
#!/usr/bin/env bash
if [ -z "${'$'}{RELEASE_VERSION}" ]; then
echo "Environment variable RELEASE_VERSION is not set, exiting"
exit 1
else
if [ "${'$'}{RELEASE_VERSION}" = "master" ]; then
RELEASE_VERSION="latest"
fi
if [ "${'$'}{RELEASE_VERSION}" = "master" ]; then
RELEASE_VERSION="latest"
fi
echo "Building docker images for ${'$'}{RELEASE_VERSION}"
Expand Down Expand Up @@ -228,7 +253,6 @@ object Build : BuildType({
param("teamcity.build.default.checkoutDir", "src/s3sync-service")
param("env.RELEASE_VERSION", "%teamcity.build.branch%")
param("env.DEBIAN_FRONTEND", "noninteractive")
param("env.GOFLAGS", "-json")
param("env.GOPATH", "/opt/buildagent/work")
password(
"s3sync-service.github.token",
Expand All @@ -244,21 +268,12 @@ object Build : BuildType({
}

steps {
script {
workingDir = "src"
name = "Go get dependencies"
scriptContent = "go mod vendor"
formatStderrAsError = true
}
script {
name = "Go build"
scriptContent = """
#!/usr/bin/env bash
if [ -z "${'$'}{RELEASE_VERSION}" ]; then
echo "The RELEASE_VERSION is not set, exiting"
exit 1
fi
echo "Building binaries for ${'$'}{RELEASE_VERSION}"
make build-all
""".trimIndent()
Expand All @@ -270,6 +285,9 @@ object Build : BuildType({
snapshot(UnitTesting){
onDependencyFailure = FailureAction.FAIL_TO_START
}
snapshot(GoDeps){
onDependencyFailure = FailureAction.FAIL_TO_START
}
}
})

Expand Down Expand Up @@ -298,12 +316,6 @@ object Release : BuildType({
}

steps {
script {
workingDir = "src"
name = "Go get dependencies"
scriptContent = "go mod vendor"
formatStderrAsError = true
}
script {
name = "Go build"
scriptContent = """
Expand Down Expand Up @@ -371,6 +383,12 @@ object Release : BuildType({
}
}

dependencies {
snapshot(GoDeps){
onDependencyFailure = FailureAction.FAIL_TO_START
}
}

features {
dockerSupport {
loginToRegistry = on {
Expand Down

0 comments on commit 315f9e9

Please sign in to comment.