Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: redhat-developer/rhdh
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a918ab2a88c771ba85e018fda25fbab640111dff
Choose a base ref
..
head repository: redhat-developer/rhdh
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e63f88a9566831c6945373b0766f2908dbd4082d
Choose a head ref
1 change: 1 addition & 0 deletions .ibm/pipelines/auth/secrets-rhdh-secrets.yaml
Original file line number Diff line number Diff line change
@@ -38,4 +38,5 @@ data:
KEYCLOAK_AUTH_CLIENT_SECRET: dGVtcA==
KEYCLOAK_AUTH_LOGIN_REALM: dGVtcA==
KEYCLOAK_AUTH_REALM: dGVtcA==
RHDH_BASE_URL_HTTP: dGVtcA==
type: Opaque
5 changes: 5 additions & 0 deletions .ibm/pipelines/resources/config_map/app-config-rhdh.yaml
Original file line number Diff line number Diff line change
@@ -106,6 +106,11 @@ proxy:
X-Requested-With: 'XMLHttpRequest'
changeOrigin: true
secure: true
'/add-test-header':
target: ${RHDH_BASE_URL_HTTP}/api/simple-chat
credentials: forward
headers:
'x-proxy-test-header': 'hello!'
catalog:
import:
entityFilename: catalog-info.yaml
203 changes: 203 additions & 0 deletions .ibm/pipelines/resources/config_map/dynamic-plugins-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
dynamicPlugins:
rootDirectory: dynamic-plugins-root
frontend:
red-hat-developer-hub.backstage-plugin-dynamic-home-page:
mountPoints:
- mountPoint: application/listener
importName: VisitListener
- mountPoint: home.page/cards
importName: SearchBar
config:
layouts:
xl: { w: 10, h: 1, x: 1 }
lg: { w: 10, h: 1, x: 1 }
md: { w: 10, h: 1, x: 1 }
sm: { w: 10, h: 1, x: 1 }
xs: { w: 12, h: 1 }
xxs: { w: 12, h: 1 }
- mountPoint: home.page/cards
importName: QuickAccessCard
config:
layouts:
xl: { w: 7, h: 8 }
lg: { w: 7, h: 8 }
md: { w: 7, h: 8 }
sm: { w: 12, h: 8 }
xs: { w: 12, h: 8 }
xxs: { w: 12, h: 8 }
- mountPoint: home.page/cards
importName: CatalogStarredEntitiesCard
config:
layouts:
xl: { w: 5, h: 4, x: 7 }
lg: { w: 5, h: 4, x: 7 }
md: { w: 5, h: 4, x: 7 }
sm: { w: 12, h: 4 }
xs: { w: 12, h: 4 }
xxs: { w: 12, h: 4 }

- mountPoint: home.page/cards
importName: Headline
config:
layouts:
xl: { w: 12, h: 1 }
lg: { w: 12, h: 1 }
md: { w: 12, h: 1 }
sm: { w: 12, h: 1 }
xs: { w: 12, h: 1 }
xxs: { w: 12, h: 1 }
props:
title: Placeholder tests
align: center

- mountPoint: home.page/cards
importName: Placeholder
config:
layouts:
xl: { x: 1, y: 0, w: 10, h: 1 }
lg: { x: 1, y: 0, w: 10, h: 1 }
md: { x: 1, y: 0, w: 10, h: 1 }
sm: { x: 0, y: 0, w: 12, h: 1 }
xs: { x: 0, y: 0, w: 12, h: 1 }
xxs: { x: 0, y: 0, w: 12, h: 1 }
props:
showBorder: true
debugContent: Home page customization test 1
- mountPoint: home.page/cards
importName: Placeholder
config:
layouts:
xl: { x: 0, y: 0, w: 7, h: 4 }
lg: { x: 0, y: 0, w: 7, h: 4 }
md: { x: 0, y: 0, w: 7, h: 4 }
sm: { x: 0, y: 0, w: 12, h: 4 }
xs: { x: 0, y: 0, w: 12, h: 4 }
xxs: { x: 0, y: 0, w: 12, h: 4 }
props:
showBorder: true
debugContent: Home page customization test 2
- mountPoint: home.page/cards
importName: Placeholder
config:
layouts:
xl: { x: 7, y: 0, w: 5, h: 4 }
lg: { x: 7, y: 0, w: 5, h: 4 }
md: { x: 7, y: 0, w: 5, h: 4 }
sm: { x: 0, y: 0, w: 12, h: 4 }
xs: { x: 0, y: 0, w: 12, h: 4 }
xxs: { x: 0, y: 0, w: 12, h: 4 }
props:
showBorder: true
debugContent: Home page customization test 3
- mountPoint: home.page/cards
importName: Headline
config:
layouts:
xl: { w: 12, h: 1 }
lg: { w: 12, h: 1 }
md: { w: 12, h: 1 }
sm: { w: 12, h: 1 }
xs: { w: 12, h: 1 }
xxs: { w: 12, h: 1 }
props:
title: Markdown tests
align: center

