turbot / pipe-fittings

Shared components for use across pipe projects.
https://github.com/turbot
GNU Affero General Public License v3.0
12 stars 4 forks source link

Using `documentation` with `file()` in pipeline or trigger results in decode error #77

Closed cbruno10 closed 10 months ago

cbruno10 commented 10 months ago

For a given pipeline:

cbruno@M1P reallyfreegeoip % cat pipelines/get_ip_geolocation.fp
pipeline "get_ip_geolocation" {
  title       = "Get IP Geolocation"
  description = "Get geolocation data for an IPv4 or IPv6 address."
  documentation = file("./pipelines/docs/get_ip_geolocation.md")

  param "ip_address" {
    type        = string
    description = "The IPv4 or IPv6 address."
  }

  param "format" {
    type        = string
    optional    = true
    default     = "json"
    description = "The format of the output. Accepted values are json, csv and xml. Defaults to json."
  }

  step "http" "get_ip_geolocation" {
    method = "get"
    url    = "https://reallyfreegeoip.org/${param.format}/${param.ip_address}"
  }

  output "geolocation" {
    description = "IP geolocation details."
    value       = step.http.get_ip_geolocation.response_body
  }
}

That points to an MD file:

cbruno@M1P reallyfreegeoip % cat pipelines/docs/get_ip_geolocation.md
## Get IP Geolocation

Get geolocation data for an IPv4 or IPv6 address.

### Notes

An IP address must be passed to the pipeline.

I get an error when trying to run Flowpipe:

cbruno@M1P reallyfreegeoip % fp pipeline list
Error: Failed to decode mod:
Unable to parse documentation attribute
(/Users/cbruno/flowpipe/reallyfreegeoip/pipelines/get_ip_geolocation.fp:5,3-42)
vhadianto commented 10 months ago

Fixed in commit: 3ac6c19e79911ac0d80df2ec129d8fdd811a7223