Skip to content

Unable to use config value to set smtp_port in email action configuration #542

@thpiron

Description

@thpiron

Describe the bug
When using the email builtin plugin (https://github.com/ovh/utask/blob/master/pkg/plugins/builtin/email/README.md), setting the port from a template evaluated value ( "{{ .config.smtp.port }}" for example) generate a validation error.

To Reproduce
Steps to reproduce the behavior:
Creating a template with an email action, using the example values from the documentation page.

action:
  type: email
  configuration:
    # optional, string, leave empty for no auth
    smtp_username: {{.config.smtp.username}}
    # optional, string, leave empty for no auth
    smtp_password: {{.config.smtp.password}}
    # mandatory, string as uint
    smtp_port: {{.config.smtp.port}}
    # mandatory, string
    smtp_hostname: {{.config.smtp.hostname}}
    # optional, string as boolean
    smtp_skip_tls_verify: "true"
    # mandatory, string
    from_address: foo@example.org
    # optional, string
    from_name: uTask bot
    # mandatory, string collection
    to: [bar@example.org, hey@example.org]
    # mandatory, string
    subject: Hello from µTask
    # mandatory, string
    body: |
      I love baguette

error: Invalid task template: Invalid step sendEmail: Invalid executor action: can't parse smtp_port field \"{{ .config.smtp.port }}\": strconv.ParseUint: parsing \"{{ .config.smtp.port }}\": invalid syntax

Expected behavior
Starts without errors, and validate smtp port using the evaluated value in template.

utask version impacted by the bug
v1.32.0

Context which you are currently running utask
docker

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions