Skip to content

build.started is not compatible with template datetimeΒ #47

@puzzloholic

Description

@puzzloholic

Variable build.started is int64. It is incompatible with template datetime, which receive float64 and exactly 3 parameters

I try to do this

  - name: notification
    image: plugins/webhook
    settings:
      urls: https://chat.googleapis.com/v1/...
      content_type: application/json
      template: |
        {
          "text" : "Test Webhook\n```\nRepository Name: {{ repo.name }}\nBuild Number: {{ build.number }}\nBuild Status: {{ uppercase build.status }}\nBuild Author: {{ lowercase build.author }}\nBuild Author: {{ build.author }}\nBuild Event: {{ build.event }}\nBuild Commit: {{ truncate build.commit 8 }}\nBuild Branch: {{ build.branch }}\nBuild Link: {{ build.link }}\nBuild Started: {{ datetime build.started "3:04PM" "UTC+7" }}\nBuild Started: {{ datetime build.started }}\nDuration: {{ since build.started }}\n```"
        }
    when:
      status: [ success, failure ]

and receive error


2019/08/20 14:34:09 Evaluation error: Helper datetime called with argument 0 with type int64 but it should be float64
--
2 | Current node:
3 | String{Value:'UTC+7', Pos:415}

The param is not even optional, I cannot just put {{datetime build.started}}. It will output error like this


2019/08/20 14:41:27 Evaluation error: Helper 'datetime' called with wrong number of arguments, needed 3 but got 1
--
2 | Current node:
3 | Path{Original:'build.started', Pos:391}


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions