Skip to content

Commit a3eb533

Browse files
Added Support for FME (#157)
* added support for FME Module * don't allow unauth requests * prettified, linted, and removed out of date comments * updated flag url to reflect environment * made circular progress display more often * Added FetchApiRef in FME-Plugins hooks * Added FetchApiRef in FME-Plugins hooks * Added FetchApiRef in FME-Plugins hooks --------- Co-authored-by: nisarg-a19 <107825904+nisarg-a19@users.noreply.github.com>
1 parent aebdc66 commit a3eb533

File tree

30 files changed

+35671
-4
lines changed

30 files changed

+35671
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Check out the plugin specific installation instructions.
2222
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------ | -------------------------------------------------------- |
2323
| [<img align="center" src="./docs/assets/CI%20logo.png" alt="Harness CI logo" width="20" /> CI](https://harness.io/products/continuous-integration) and [<img align="center" src="./docs/assets/CD%20logo.png" alt="Harness CD logo" width="20" /> CD](https://harness.io/products/continuous-delivery) | View builds and pipeline executions for your services. | 📘 [Installation instructions](./plugins/harness-ci-cd/) |
2424
| [<img align="center" src="./docs/assets/Feature%20Flags%20logo.png" alt="Feature flags logo" width="20" /> Feature Flags](https://harness.io/products/feature-flags) | View list of Feature Flags | 📘 [Installation instructions](./plugins/harness-feature-flags/) |
25+
[<img align="center" src="./docs/assets/fmelogo.png" alt="FME logo" width="20" /> FME Feature Flags](https://www.harness.io/products/feature-management-experimentation) | View list of FME Feature Flags | 📘 [Installation instructions](./plugins/harness-fme-feature-flags/) |
2526
[<img align="center" src="./docs/assets/Chaos%20logo.png" alt="Chaos engineering logo" width="20" /> Chaos Engineering](https://harness.io/products/chaos-engineering) | View list of Chaos Experiments | 📘 [Installation instructions](./plugins/harness-chaos/) |
2627
[<img align="center" src="./docs/assets/SRM%20logo.png" alt="SRM logo" width="20" /> Service Reliability Management](https://www.harness.io/products/service-reliability-management) | Tracks the defined SLOs and Error Budgets | 📘 [Installation instructions](./plugins/harness-srm/) |
2728
[<img align="center" src="./docs/assets/iac-logo.png" alt="IACM logo" width="20" /> Infrastructure as Code Management](https://www.harness.io/products/infrastructure-as-code-management) | Overview of all the resources provisioned | 📘 [Installation instructions](./plugins/harness-iacm/) |

app-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ proxy:
6262
target: 'https://stress.harness.io/'
6363
headers:
6464
'x-api-key': ${HARNESS_STRESS_API_KEY}
65+
'/harnessfme':
66+
target: 'https://api.split.io/'
67+
headers:
68+
'Authorization': 'Bearer ${FME_API_KEY}'
6569

6670
# Reference documentation http://backstage.io/docs/features/techdocs/configuration
6771
# Note: After experimenting with basic setup, use CI/CD to generate docs

docs/assets/fmelogo.png

15.3 KB
Loading

examples/entities.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ spec:
1111
apiVersion: backstage.io/v1alpha1
1212
kind: Component
1313
metadata:
14-
name: example-website
14+
name: example-service
15+
annotations:
16+
# mandatory annotation
17+
# harness.io/project-url: https://app.harness.io/ng/account/HARNESS_ACCOUNT_ID/module/orgs/HARNESS_ORG_ID/projects/HARNESS_PROJECT_NAME/feature-flags
18+
# harnessfme/projectId: FME_PROJECT_ID
19+
# harnessfme/accountId: FME_ACCOUNT_ID
20+
1521
spec:
16-
type: website
22+
type: service
1723
lifecycle: experimental
1824
owner: guests
1925
system: examples

examples/template/content/package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"@harnessio/backstage-plugin-harness-chaos": "^0.2.0",
4646
"@harnessio/backstage-plugin-harness-iacm": "0.3.0",
4747
"@harnessio/backstage-plugin-harness-ccm": "^0.1.0",
48+
"@harnessio/backstage-plugin-fme-feature-flags": "^0.1.0",
4849
"@material-ui/core": "^4.12.2",
4950
"@material-ui/icons": "^4.9.1",
5051
"history": "^5.0.0",

packages/app/src/components/catalog/EntityPage.tsx

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ import {
6767
EntityHarnessFeatureFlagContent,
6868
} from '@harnessio/backstage-plugin-feature-flags';
6969

70+
import {
71+
isHarnessFMEFeatureFlagAvailable,
72+
EntityHarnessFMEFeatureFlagContent,
73+
} from '@harnessio/backstage-plugin-fme-feature-flags';
74+
7075
import {
7176
EntityHarnessSrmContent,
7277
isHarnessSRMAvailable,
@@ -151,6 +156,32 @@ const featureFlagList = (
151156
</EntitySwitch.Case>
152157
</EntitySwitch>
153158
);
159+
160+
const FMEList = (
161+
<EntitySwitch>
162+
<EntitySwitch.Case if={isHarnessFMEFeatureFlagAvailable}>
163+
<EntityHarnessFMEFeatureFlagContent />
164+
</EntitySwitch.Case>
165+
166+
<EntitySwitch.Case>
167+
<EmptyState
168+
title="No FME Feature Flags available for this entity"
169+
missing="info"
170+
description="You need to add an annotation to your component for harnessfme/accountId and harnessfme/projectId if you want to enable FME Feature Flags for it. You can read more about annotations in Backstage by clicking the button below."
171+
action={
172+
<Button
173+
variant="contained"
174+
color="primary"
175+
href="https://backstage.io/docs/features/software-catalog/well-known-annotations"
176+
>
177+
Read more
178+
</Button>
179+
}
180+
/>
181+
</EntitySwitch.Case>
182+
</EntitySwitch>
183+
);
184+
154185
const entityWarningContent = (
155186
<>
156187
<EntitySwitch>
@@ -311,6 +342,10 @@ const serviceEntityPage = (
311342
{featureFlagList}
312343
</EntityLayout.Route>
313344

345+
<EntityLayout.Route path="/fme-feature-flag" title="FME Feature Flags">
346+
{FMEList}
347+
</EntityLayout.Route>
348+
314349
<EntityLayout.Route path="/api" title="API">
315350
<Grid container spacing={3} alignItems="stretch">
316351
<Grid item md={6}>
@@ -352,8 +387,8 @@ const websiteEntityPage = (
352387
<EntityHarnessFeatureFlagContent />
353388
</EntityLayout.Route>
354389

355-
<EntityLayout.Route path="/feature-flag" title="Feature Flags">
356-
{featureFlagList}
390+
<EntityLayout.Route path="/fme-feature-flag" title="FME Feature Flags">
391+
{FMEList}
357392
</EntityLayout.Route>
358393

359394
<EntityLayout.Route path="/chaos" title="Chaos Engineering">
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Harness Feature Flags Plugin
2+
3+
Website: [https://harness.io/](https://harness.io/)
4+
5+
Welcome to the Harness FME Feature Flags plugin for Backstage!
6+
7+
## Screenshots
8+
9+
<img src="./src/assets/FeatureList.png" />
10+
11+
## Setup steps
12+
13+
1. Open terminal and navigate to the _root of your Backstage app_. Then run
14+
15+
```
16+
yarn add --cwd packages/app @harnessio/backstage-plugin-fme-feature-flags
17+
18+
yarn install
19+
```
20+
21+
If you are looking to get started with Backstage, check out [backstage.io/docs](https://backstage.io/docs/getting-started/).
22+
23+
For testing purposes, you can also clone this repository to try out the plugin. It contains an example Backstage app setup which is pre-installed with Harness plugins. However, you must create a new Backstage app if you are looking to get started with Backstage.
24+
25+
2. Configure proxy for harness in your `app-config.yaml` under the `proxy` config. Add your Harness FME Admin API Key for `Authorization: Bearer`. See the [Harness FME docs](https://help.split.io/hc/en-us/articles/360019916211-API-keys) for generating an API Key.
26+
27+
```yaml
28+
# In app-config.yaml
29+
30+
proxy:
31+
# ... existing proxy settings
32+
'/harnessfme':
33+
target: 'https://api.split.io/'
34+
headers:
35+
'Authorization': 'Bearer <API KEY>'
36+
# ...
37+
```
38+
39+
Notes:
40+
41+
- Plugin uses token configured here to make Harness FME API calls. Make sure this token has the necessary permissions
42+
43+
44+
3. Inside your Backstage's `EntityPage.tsx`, add the new `FMEfeatureFlagList` component to render `<EntityHarnessFMEFeatureFlagContent />` whenever the service is using Harness Feature Flags. Something like this -
45+
46+
```tsx
47+
// In packages/app/src/components/catalog/EntityPage.tsx
48+
49+
import {
50+
isHarnessFMEFeatureFlagAvailable,
51+
EntityHarnessFMEFeatureFlagContent,
52+
} from '@harnessio/backstage-plugin-fme-feature-flags';
53+
54+
...
55+
56+
const featureFlagList = (
57+
<EntitySwitch>
58+
<EntitySwitch.Case if={isHarnessFMEFeatureFlagAvailable}>
59+
<EntityHarnessFMEFeatureFlagContent />
60+
</EntitySwitch.Case>
61+
62+
<EntitySwitch.Case>
63+
<EmptyState
64+
title="No FME Feature Flags available for this entity"
65+
missing="info"
66+
description="You need to add an annotation to your component if you want to enable Feature Flags for it. You can read more about annotations in Backstage by clicking the button below."
67+
action={
68+
<Button
69+
variant="contained"
70+
color="primary"
71+
href="https://backstage.io/docs/features/software-catalog/well-known-annotations"
72+
>
73+
Read more
74+
</Button>
75+
}
76+
/>
77+
</EntitySwitch.Case>
78+
</EntitySwitch>
79+
);
80+
81+
...
82+
83+
const serviceEntityPage = (
84+
<EntityLayout>
85+
<EntityLayout.Route path="/fme-feature-flag" title="FME Feature Flags">
86+
{FMEList}
87+
</EntityLayout.Route>
88+
</EntityLayout>
89+
);
90+
91+
...
92+
93+
```
94+
95+
4. Add required Harness FME specific annotations to your software component's respective `catalog-info.yaml` file.
96+
You will need your accountId (formerly Org ID) and projectId (formerly Workspace ID)
97+
98+
You can get these from the URL when you are logged in to the FME console.
99+
100+
https://app.split.io/org/<ACCOUNT ID>/ws/<PROJECT ID>>/mywork
101+
102+
103+
104+
```yaml
105+
apiVersion: backstage.io/v1alpha1
106+
kind: Component
107+
metadata:
108+
# ...
109+
annotations:
110+
# mandatory annotation
111+
harnessfme/projectId: <project id>
112+
harnessfme/accountId: <account id>
113+
114+
type: service
115+
# ...
116+
```
117+
118+
119+
120+
## Features
121+
122+
- Connect a Backstage service with a Harness project and view the list of all Feature Flags.
123+
- See details about a Feature Flags - state(killed/live), trafficType, last modified and created.
124+
- Filter the Feature Flags and their corresponding information according to the Environments.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export interface Config {
2+
/** Configurations for the Harness plugin */
3+
harnessfme?: {
4+
/**
5+
* The base url of the Harness installation. Defaults to `https://app.split.io/`.
6+
* @visibility frontend
7+
*/
8+
baseUrl?: string;
9+
};
10+
}

0 commit comments

Comments
 (0)