- mountPoint: home.page/cards
importName: MarkdownCard
config:
layouts:
xl: { w: 6, h: 4 }
lg: { w: 6, h: 4 }
md: { w: 6, h: 4 }
sm: { w: 6, h: 4 }
xs: { w: 6, h: 4 }
xxs: { w: 6, h: 4 }
props:
title: Company links
content: |
### RHDH
* [Website](https://developers.redhat.com/rhdh/overview)
* [Documentation](https://docs.redhat.com/en/documentation/red_hat_developer_hub/)
* [GitHub Showcase](https://github.com/redhat-developer/rhdh)
* [GitHub Plugins](https://github.com/janus-idp/backstage-plugins)
- mountPoint: home.page/cards
importName: Markdown
config:
layouts:
xl: { w: 6, h: 4, x: 6 }
lg: { w: 6, h: 4, x: 6 }
md: { w: 6, h: 4, x: 6 }
sm: { w: 6, h: 4, x: 6 }
xs: { w: 6, h: 4, x: 6 }
xxs: { w: 6, h: 4, x: 6 }
props:
title: Important company links
content: |
### RHDH
* [Website](https://developers.redhat.com/rhdh/overview)
* [Documentation](https://docs.redhat.com/en/documentation/red_hat_developer_hub/)
* [GitHub Showcase](https://github.com/redhat-developer/rhdh)
* [GitHub Plugins](https://github.com/janus-idp/backstage-plugins)
- mountPoint: home.page/cards
importName: FeaturedDocsCard
- mountPoint: home.page/cards
importName: JokeCard
- mountPoint: home.page/cards
importName: RecentlyVisitedCard
config:
layouts:
xl: { w: 6, h: 4, x: 6 }
lg: { w: 6, h: 4, x: 6 }
md: { w: 6, h: 4, x: 6 }
sm: { w: 6, h: 4, x: 6 }
xs: { w: 6, h: 4, x: 6 }
xxs: { w: 6, h: 4, x: 6 }
- mountPoint: home.page/cards
importName: TopVisitedCard
config:
layouts:
xl: { w: 6, h: 4 }
lg: { w: 6, h: 4 }
md: { w: 6, h: 4 }
sm: { w: 6, h: 4 }
xs: { w: 6, h: 4 }
xxs: { w: 6, h: 4 }

default.main-menu-items:
menuItems:
default.list:
title: References
icon: bookmarks
default.apis:
parent: default.list
default.learning-path:
parent: default.list
backstage.plugin-techdocs:
menuItems:
favorites:
title: Favorites
icon: star
priority: 10
docs:
parent: favorites
priority: 1
pataknight.backstage-plugin-rhdh-qe-theme:
appIcons:
- importName: LightIcon
name: lightIcon
- importName: DarkIcon
name: darkIcon
themes:
- icon: lightIcon
id: light-dynamic
importName: lightThemeProvider
title: Light Dynamic
variant: light
- icon: darkIcon
id: dark-dynamic
importName: darkThemeProvider
title: Dark Dynamic
variant: dark
2 changes: 1 addition & 1 deletion .ibm/pipelines/resources/rhdh-operator/rhdh-start.yaml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ spec:
appConfig:
configMaps:
- name: app-config-rhdh
- name: dynamic-homepage-and-sidebar-config
- name: dynamic-plugins-config
mountPath: /opt/app-root/src
dynamicPluginsConfigMapName: dynamic-plugins
extraEnvs:
15 changes: 11 additions & 4 deletions .ibm/pipelines/utils.sh
Original file line number Diff line number Diff line change
@@ -484,11 +484,18 @@ apply_yaml_files() {

DH_TARGET_URL=$(echo -n "test-backstage-customization-provider-${project}.${K8S_CLUSTER_ROUTER_BASE}" | base64 -w 0)
local RHDH_BASE_URL=$(echo -n "$rhdh_base_url" | base64 | tr -d '\n')

for key in GITHUB_APP_APP_ID GITHUB_APP_CLIENT_ID GITHUB_APP_PRIVATE_KEY GITHUB_APP_CLIENT_SECRET GITHUB_APP_JANUS_TEST_APP_ID GITHUB_APP_JANUS_TEST_CLIENT_ID GITHUB_APP_JANUS_TEST_CLIENT_SECRET GITHUB_APP_JANUS_TEST_PRIVATE_KEY GITHUB_APP_WEBHOOK_URL GITHUB_APP_WEBHOOK_SECRET KEYCLOAK_CLIENT_SECRET ACR_SECRET GOOGLE_CLIENT_ID GOOGLE_CLIENT_SECRET K8S_CLUSTER_TOKEN_ENCODED OCM_CLUSTER_URL GITLAB_TOKEN KEYCLOAK_AUTH_BASE_URL KEYCLOAK_AUTH_CLIENTID KEYCLOAK_AUTH_CLIENT_SECRET KEYCLOAK_AUTH_LOGIN_REALM KEYCLOAK_AUTH_REALM RHDH_BASE_URL DH_TARGET_URL; do
local RHDH_BASE_URL_HTTP=$(echo -n "${rhdh_base_url/https/http}" | base64 | tr -d '\n')

for key in GITHUB_APP_APP_ID GITHUB_APP_CLIENT_ID GITHUB_APP_PRIVATE_KEY GITHUB_APP_CLIENT_SECRET GITHUB_APP_JANUS_TEST_APP_ID GITHUB_APP_JANUS_TEST_CLIENT_ID GITHUB_APP_JANUS_TEST_CLIENT_SECRET GITHUB_APP_JANUS_TEST_PRIVATE_KEY GITHUB_APP_WEBHOOK_URL GITHUB_APP_WEBHOOK_SECRET KEYCLOAK_CLIENT_SECRET ACR_SECRET GOOGLE_CLIENT_ID GOOGLE_CLIENT_SECRET K8S_CLUSTER_TOKEN_ENCODED OCM_CLUSTER_URL GITLAB_TOKEN KEYCLOAK_AUTH_BASE_URL KEYCLOAK_AUTH_CLIENTID KEYCLOAK_AUTH_CLIENT_SECRET KEYCLOAK_AUTH_LOGIN_REALM KEYCLOAK_AUTH_REALM DH_TARGET_URL; do
sed -i "s|${key}:.*|${key}: ${!key}|g" "$dir/auth/secrets-rhdh-secrets.yaml"
done

for key in RHDH_BASE_URL RHDH_BASE_URL_HTTP; do
# Escape any special characters in the base64 value
local escaped_value=$(printf '%s' "${!key}" | sed 's/[\/&]/\\&/g')
sed -i "s|${key}:.*|${key}: ${escaped_value}|g" "$dir/auth/secrets-rhdh-secrets.yaml"
done

oc apply -f "$dir/resources/service_account/service-account-rhdh.yaml" --namespace="${project}"
oc apply -f "$dir/auth/service-account-rhdh-secret.yaml" --namespace="${project}"
oc apply -f "$dir/auth/secrets-rhdh-secrets.yaml" --namespace="${project}"
@@ -513,8 +520,8 @@ apply_yaml_files() {
else
create_app_config_map "$config_file" "$project"
fi
oc create configmap dynamic-homepage-and-sidebar-config \
--from-file="dynamic-homepage-and-sidebar-config.yaml"="$dir/resources/config_map/dynamic-homepage-and-sidebar-config.yaml" \
oc create configmap dynamic-plugins-config \
--from-file="dynamic-plugins-config.yaml"="$dir/resources/config_map/dynamic-plugins-config.yaml" \
--namespace="${project}" \
--dry-run=client -o yaml | oc apply -f -

32 changes: 30 additions & 2 deletions .ibm/pipelines/value_files/values_showcase.yaml
Original file line number Diff line number Diff line change
@@ -12,6 +12,32 @@ global:
# an optional `pluginConfig` with plugin-specific backstage configuration, and an optional `disabled` flag to disable/enable a plugin
# listed in `includes` files. It also includes an `integrity` field that is used to verify the plugin package [integrity](https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description).
plugins:
- package: oci://quay.io/gashcrumb/example-root-http-middleware:latest!internal-backstage-plugin-middleware-header-example-dynamic
disabled: false
pluginConfig:
proxy:
endpoints:
/add-test-header:
target: http://${.Values.global.host}/api/simple-chat
credentials: forward
headers:
x-proxy-test-header: hello!
- package: oci://quay.io/gashcrumb/example-root-http-middleware:latest!internal-backstage-plugin-simple-chat
disabled: false
pluginConfig:
dynamicPlugins:
frontend:
internal.backstage-plugin-simple-chat:
appIcons:
- name: chatIcon
importName: ChatIcon
dynamicRoutes:
- path: /simple-chat
importName: SimpleChatPage
menuItem:
text: Simple Chat
- package: oci://quay.io/gashcrumb/example-root-http-middleware:latest!internal-backstage-plugin-simple-chat-backend-dynamic
disabled: false
- package: ./dynamic-plugins/dist/backstage-plugin-scaffolder-backend-module-github-dynamic
disabled: false
- package: ./dynamic-plugins/dist/backstage-plugin-catalog-backend-module-github-dynamic
@@ -222,11 +248,13 @@ upstream:
value: 'true'
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: '0'
- name: ENABLE_CORE_ROOTHTTPROUTER_OVERRIDE
value: 'true'
extraAppConfig:
- configMapRef: app-config-rhdh
filename: app-config-rhdh.yaml
- configMapRef: dynamic-homepage-and-sidebar-config
filename: dynamic-homepage-and-sidebar-config.yaml
- configMapRef: dynamic-plugins-config
filename: dynamic-plugins-config.yaml
- configMapRef: dynamic-global-floating-action-button-config
filename: dynamic-global-floating-action-button-config.yaml
- configMapRef: dynamic-global-header-config
12 changes: 12 additions & 0 deletions dynamic-plugins/_utils/src/wrappers.test.ts
Original file line number Diff line number Diff line change
@@ -264,6 +264,18 @@ describe("Dynamic Plugin Wrappers", () => {
package:
"@red-hat-developer-hub/backstage-plugin-global-header-test@0.0.2",
},
{
package:
"oci://quay.io/gashcrumb/example-root-http-middleware:latest!internal-backstage-plugin-middleware-header-example-dynamic",
},
{
package:
"oci://quay.io/gashcrumb/example-root-http-middleware:latest!internal-backstage-plugin-simple-chat",
},
{
package:
"oci://quay.io/gashcrumb/example-root-http-middleware:latest!internal-backstage-plugin-simple-chat-backend-dynamic",
},
];

it("should have a corresponding package", () => {
18 changes: 18 additions & 0 deletions e2e-tests/playwright/e2e/plugins/middleware.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// https://github.com/gashcrumb/dynamic-plugins-root-http-middleware/tree/main/plugins/middleware-header-example
import test, { expect } from "@playwright/test";
import { Common } from "../../utils/common";

test("Check the middleware is working", async ({ page }) => {
const common = new Common(page);

await common.loginAsGuest();
await page.goto("/simple-chat", { waitUntil: "networkidle" });
await page.getByRole("checkbox", { name: "Use Proxy" }).check();
await page.getByRole("textbox").fill("hi");

const responsePromise = page.waitForResponse("**/api/proxy/add-test-header");
await page.getByRole("textbox").press("Enter");
const response = await responsePromise;
const headers = await response.allHeaders();
expect(headers["x-proxy-test-header"]);
});