Skip to content

Commit 5e564dd

Browse files
Orchestrator: add makefile in orchestrator to export plugins (#2985)
* add makefile in orchestrator to export plugins * fix issues in the backend plugin export
1 parent 7039554 commit 5e564dd

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

workspaces/orchestrator/Makefile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
workspace=orchestrator
2+
3+
# This variables defines the rhdh and dynamic-plugins-root paths.
4+
#
5+
# The default expects that you have this rhdh-plugins and the rhdh
6+
# repo are cloned close to each other.
7+
#
8+
# If you don't have the org structure locally you can override this
9+
# with make arguments like this:
10+
#
11+
# make rhdh=../../../rhdh <command like copy>
12+
#
13+
# Or use an absolute path:
14+
#
15+
# make rhdh=~/git/rhdh <command like copy>
16+
rhdh=../../../rhdh
17+
18+
# Expand ~ to the user's home directory
19+
override rhdh := $(patsubst ~%,$(HOME)%,$(rhdh))
20+
21+
# The dynamic-plugins-root path is relative to the plugins/* folders,
22+
# so prepend ../../ only when rhdh is a relative path.
23+
ifneq ($(filter /%,$(rhdh)),)
24+
dproot=${rhdh}/dynamic-plugins-root
25+
else
26+
dproot=../../${rhdh}/dynamic-plugins-root
27+
endif
28+
29+
clean=true
30+
31+
dev=true
32+
33+
fix:
34+
@echo
35+
@echo fix and format ${workspace} workspace
36+
@echo
37+
yarn tsc:full
38+
yarn build:api-reports:only
39+
40+
add-to-rhdh: add-frontend-to-rhdh add-backend-to-rhdh add-backend-modules-to-rhdh copy-config-to-rhdh
41+
42+
add-frontend-to-rhdh:
43+
@echo
44+
@echo Will build and install ${workspace} frontend plugins into ${rhdh}
45+
@echo
46+
cd plugins/custom-authentication-provider-module && npx --yes @red-hat-developer-hub/cli plugin export --dynamic-plugins-root "${dproot}" --clean "${clean}" --dev "${dev}"
47+
cd plugins/orchestrator && npx --yes @red-hat-developer-hub/cli plugin export --dynamic-plugins-root "${dproot}" --clean "${clean}" --dev "${dev}"
48+
cd plugins/orchestrator-form-widgets && npx --yes @red-hat-developer-hub/cli plugin export --dynamic-plugins-root "${dproot}" --clean "${clean}" --dev "${dev}"
49+
50+
add-backend-to-rhdh:
51+
@echo
52+
@echo Will build and install ${workspace} backend plugins into ${rhdh}
53+
@echo
54+
# Backend plugins need a two-step export: rhdh cli to build, then janus-idp cli to package.
55+
# Using only rhdh cli plugin export for backends causes RHDH to fail to start.
56+
# Clean existing dproot destinations to avoid "copy to subdirectory of itself" errors on re-runs.
57+
cd plugins/custom-authentication-provider-module-backend && rm -rf dist-dynamic "${dproot}/custom-authentication-provider-module-backend" && npx --yes @red-hat-developer-hub/cli@1.9.1 plugin export && npx --yes @janus-idp/cli package package-dynamic-plugins --export-to "${dproot}"
58+
cd plugins/orchestrator-backend && rm -rf dist-dynamic "${dproot}/red-hat-developer-hub-backstage-plugin-orchestrator-backend" && npx --yes @red-hat-developer-hub/cli@1.9.1 plugin export && npx --yes @janus-idp/cli package package-dynamic-plugins --export-to "${dproot}"
59+
60+
add-backend-modules-to-rhdh:
61+
@echo
62+
@echo Will build and install ${workspace} backend modules into ${rhdh}
63+
@echo
64+
# Backend modules also need the two-step export (see add-backend-to-rhdh).
65+
cd plugins/orchestrator-backend-module-loki && rm -rf dist-dynamic "${dproot}/red-hat-developer-hub-backstage-plugin-orchestrator-backend-module-loki" && npx --yes @red-hat-developer-hub/cli@1.9.1 plugin export && npx --yes @janus-idp/cli package package-dynamic-plugins --export-to "${dproot}"
66+
cd plugins/scaffolder-backend-module-orchestrator && rm -rf dist-dynamic "${dproot}/red-hat-developer-hub-backstage-plugin-scaffolder-backend-module-orchestrator" && npx --yes @red-hat-developer-hub/cli@1.9.1 plugin export --embed-package @red-hat-developer-hub/backstage-plugin-orchestrator-common && npx --yes @janus-idp/cli package package-dynamic-plugins --export-to "${dproot}"
67+
68+
copy-config-to-rhdh:
69+
@echo
70+
@echo Copy app-config.yaml into ${rhdh}
71+
@echo
72+
cp app-config.yaml "${rhdh}/app-config-orchestrator.local.yaml"
73+
@echo
74+
@echo You can start your rhdh now with
75+
@echo
76+
@echo yarn dev
77+
@echo
78+
79+
remove-from-rhdh:
80+
@echo
81+
@echo Remove packages from ${rhdh}
82+
@echo
83+
rm -rf "${dproot}/custom-authentication-provider-module"
84+
rm -rf "${dproot}/custom-authentication-provider-module-backend"
85+
rm -rf "${dproot}/red-hat-developer-hub-backstage-plugin-orchestrator"
86+
rm -rf "${dproot}/red-hat-developer-hub-backstage-plugin-orchestrator-backend"
87+
rm -rf "${dproot}/red-hat-developer-hub-backstage-plugin-orchestrator-backend-module-loki"
88+
rm -rf "${dproot}/red-hat-developer-hub-backstage-plugin-orchestrator-form-widgets"
89+
rm -rf "${dproot}/red-hat-developer-hub-backstage-plugin-scaffolder-backend-module-orchestrator"
90+
rm -f "${rhdh}/app-config-orchestrator.local.yaml"

0 commit comments

Comments
 (0)