Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.started is not compatible with template datetime #47

Open
puzzloholic opened this issue Aug 20, 2019 · 1 comment
Open

build.started is not compatible with template datetime #47

puzzloholic opened this issue Aug 20, 2019 · 1 comment

Comments

@puzzloholic
Copy link

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}


@Ansen
Copy link

Ansen commented Dec 3, 2021

same problem

template:

{{datetime build.started "2006-01-02 15:04:05" "Asia/Shanghai"}}

error:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants