Chain dependencies fail when canceled

Hello,
 
I have an issue (I think since the last major version of Teamcity).
It seem that having a dependency which is set to cancel in chain is returning an error that should not exist.

 

I tried to reproduce the issue with the smallest project I can. The Kotlin code of this project will be at the end of the post.

 

In my project I have a Main that aggregate the Build and the Test of something. You can cancel Build or Test. If the Build is canceled the Test is also canceled (from the dependency option). Canceling Build or Test is completely ignored by the Main, it will just miss some artifact but we don't care as soon as it is green.

 

With this I should have result like :
  • Do the build > do the test > Main ok
  • Do the build > cancel the test > Main ok
  • Cancel the build > cancel the test > Main ok

But the issue is on the last line where I have 

  • Cancel the build > cancel the test > Main KO with the error "Snapshot dependency "... TestWindows" failed"

The test windows is marked as "Canceled (Snapshot dependency canceled: ... BuildWindows (new))" and this is what I want but because I set in Main for both dependency "On failed to start/canceled dependency: run build, do not add problem" I don't understand why my build is considered as failed.

It seem the cancel status is not the same if it is a dependency cancellation or a direct cancellation and it is a problem for me ...

What am I missing ?

The code of the project :

import jetbrains.buildServer.configs.kotlin.*
import jetbrains.buildServer.configs.kotlin.buildSteps.script

version = "2022.04"

project {

    buildType(Main)
    buildType(TestWindows)
    buildType(BuildWindows)
    buildTypesOrder = arrayListOf(Main, BuildWindows, TestWindows)
}

object BuildWindows : BuildType({
    name = "BuildWindows"

    artifactRules = "**"

    steps {
        script {

            conditions {
                equals("Cancel", "true")
            }
            scriptContent = """echo "##teamcity[buildStop comment='User asked to skip the build.' readdToQueue='false']""""
        }
        script {
            scriptContent = """echo "BuildWindows %build.counter%" > artifactBuildWindows.txt"""
        }
    }
})

object Main : BuildType({
    name = "Main"

    type = BuildTypeSettings.Type.COMPOSITE
    buildNumberPattern = "CancelBuild=${BuildWindows.reverseDepParamRefs["Cancel"]},CancelTest=${TestWindows.reverseDepParamRefs["Cancel"]}"

    params {
        checkbox("reverse.dep.Demo_TestWindows.Cancel", "", label = "Cancel Tests", display = ParameterDisplay.PROMPT,
                  checked = "true", unchecked = "false")
        checkbox("reverse.dep.Demo_BuildWindows.Cancel", "", label = "Cancel build", display = ParameterDisplay.PROMPT,
                  checked = "true", unchecked = "false")
    }

    vcs {
        showDependenciesChanges = true
    }

    dependencies {
        dependency(BuildWindows) {
            snapshot {
                onDependencyCancel = FailureAction.IGNORE
            }

            artifacts {
                cleanDestination = true
                artifactRules = "**"
            }
        }
        dependency(TestWindows) {
            snapshot {
                onDependencyCancel = FailureAction.IGNORE
            }

            artifacts {
                cleanDestination = true
                artifactRules = "**"
            }
        }
    }
})

object TestWindows : BuildType({
    name = "TestWindows"

    artifactRules = "**"

    steps {
        script {

            conditions {
                equals("Cancel", "true")
            }
            scriptContent = """echo "##teamcity[buildStop comment='User asked to skip the build.' readdToQueue='false']""""
        }
        script {
            scriptContent = """echo "TestWindows %build.counter%" > artifactTestWindows.txt"""
        }
    }

    dependencies {
        dependency(BuildWindows) {
            snapshot {
                onDependencyCancel = FailureAction.CANCEL
            }

            artifacts {
                cleanDestination = true
                artifactRules = "**"
            }
        }
    }
})
0

Please sign in to leave a comment.