Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-21490

Bamboo variables are not consistently accessible across all notification types (Webhooks)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 8.0.4
    • Notifications
    • None

    Description

      Problem

      According to the Using webhooks page Webhook templates can be customized to use variables listed inside the Bamboo variables page.

      I'll use one variable that is not working properly as an example but the problem is not restricted to this single variable: buildNumber. It may be affecting other variables. Here's a table demonstrating where this variable works and where it errors out with "Variable not found":

      Plans

      Event Does it work?
      All Builds Completed
      Change of Build Status
      Failed Builds And First Successful
      After X Build Failures
      Comment Added
      Change of Responsibilities

      Jobs

      Event Does it work?
      All Jobs Completed
      Change of Job Status
      Failed Jobs And First Successful
      First Failed Job For Plan
      Job Error
      Job Hung
      Job Queue Timeout
      Job Queued Without Capable Agents

      Environment

      • Bamboo 8.0.4

      Steps to Reproduce

      1. Add the buildNumber variable to the existing (default) Build webhook template:
        {
          "uuid": "${bamboo.webhook.uuid}",
          "timestamp": "${bamboo.webhook.timestamp}",
          "notification": "${bamboo.webhook.notification.description}",
          "webhook": {
            "webhookTemplatedId": "${bamboo.webhook.template.id}",
            "webhookTemplatedName": "${bamboo.webhook.template.name}"
          },
          "build": {
            "buildResultKey": "${bamboo.buildResultKey}",
            "status": "${bamboo.buildState}",
            "buildPlanName": "${bamboo.buildPlanName}",
            "buildNumber": "${bamboo.buildNumber}",
            "startedAt": "${bamboo.date.started}",
            "finishedAt": "${bamboo.date.finished}",
            "triggerReason": "${bamboo.trigger.reason}",
            "triggerSentence": "${bamboo.trigger.name.for.sentence}"
          }
        }
        
      2. Go to your plan and set up a Webhook notification for one of the events listed above that are not working:
      3. Reproduce the action described in the event.

      Expected Results

      Notification are sent.

      Actual Results

      Notification fails with the following error message inside the <bamboo-home>/logs/atlassian-bamboo.log file:

      atlassian-bamboo.log
      2021-11-12 11:10:29,689 ERROR [12-NotificationDispatcher-:pool-19-thread-16] [WebhookTransport] [Webhook id=458753, name=Build webhook, uuid=88607363-4c08-4059-ade9-5c3925daa967] Variable not found: buildNumber
      com.atlassian.bamboo.notification.transports.webhook.VariableNotFoundException: Variable not found buildNumber
      	at com.atlassian.bamboo.notification.transports.webhook.VariableSubstitutorDecorator.substituteString(VariableSubstitutorDecorator.java:24)
      	at com.atlassian.bamboo.notification.transports.webhook.WebhookTransport.sendNotification(WebhookTransport.java:68)
      	at com.atlassian.bamboo.notification.NotificationDispatcherImpl.lambda$null$0(NotificationDispatcherImpl.java:70)
      	at org.hibernate.jdbc.WorkExecutor.executeWork(WorkExecutor.java:37)
      	at org.hibernate.internal.AbstractSharedSessionContract.lambda$doWork$1(AbstractSharedSessionContract.java:1074)
      	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.coordinateWork(JdbcCoordinatorImpl.java:307)
      	at org.hibernate.internal.AbstractSharedSessionContract.doWork(AbstractSharedSessionContract.java:1090)
      	at org.hibernate.internal.AbstractSharedSessionContract.doWork(AbstractSharedSessionContract.java:1077)
      	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$2.doInHibernate(BambooTransactionHibernateTemplate.java:47)
      	at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:367)
      	at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:334)
      	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:36)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
      	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28)
      	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:33)
      	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.doWork(BambooTransactionHibernateTemplate.java:43)
      	at com.atlassian.bamboo.notification.NotificationDispatcherImpl.lambda$dispatchNotifications$1(NotificationDispatcherImpl.java:70)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
      	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
      	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
      	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      

      Workaround

      N/A

      Notes

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              brosa Bruno Rosa
              Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: