4

In Jenkins-pipelines there is the concept of Shared Libraries, where you can have parts of the pipeline extracted into another class to re-use in multiple other Jenkinsfile's.

I am new to TeamCity and following this post to set up a Configuration Script.

I have multiple repositories where the pipelines will be the same => eg. Build, Test, Deploy. I do not want to create many scripts where they will be mostly identical apart from SCM URL.

Is it possible to inherit/import a script into another script in TeamCity to keep repetition to a minimum?

mkobit
  • 43,979
  • 12
  • 156
  • 150
bp2010
  • 2,342
  • 17
  • 34

1 Answers1

2

Possible since TeamCity 2017.2:

Since TeamCity 2017.2 You can now use external libraries in your Kotlin DSL code, which allows sharing code between different Kotlin DSL-based projects. To use an external library in your Kotlin DSL code, add a dependency on this library into the .teamcity/pom.xml file in the settings repository and commit this change so that TeamCity detects it. Then, before starting the generation process, the TeamCity server will fetch the necessary dependencies from the Maven repository, compile code with them, and then start the settings generator.

bp2010
  • 2,342
  • 17
  • 34
  • Keep in mind that there should be single repo with configuration. Teamcity doesn't support storage of configuration in each repo with code – Grigory Aug 31 '20 at 13:30