Skip to content

Commit

Permalink
feat(vdp): expose run-on-event endpoints (#221)
Browse files Browse the repository at this point in the history
Because

- We are introducing the functionality for a pipeline to be run on
events.

This commit

- Exposes run-on-event endpoints.
  • Loading branch information
donch1989 authored Jul 29, 2024
1 parent 48ba2f5 commit 55d8cab
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
16 changes: 16 additions & 0 deletions config/settings-env/endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,22 @@
"input_query_strings": []
}
],
"webhook":[
{
"endpoint": "/v1beta/namespaces/{namespace_id}/pipelines/{pipeline_id}/events",
"url_pattern": "/v1beta/namespaces/{namespace_id}/pipelines/{pipeline_id}/events",
"method": "POST",
"timeout": "600s",
"input_query_strings": ["event", "code"]
},
{
"endpoint": "/v1beta/namespaces/{namespace_id}/pipelines/{pipeline_id}/releases/{release_id}/events",
"url_pattern": "/v1beta/namespaces/{namespace_id}/pipelines/{pipeline_id}/releases/{release_id}/events",
"method": "POST",
"timeout": "600s",
"input_query_strings": ["event", "code"]
}
],
"grpc_auth": [
{
"endpoint": "/vdp.pipeline.v1beta.PipelinePublicService/CheckName",
Expand Down
3 changes: 3 additions & 0 deletions config/share/settings-env/input_headers.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"Instill-Share-Code",
"Instill-Use-SSE"
],
"webhook": [
"*"
],
"no_auth": [
"Content-Type",
"Content-Length",
Expand Down
38 changes: 38 additions & 0 deletions config/share/templates/pipeline.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,44 @@
}
{{- end}}
,
{{- range $idx, $endpoint := $endpoints.webhook }}
{{- if $idx -}},{{ end }}
{
"endpoint": "{{ .endpoint }}",
"method": "{{ .method }}",
{{- if len .input_query_strings -}}
"input_query_strings":
[
{{- range $qidx, $qstring := .input_query_strings }}
{{- if $qidx -}},{{ end }}
"{{ $qstring }}"
{{- end}}
],
{{- end}}
"timeout": "{{ .timeout }}",
"output_encoding": "no-op",
"input_headers": {{ marshal $input_headers.webhook }},
"backend": [
{
"url_pattern": "{{ .url_pattern }}",
"host": {{ marshal $host }},
"sd": "static",
"method": "{{ .method }}",
"disable_host_sanitize": false,
"extra_config": {
"github.com/devopsfaith/krakend-martian": {
"header.Modifier": {
"scope": ["response"],
"name": "Backend",
"value": "pipeline"
}
}
}
}
]
}
{{- end }}
,
{{- range $idx, $endpoint := $endpoints.grpc_auth }}
{{- if $idx -}},{{ end }}
{
Expand Down

0 comments on commit 55d8cab

Please sign in to comment.