Kotlin DSL: Artifact dependency with according build trigger
Hi,
I'm currently trying to figure out the following scenario in KotlinDSL:
I have 3 build configs in my project:
- BuildConfigDebug and BuildConfigRelease both build some artifact equally named
- BuildConfigDeploy deploys this artifact to some server
BuildConfigDebug and BuildConfigRelease look similar and only differ in the build step, e.g.:
project {
buildType(BuildDebug)
buildType(BuildRelease)
}
object BuildDebug : BuildType({
[...]
params {
checkbox("DEPLOY_ARTIFACT", "False",
description = "Mark this as checked for artifact deployment",
checked = "True",
unchecked = "False")
}
steps {
script {
// build artifact MY_ARTIFACT
}
step {
// if DEPLOY_ARTIFACT == True:
// trigger BuildConfigDeploy job with artifact dependency to get MY_ARTIFACT
}
}
})
[...]
I know how to set-up BuildConfigDeploy that depends on a certain Build config id, but here I don't want to depend on a certain config but rather be able to trigger the Deploy config from different Build configs.
I need this because my Deploy config needs to run on a Windows host while the Build configs need Linux.
Do you have some idea how to solve that?
Thx
Please sign in to leave a comment.
You may fetch artifacts via REST API during the build; in theory, you could start Deploy build with some parameter that defines whether Windows or Linux build should be deployed, and depending on the parameter value build would fetch artifacts from the corresponding build. Would this approach work for you?
If you would like to start Deploy build from either of other builds, you could also use REST API for that. Please refer to the following articles:
* [Start and Cancel Builds](https://www.jetbrains.com/help/teamcity/rest/2022.10/start-and-cancel-builds.html);
* [Get Build Artifacts.](https://www.jetbrains.com/help/teamcity/rest/2022.10/manage-finished-builds.html#Get+Build+Artifacts)
For any questions or concerns, please do not hesitate to reach out.