Skip to content

Commit

Permalink
run unit testing prior release (#57)
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

* run unit tests before release

* get rid of godeps
  • Loading branch information
mazay authored Oct 7, 2020
1 parent 315f9e9 commit 3a88d5b
Showing 1 changed file with 20 additions and 56 deletions.
76 changes: 20 additions & 56 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ project {

vcsRoot(GitGithubComMazayS3syncServiceGit)

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

object GoDeps : BuildType({
name = "Go dependencies"
object UnitTesting : BuildType({
name = "Unit Testing"

allowExternalStatus = true

params {
param("teamcity.build.default.checkoutDir", "src/s3sync-service")
param("env.GOFLAGS", "-json")
param("env.GOPATH", "/opt/buildagent/work")
password(
"s3sync-service.github.token",
Expand All @@ -94,32 +96,6 @@ object GoDeps : BuildType({
scriptContent = "go mod vendor"
formatStderrAsError = true
}
}
})

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

allowExternalStatus = true

params {
param("teamcity.build.default.checkoutDir", "src/s3sync-service")
param("env.GOFLAGS", "-json")
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 = "Linter check"
Expand All @@ -144,12 +120,6 @@ object UnitTesting : BuildType({
}
}

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

features {
pullRequests {
vcsRootExtId = "${DslContext.settingsRoot.id}"
Expand Down Expand Up @@ -268,15 +238,15 @@ 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
echo "Building binaries for ${'$'}{RELEASE_VERSION}"
make build-all
""".trimIndent()
scriptContent = "make build-all"
formatStderrAsError = true
}
}
Expand All @@ -285,9 +255,6 @@ object Build : BuildType({
snapshot(UnitTesting){
onDependencyFailure = FailureAction.FAIL_TO_START
}
snapshot(GoDeps){
onDependencyFailure = FailureAction.FAIL_TO_START
}
}
})

Expand Down Expand Up @@ -316,18 +283,15 @@ object Release : 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
make build-all
""".trimIndent()
scriptContent = "make build-all"
formatStderrAsError = true
}
script {
Expand Down Expand Up @@ -384,7 +348,7 @@ object Release : BuildType({
}

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

0 comments on commit 3a88d5b

Please sign in to comment.