Coder Social home page Coder Social logo

Comments (16)

netwolfuk avatar netwolfuk commented on June 11, 2024 1

Hmm. ~~Looking at the code in that file on line 121, I don't think it ever worked for muted.

It checks for a non-empty list of tests before executing the webhook. School boy error. 🫣~~

Ignore. It's too late. I'm not being sense.

from tcwebhooks.

matt-richardson avatar matt-richardson commented on June 11, 2024 1

Another question with this... What is the 13= and 11= on these?

I'm using the legacy / deprecated name value pairs format to get these, so it may just be a side affect of that, but not entirely sure how they'll format in json?

Nevermind: figured it out... It's the default .toString() implementation of MuteInfo - it just renders the id.

from tcwebhooks.

matt-richardson avatar matt-richardson commented on June 11, 2024 1

I am looking at exactly that file right now :)

from tcwebhooks.

netwolfuk avatar netwolfuk commented on June 11, 2024 1

I've updated the instructions at https://github.com/tcplugins/tcWebHooksTemplates

from tcwebhooks.

netwolfuk avatar netwolfuk commented on June 11, 2024

Hi @matt-richardson. Thanks for your detailed report (as per usual).

If I remember correctly, the list of tests was not available for muted.

I'll have a look at your suggestion just in case I missed something obvious.

from tcwebhooks.

netwolfuk avatar netwolfuk commented on June 11, 2024

Thanks @matt-richardson. It looks like your suggestion works.

I've pushed to a branch here: https://teamcity.jetbrains.com/buildConfiguration/WebHooksAndOtherPlugins_TcWebHooks?branch=issue_219-muted-tests&buildTypeTab=overview&mode=builds

Can you give that a try and I'll look to do so a release later this week if it all goes well.

from tcwebhooks.

matt-richardson avatar matt-richardson commented on June 11, 2024

Happy to report that it works successfully for both muted and unmuted now :success:.

derivedBuildEventType | TESTS_MUTED
mutedOrUnmutedTests | {13=[suiteName: nestedSuiteName: package_or_namespace.ClassName.TestName]}
derivedBuildEventType | TESTS_UNMUTED
mutedOrUnmutedTests | {11=[suiteName: nestedSuiteName: package_or_namespace.ClassName.TestName]}

from tcwebhooks.

netwolfuk avatar netwolfuk commented on June 11, 2024

I imagine it the result of calling toString on that value.

This is what I get.

I am doing the following in velocity

## Define macro called "showTests"
#macro( showTests $myTests)
#if ( $myTests.size() > 0 ) 
#foreach( $tests in $myTests.keySet() )##
#foreach( $test in $tests.getTests() )###escapejson($test.name)
#end
#end
#else No Changes found #end
#end

It prints the bulleted list in the following screenshot when posted to Slack.

image

from tcwebhooks.

matt-richardson avatar matt-richardson commented on June 11, 2024

I've successfully got this all working to my needs - I'm now able to get hooks with:

{
  "event": "TESTS_UNMUTED",
  "tests": [
    {
      "name": "suiteName: nestedSuiteName: package_or_namespace.ClassName.TestName",
      "id": "-8186798926076262107",
      "user": "[email protected]"
    }
  ]
}

and

{
  "event": "TESTS_MUTED",
  "tests": [
    {
      "name": "suiteName: nestedSuiteName: package_or_namespace.ClassName.TestName",
      "id": "-8186798926076262107",
      "user": "[email protected]"
    }
  ]
}

For posterity, this is based on the following template:

{
    "event": "$buildEventType",
    "tests": [
#foreach( $entry in $mutedOrUnmutedTests.entrySet() )##
#foreach( $test in $entry.value )##
      {
        "name": "#escapejson($test.name)",
        "id": "$test.testNameId",
        "user": "$entry.key.mutingUser.username"
      }#if( $foreach.hasNext ),#end
#end
#end
    ]
}

from tcwebhooks.

netwolfuk avatar netwolfuk commented on June 11, 2024

Nice work. Thanks for the update. I'll get a new release out over the weekend. Thanks for your help on this.

from tcwebhooks.

netwolfuk avatar netwolfuk commented on June 11, 2024

@matt-richardson If you get a chance, you could pop those into https://github.com/tcplugins/tcWebHooks/wiki/WebHook-Templates-%3A-The-Velocity-Templating-Engine

from tcwebhooks.

matt-richardson avatar matt-richardson commented on June 11, 2024

Good call - I've updated the wiki 👍

Looks like 1.2.3 is out - I'll give that a go.

from tcwebhooks.

netwolfuk avatar netwolfuk commented on June 11, 2024

Very nice. I like the foreach.hasNext to conditionally add the closing comma.

Thanks again. I think we can close this ticket.

from tcwebhooks.

netwolfuk avatar netwolfuk commented on June 11, 2024

FYI. If you're interested in sharing a working template set, there is a project here: https://github.com/tcplugins/tcWebHooksTemplates

I really really need to update the instructions on that repo for exporting and importing templates, as it's all possible via the GUI now. No more curl and crazy REST malarky.

from tcwebhooks.

matt-richardson avatar matt-richardson commented on June 11, 2024

I know I shouldn't add onto a closed issue, but.... i'm going to anyway 😂

Im seeing a bunch of errors:

[2023-07-18 02:16:17,787] ERROR [@7438424f'; Normal executor 28] - jetbrains.buildServer.SERVER - AbstractWebHookExecutor :: trackingId: dadfab32-86b1-4bab-8c1a-afd38e6870e4 :: projectId: OctopusDeploy_OctopusServer_CorePlatform :: webhookId: id_905369674 :: templateId: buildmonitormutes, errorCode: 902, errorMessage: Template 'buildmonitormutes' does not support build state 'beforeBuildFinish'

The template is configured like this:
image

But the webhook is showing all the boxes as ticked, but disabled:
image

Am I holding it wrong?

from tcwebhooks.

netwolfuk avatar netwolfuk commented on June 11, 2024

Looks like a UI issue. Can you please raise as a new ticket?
I think it's because the template was re-selected in the UI from one that did support all event types, hence are selected but disabled.

You might be able to work around by opening and saving and opening the webhook again.

from tcwebhooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.