Skip to content

Commit e1e3bf8

Browse files
committed
switch from bash and node to all TS all the time
Signed-off-by: rhdh-bot service account <rhdh-bot@redhat.com>
1 parent 3e25645 commit e1e3bf8

24 files changed

Lines changed: 1331 additions & 1037 deletions

.github/workflows/pr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ jobs:
148148
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
149149
run: yarn run test --continue --affected
150150

151-
- name: Run install-dynamic-plugins shell tests
151+
- name: Run install-dynamic-plugins tests
152152
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
153-
run: bash scripts/install-dynamic-plugins/test_install-dynamic-plugins.sh
153+
run: cd scripts/install-dynamic-plugins && yarn install && yarn test
154154

155155
- name: Change directory to dynamic-plugins
156156
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}

build/containerfiles/Containerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ WORKDIR $CONTAINER_SOURCE/
241241
# Install techdocs dependencies using requirements files
242242
# hadolint ignore=DL3013,DL3041,SC2086
243243
COPY "$EXTERNAL_SOURCE_NESTED"/python/ ./python
244-
RUN microdnf install -y jq python3.11 python3.11-pip python3.11-devel make cmake cpp gcc gcc-c++ skopeo 1>/dev/null 2>&1; \
244+
RUN microdnf install -y python3.11 python3.11-pip python3.11-devel make cmake cpp gcc gcc-c++ skopeo 1>/dev/null 2>&1; \
245245
alternatives --install /usr/bin/python python /usr/bin/python3.11 1 && \
246246
alternatives --install /usr/bin/pip pip /usr/bin/pip3.11 1 && \
247247
# fix ownership for pip install folder
@@ -266,11 +266,12 @@ COPY --from=build --chown=1001:1001 "$CONTAINER_SOURCE"/ ./
266266
# RHIDP-4220 - make Konflux preflight and EC checks happy - [check-container] Create a directory named /licenses and include all relevant licensing
267267
COPY $EXTERNAL_SOURCE_NESTED/LICENSE /licenses/
268268

269-
# Copy script to gather dynamic plugins; copy embedded dynamic plugins to root folder; fix permissions
270-
COPY $EXTERNAL_SOURCE_NESTED/scripts/install-dynamic-plugins/install-dynamic-plugins.sh \
271-
$EXTERNAL_SOURCE_NESTED/scripts/install-dynamic-plugins/*.cjs \
269+
# Copy TypeScript installer bundle (yarn install && yarn build in scripts/install-dynamic-plugins) + launcher
270+
COPY $EXTERNAL_SOURCE_NESTED/scripts/install-dynamic-plugins/dist/install-dynamic-plugins.cjs \
271+
$EXTERNAL_SOURCE_NESTED/scripts/install-dynamic-plugins/install-dynamic-plugins.sh \
272272
./
273-
RUN chmod a+rx ./install-dynamic-plugins.sh ./*.cjs
273+
RUN chmod a+rx ./install-dynamic-plugins.sh ./install-dynamic-plugins.cjs && \
274+
cd scripts/install-dynamic-plugins; yarn install && yarn build
274275

275276
# Fix for https://issues.redhat.com/browse/RHIDP-728
276277
RUN mkdir -p /opt/app-root/src/.npm; chown -R 1001:1001 /opt/app-root/src/.npm

docs/dynamic-plugins/installing-plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ plugins:
7676

7777
### Catalog Entities Extraction
7878

79-
When the `CATALOG_INDEX_IMAGE` is set and the index image contains a `catalog-entities/marketplace` directory, the [`install-dynamic-plugins.sh`](../../scripts/install-dynamic-plugins/install-dynamic-plugins.sh) will automatically extract these catalog entities to a configurable location.
79+
When the `CATALOG_INDEX_IMAGE` is set and the index image contains a `catalog-entities/marketplace` directory, the [`install-dynamic-plugins`](../../scripts/install-dynamic-plugins/) (TypeScript; from `scripts/install-dynamic-plugins/` run `yarn install && yarn build` to produce `dist/install-dynamic-plugins.cjs`) will automatically extract these catalog entities to a configurable location.
8080

8181
The extraction destination is governed by the `CATALOG_ENTITIES_EXTRACT_DIR` environment variable:
8282

scripts/install-dynamic-plugins/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ pyvenv.cfg
66
**/__pycache__/
77
**/.pytest_cache/
88
**/.venv/
9+
node_modules/

scripts/install-dynamic-plugins/compute-plugin-hash.cjs

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
const esbuild = require('esbuild');
4+
const path = require('path');
5+
6+
esbuild
7+
.build({
8+
entryPoints: [path.join(__dirname, 'dist', 'cli.js')],
9+
bundle: true,
10+
platform: 'node',
11+
target: 'node22',
12+
format: 'cjs',
13+
outfile: path.join(__dirname, 'dist', 'install-dynamic-plugins.cjs'),
14+
banner: {
15+
js: '#!/usr/bin/env node\n'
16+
},
17+
sourcemap: true,
18+
logLevel: 'info'
19+
})
20+
.catch(() => process.exit(1));

0 commit comments

Comments
 (0)