-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeature-flag-workflow.yaml
More file actions
108 lines (92 loc) · 2.32 KB
/
feature-flag-workflow.yaml
File metadata and controls
108 lines (92 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Feature Flag Workflow Example
# Demonstrates feature flag evaluation and gating in pipelines.
# Uses the featureflag.service module with the built-in generic provider.
requires:
plugins:
- name: feature-flags
- name: pipeline-steps
- name: workflow-plugin-http
modules:
- name: http-server
type: http.server
config:
address: ":8080"
- name: router
type: http.router
config: {}
- name: feature-flags
type: featureflag.service
config:
provider: generic
cache_ttl: "30s"
sse_enabled: true
db_path: "data/featureflags.db"
workflows:
http:
server: http-server
router: router
routes: []
pipelines:
# Pipeline that evaluates a feature flag and routes based on result
feature-gated-api:
trigger:
type: http
config:
method: POST
path: /api/process
router: router
steps:
- name: parse-request
type: step.request_parse
config: {}
- name: check-new-algorithm
type: step.feature_flag
config:
flag: new-algorithm
user_from: "{{.body.user_id}}"
output_key: algorithm_flag
- name: route-by-flag
type: step.ff_gate
config:
flag: premium-features
user_from: "{{.body.user_id}}"
on_enabled: premium-response
on_disabled: standard-response
- name: premium-response
type: step.set
config:
values:
tier: premium
message: "You have access to premium features"
- name: standard-response
type: step.set
config:
values:
tier: standard
message: "Standard features enabled"
- name: respond
type: step.json_response
config:
status: 200
# Simple flag check endpoint
feature-flag-check:
trigger:
type: http
config:
method: GET
path: /api/flags/check
router: router
steps:
- name: parse-params
type: step.request_parse
config: {}
- name: evaluate-flag
type: step.feature_flag
config:
flag: "{{.query.flag}}"
user_from: "{{.query.user}}"
output_key: flag_result
- name: respond
type: step.json_response
config:
status: 200