How to define a parameterized Snapshot Dependency in a template?

We have the following project structure:
MicroServices -
     MicroServiceA - (Project)
          MicroServiceA_Build          (Build Configuration)
          MicroServiceA_Package    (Build Configuration)
          MicroServiceA_Deploy       (Build Configuration)
....

MicroServiceA_Package has an artifact & snapshot dependency on MicroServiceA_Build - We currently use in house tools to automate the creation of each project but would like to move towards using Build Configuration Templates and define the dependencies in the template. I'd like to POST something like:
{
        "id": "MicroServices_%system.teamcity.projectName%_Build",
        "type": "snapshot_dependency",
        "properties": {
            "count": 5,
            "property": [{
                "name": "run-build-if-dependency-failed",
                "value": "MAKE_FAILED_TO_START"
            }, {
                "name": "run-build-if-dependency-failed-to-start",
                "value": "MAKE_FAILED_TO_START"
            }, {
                "name": "run-build-on-the-same-agent",
                "value": "false"
            }, {
                "name": "take-started-build-with-same-revisions",
                "value": "true"
            }, {
                "name": "take-successful-builds-only",
                "value": "true"
            }]
        },
        "source-buildType": {
            "id": "MicroServices_%system.teamcity.projectName%_Build",
            "name": "Build",
            "projectName": "MicroServices :: %system.teamcity.projectName%",
            "projectId": "MicroServices_%system.teamcity.projectName%",
            "href": "/httpAuth/app/rest/buildTypes/id:MicroServices_%system.teamcity.projectName%_Build",
            "webUrl": "http://build/teamcity/viewType.html?buildTypeId=MicroServices_%system.teamcity.projectName%_Build"
        }
}

Doing so returns the error:
Error has occurred during request processing (Bad Request). Error: jetbrains.buildServer.server.rest.errors.BadRequestException: Cannot find build type with id 'Microservices_%system.teamcity.projectName%_Build' Invalid request. Please check the request URL and data are correct.

Is there anyway to parameterize the name of a project that is associated with a template in the template itself?

1 comment
Comment actions Permalink

Hi Vlad,

No, at the moment it is not possible to parameterize the name of a project in the template.
I think the feature that you actually need is Project Templates: https://youtrack.jetbrains.com/issue/TW-3287. However we have the request to use configuration parameters in snapshot dependencies: https://youtrack.jetbrains.com/issue/TW-41016.
Won't the project copying work? Actually if a project has build configuration A which depends on build configuration B of the same project and you copy the project, newly created newProject::A should have a dependency on newProject::B.

0

Please sign in to leave a comment.