alexkvak / teamcity-slack

TeamCity Slack plugin
MIT License
123 stars 23 forks source link

Use real buildType identifiers for buildSettings map in slackIntegration.json #135

Open daywhirls opened 3 years ago

daywhirls commented 3 years ago

Ideally I would love for #32 to happen, but if it is not possible right now, then I may have a workaround suggestion that will allow users to programmatically apply the plugin to all build configurations.

I notice that the settings we apply to all build configurations are currently stored inside config/slackIntegration.json in the form of a buildSettings map:

"buildSettings":{
    "abcde":{
      "buildTypeId":"bt1",
...

Here it seems that each key is a random string of 5 letters that are not useful, and also buildTypeId is using some sort of internal build ID "bt" + x, where x is a number that corresponds to how many total build configurations there are. For example, if I have 2 total build configurations and each are using the plugin, the buildTypeIds are bt1 and bt2. There doesn't seem to be a way to figure out which build configuration ID actually corresponds to these "btX" shorthands being stored in the settings file.

My proposal:

This way, your users can write a quick REST API script to get a list of every build configuration they desire, and then they can use this list to programmatically restructure their slackIntegration.json file to apply the plugin to every build configuration.

The end result would be that simply by programmatically adding every build configuration to the settings file, the Slack plugin is automatically added to each of these configurations. Again, #32 is a much better solution, but this suggestion feels like significantly less work and would be a quick win.

alexkvak commented 2 years ago

Thanks for the report. Yes, your problem is known and I'll try to implement #32 to make this workaround easier to do.