|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | 3 | # script to generate rhdh-supported-plugins.adoc from content in |
4 | | -# https://github.com/janus-idp/backstage-plugins/tree/main/plugins/ */package.json |
5 | 4 | # https://github.com/janus-idp/backstage-showcase/tree/main/dynamic-plugins/wrappers/ */json |
6 | 5 |
|
7 | 6 | SCRIPT_DIR=$(cd "$(dirname "$0")" || exit; pwd) |
8 | 7 |
|
9 | | -pluginsRepo="https://github.com/janus-idp/backstage-plugins" # TODO move to BCP and rhdh-plugins |
10 | 8 | showcaseRepo="https://github.com/janus-idp/backstage-showcase" # TODO move to rhd/rhdh |
11 | 9 | usage() { |
12 | 10 | cat <<EOF |
13 | 11 |
|
14 | 12 | Generate an updated table of dynamic plugins from content in the following two repos, for the specified branch: |
15 | | -* $pluginsRepo |
16 | 13 | * $showcaseRepo |
17 | 14 |
|
18 | 15 | Requires: |
|
37 | 34 |
|
38 | 35 | while [[ "$#" -gt 0 ]]; do |
39 | 36 | case $1 in |
40 | | - '--clean') rm -fr /tmp/plugin-versions.txt /tmp/backstage-plugins /tmp/backstage-showcase;; |
| 37 | + '--clean') rm -fr /tmp/plugin-versions.txt /tmp/backstage-showcase;; |
41 | 38 | '-b'|'--ref-branch') BRANCH="$2"; shift 1;; # reference branch, eg., 1.1.x |
42 | 39 | '-h'|'--help') usage;; |
43 | 40 | *) echo "Unknown parameter used: $1."; usage; exit 1;; |
|
48 | 45 | if [[ ! $BRANCH ]]; then usage; exit 1; fi |
49 | 46 |
|
50 | 47 | # fetch GH repos |
51 | | -# TODO switch this to backstage/community-plugins |
52 | | -if [[ ! -d /tmp/backstage-plugins ]]; then |
53 | | - pushd /tmp >/dev/null || exit |
54 | | - git clone "$pluginsRepo" --depth 1 -b "$BRANCH" backstage-plugins |
55 | | - popd >/dev/null || exit |
56 | | -fi |
57 | | - |
58 | | -# TODO switch this to redhat-developer/rhdh |
| 48 | +# TODO include backstage/community-plugins and redhat-developer/rhdh-plugins ? |
| 49 | +# TODO switch to redhat-developer/red-hat-developer-hub |
59 | 50 | if [[ ! -d /tmp/backstage-showcase ]]; then |
60 | 51 | pushd /tmp >/dev/null || exit |
61 | 52 | git clone "$showcaseRepo" --depth 1 -b "$BRANCH" backstage-showcase |
@@ -105,8 +96,8 @@ declare -A adoc2 |
105 | 96 | declare -A adoc3 |
106 | 97 | declare -A csv |
107 | 98 |
|
108 | | -# process 2 folders of json files |
109 | | -jsons=$(find /tmp/backstage-showcase/dynamic-plugins/wrappers/ /tmp/backstage-plugins/plugins/ -maxdepth 2 -name package.json | sort -V) |
| 99 | +# process 1 folders of json files |
| 100 | +jsons=$(find /tmp/backstage-showcase/dynamic-plugins/wrappers/ -maxdepth 2 -name package.json | sort -V) |
110 | 101 | c=0 |
111 | 102 | tot=0 |
112 | 103 | for j in $jsons; do |
@@ -346,7 +337,7 @@ if [[ -f "${ENABLED_PLUGINS}.errors" ]]; then cat "${ENABLED_PLUGINS}.errors"; f |
346 | 337 |
|
347 | 338 | # cleanup |
348 | 339 | rm -f "$ENABLED_PLUGINS" "${ENABLED_PLUGINS}.errors" |
349 | | -# rm -fr /tmp/backstage-plugins /tmp/backstage-showcase |
| 340 | +# rm -fr /tmp/backstage-showcase |
350 | 341 |
|
351 | 342 | warnings=$(grep -c "WARN" "/tmp/warnings.txt") |
352 | 343 | if [[ $warnings -gt 0 ]]; then |
|
0 commit comments