Agent state variables are not provided to Bamboo's WebhookTransport context when sending a Notification

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 10.2.1
    • Affects Version/s: 10.2.0, 9.2.21, 9.6.9
    • Component/s: Agents, Notifications
    • None
    • 1
    • Severity 3 - Minor

      Problem

      Agent variables are not available when using a Webhook template in Bamboo to send Notifications about Agent changed state (Agent online/Agent offline).

      Environment

      • Bamboo Data Center
      • Webhook templates
      • Notifications (agent related)

      Steps to Reproduce

      1. Create a new Webhook template, call it "AgentStateWebhook"
      2. Add a payload such as:
        The variables below are hypothetical as they don't exist, but were inspired by the FTL code that sends email notifications
        {
          "agent.id": "${bamboo.agent.id}",
          "agent.name": "${bamboo.agent.name}",
          "agent.state": "${bamboo.agent.state}"
        }
        
      3. Add a System Notification for type "Agent online/offline" and select the Webhooks as the Recipient type. Choose the Webhook name "AgentStateWebhook"
      4. Stop/Start an Agent

      Expected Results

      • As Webhooks are available as a Recipient to Agent change state events, Bamboo should provide and parse the Agent-related variables and send the Webhook

      Actual Results

      • Bamboo fails with:
        2025-01-16 13:22:49,219 DEBUG [ActiveMQ Session Task-2] [NotificationDispatcherImpl] Preparing to dispatch notification for event: Agent online notification.
        2025-01-16 13:22:49,219 DEBUG [ActiveMQ Session Task-2] [NotificationDispatcherImpl] Adding recipient '21da010c-d2f9-4e7f-a7dc-5371442e7bd0|https://externalUrl.com/agentstate' to notification transports.
        2025-01-16 13:22:49,219 DEBUG [ActiveMQ Session Task-2] [NotificationDispatcherImpl] Sending notification transport type 'WebhookTransport'  for notification  event 'Agent online notification'.
        2025-01-16 13:22:49,220 DEBUG [18-NotificationDispatcher-:pool-19-thread-8] [WebhookTransport] [Webhook id=50987009, name= AgentStateWebhook] Context not accessible. Using global variables for the substitution, eventClass : class com.atlassian.bamboo.event.agent.AgentRegisteredEvent
        2025-01-16 13:22:49,222 ERROR [18-NotificationDispatcher-:pool-19-thread-8] [WebhookTransport] [Webhook id=50987009, name= AgentStateWebhook, uuid=15e8f22b-fd6e-4c49-a3e6-eeee245d3acb] Variable not found: agent.id
        com.atlassian.bamboo.notification.transports.webhook.VariableNotFoundException: Variable not found agent
        	at com.atlassian.bamboo.notification.transports.webhook.VariableSubstitutorDecorator.substituteString(VariableSubstitutorDecorator.java:23) ~[atlassian-bamboo-core-10.2.1-SNAPSHOT.jar:?]
        	at com.atlassian.bamboo.notification.transports.webhook.WebhookTransport.sendNotification(WebhookTransport.java:92) ~[atlassian-bamboo-core-10.2.1-SNAPSHOT.jar:?]
        	at com.atlassian.bamboo.notification.NotificationDispatcherImpl.lambda$dispatchNotifications$0(NotificationDispatcherImpl.java:72) ~[atlassian-bamboo-core-10.2.1-SNAPSHOT.jar:?]
        

      Workaround

      • In Bamboo, instead of using a Webhook recipient in the Notification rule, use an alternative Recipient type based on email

      Notes

            Assignee:
            Eduardo Alvarenga (Inactive)
            Reporter:
            Eduardo Alvarenga (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: