Skip to content

Commit dff0e51

Browse files
committed
Merge branch 'main' into bugfix/fe/java-ser-util-date
# Conflicts: # tests/e2e/tests/web/regression/browser/formatters.e2e.ts # yarn.lock
2 parents 397d466 + 8483ef3 commit dff0e51

File tree

164 files changed

+6094
-2895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+6094
-2895
lines changed

.circleci/config.yml

Lines changed: 7 additions & 1829 deletions
Large diffs are not rendered by default.

.circleci/config.yml.backup

Lines changed: 1868 additions & 0 deletions
Large diffs are not rendered by default.

.circleci/e2e/test.app-image.sh

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,52 @@ set -e
33

44
yarn --cwd tests/e2e install
55

6-
# mount app resources
7-
./release/*.AppImage --appimage-mount >> apppath &
6+
# Create the ri-test directory if it doesn't exist
7+
mkdir -p ri-test
8+
9+
# Extract the AppImage
10+
chmod +x ./release/*.AppImage
11+
./release/*.AppImage --appimage-extract
12+
13+
# Move contents of squashfs-root to ri-test and remove squashfs-root folder
14+
mv squashfs-root/* ri-test/
15+
rm -rf squashfs-root
16+
17+
# Export custom XDG_DATA_DIRS with ri-test
18+
export XDG_DATA_DIRS="$(pwd)/ri-test:$XDG_DATA_DIRS"
819

920
# create folder before tests run to prevent permissions issue
1021
mkdir -p tests/e2e/remote
1122
mkdir -p tests/e2e/rdi
1223

13-
# run rte
24+
# Create a custom .desktop file for RedisInsight
25+
cat > ri-test/redisinsight.desktop <<EOL
26+
[Desktop Entry]
27+
Version=1.0
28+
Name=RedisInsight
29+
Exec=$(pwd)/ri-test/redisinsight %u
30+
Icon=$(pwd)/ri-test/resources/app.asar/img/icon.png
31+
Type=Application
32+
Terminal=false
33+
MimeType=x-scheme-handler/redisinsight;
34+
EOL
35+
36+
# Copy the .desktop file to the local applications directory
37+
cp ri-test/redisinsight.desktop "$HOME/.local/share/applications"
38+
39+
# Update the desktop database with custom directory
40+
update-desktop-database "$(pwd)/ri-test/"
41+
42+
# Register the RedisInsight deeplink protocol
43+
xdg-mime default redisinsight.desktop x-scheme-handler/redisinsight
44+
45+
# Run rte
1446
docker-compose -f tests/e2e/rte.docker-compose.yml build
1547
docker-compose -f tests/e2e/rte.docker-compose.yml up --force-recreate -d -V
1648
./tests/e2e/wait-for-redis.sh localhost 12000 && \
1749

18-
# run tests
19-
COMMON_URL=$(tail -n 1 apppath)/resources/app.asar/dist/renderer/index.html \
20-
ELECTRON_PATH=$(tail -n 1 apppath)/redisinsight \
50+
# Run tests
51+
COMMON_URL=$(pwd)/ri-test/resources/app.asar/dist/renderer/index.html \
52+
ELECTRON_PATH=$(pwd)/ri-test/redisinsight \
2153
RI_SOCKETS_CORS=true \
2254
yarn --cwd tests/e2e dotenv -e .desktop.env yarn --cwd tests/e2e test:desktop:ci
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy Pages
2+
description: 'Download the artifact and deploy to GitHub Pages'
3+
4+
inputs:
5+
group:
6+
description: Group matching the artifacts
7+
required: false
8+
default: '*'
9+
10+
AWS_BUCKET_NAME_TEST:
11+
required: true
12+
AWS_DEFAULT_REGION:
13+
required: true
14+
AWS_DISTRIBUTION_ID:
15+
required: true
16+
AWS_ACCESS_KEY_ID:
17+
required: true
18+
AWS_SECRET_ACCESS_KEY:
19+
required: true
20+
21+
runs:
22+
using: 'composite'
23+
steps:
24+
25+
- name: Get current date
26+
id: date
27+
uses: ./.github/actions/get-current-date
28+
29+
- name: Download artifacts
30+
uses: actions/download-artifact@v4
31+
with:
32+
pattern: ${{ format('{0}*', inputs.group) }}
33+
path: public/${{ github.run_id }}
34+
35+
- name: Deploy 🚀
36+
shell: bash
37+
env:
38+
AWS_BUCKET_NAME_TEST: ${{ inputs.AWS_BUCKET_NAME_TEST }}
39+
AWS_DEFAULT_REGION: ${{ inputs.AWS_DEFAULT_REGION }}
40+
AWS_DISTRIBUTION_ID: ${{ inputs.AWS_DISTRIBUTION_ID }}
41+
AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }}
42+
AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
43+
run: |
44+
45+
SUB_PATH=test-reports/${{ steps.date.outputs.date }}
46+
47+
aws s3 cp public/ s3://${AWS_BUCKET_NAME_TEST}/public/${SUB_PATH} --recursive
48+
49+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Get current date
2+
3+
outputs:
4+
date:
5+
description: Current date
6+
value: ${{ steps.date.outputs.date }}
7+
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: Get current date
12+
id: date
13+
shell: bash
14+
run: |
15+
DATE=$(date +'%Y-%m-%d')
16+
echo "date=$DATE" >> $GITHUB_OUTPUT
17+

.github/actions/install-all-build-libs/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ runs:
3333
- name: Setup Node
3434
uses: actions/[email protected]
3535
with:
36-
node-version: '20.15'
36+
node-version: '20.18.0'
3737
# disable cache for windows
3838
# https://github.com/actions/setup-node/issues/975
3939
cache: ${{ runner.os != 'Windows' && 'yarn' || '' }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Remove all artifacts
2+
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Merge artifacts by pattern
7+
id: merge-artifacts
8+
uses: actions/upload-artifact/merge@v4
9+
with:
10+
name: remove-artifacts
11+
pattern: '*'
12+
delete-merged: true
13+
14+
- name: Delete merged artifact
15+
uses: actions/github-script@v7
16+
with:
17+
script: |
18+
github.rest.actions.deleteArtifact({
19+
owner: context.repo.owner,
20+
repo: context.repo.repo,
21+
artifact_id: ${{ steps.merge-artifacts.outputs.artifact-id }}
22+
});
23+

.github/build/build.Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM node:20.14-alpine
2+
3+
# runtime args and environment variables
4+
ARG DIST=Redis-Insight.tar.gz
5+
ARG NODE_ENV=production
6+
ARG RI_SEGMENT_WRITE_KEY
7+
ENV RI_SEGMENT_WRITE_KEY=${RI_SEGMENT_WRITE_KEY}
8+
ENV NODE_ENV=${NODE_ENV}
9+
ENV RI_SERVE_STATICS=true
10+
ENV RI_BUILD_TYPE='DOCKER_ON_PREMISE'
11+
ENV RI_APP_FOLDER_ABSOLUTE_PATH='/data'
12+
13+
# this resolves CVE-2023-5363
14+
# TODO: remove this line once we update to base image that doesn't have this vulnerability
15+
RUN apk update && apk upgrade --no-cache libcrypto3 libssl3
16+
17+
# set workdir
18+
WORKDIR /usr/src/app
19+
20+
# copy artifacts built in previous stage to this one
21+
ADD $DIST /usr/src/app/redisinsight
22+
RUN ls -la /usr/src/app/redisinsight
23+
24+
# folder to store local database, plugins, logs and all other files
25+
RUN mkdir -p /data && chown -R node:node /data
26+
27+
# copy the docker entry point script and make it executable
28+
COPY --chown=node:node ./docker-entry.sh ./
29+
RUN chmod +x docker-entry.sh
30+
31+
# since RI is hard-code to port 5000, expose it from the container
32+
EXPOSE 5000
33+
34+
# don't run the node process as root
35+
USER node
36+
37+
# serve the application 🚀
38+
ENTRYPOINT ["./docker-entry.sh", "node", "redisinsight/api/dist/src/main"]

.github/build/build.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# install deps
5+
yarn
6+
yarn --cwd redisinsight/api
7+
8+
# build
9+
10+
yarn build:statics
11+
yarn build:ui
12+
yarn --cwd ./redisinsight/api build:prod

.github/build/build_modules.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/bin/bash
2+
set -e
3+
4+
PLATFORM=${PLATFORM:-'linux'}
5+
ARCH=${ARCH:-'x64'}
6+
LIBC=${LIBC:-''}
7+
#FILENAME="Redis-Insight-$PLATFORM.$VERSION.$ARCH.zip"
8+
FILENAME="Redis-Insight-web-$PLATFORM"
9+
if [ ! -z $LIBC ]
10+
then
11+
FILENAME="$FILENAME-$LIBC.$ARCH.tar.gz"
12+
export npm_config_target_libc="$LIBC"
13+
else
14+
FILENAME="$FILENAME.$ARCH.tar.gz"
15+
fi
16+
17+
echo "Building node modules..."
18+
echo "Platform: $PLATFORM"
19+
echo "Arch: $ARCH"
20+
echo "Libc: $LIBC"
21+
echo "npm target libc: $npm_config_target_libc"
22+
echo "Filname: $FILENAME"
23+
24+
rm -rf redisinsight/api/node_modules
25+
26+
npm_config_arch="$ARCH" \
27+
npm_config_target_arch="$ARCH" \
28+
npm_config_platform="$PLATFORM" \
29+
npm_config_target_platform="$PLATFORM" \
30+
yarn --cwd ./redisinsight/api install --production
31+
32+
cp redisinsight/api/.yarnclean.prod redisinsight/api/.yarnclean
33+
yarn --cwd ./redisinsight/api autoclean --force
34+
35+
rm -rf redisinsight/build.zip
36+
37+
cp LICENSE ./redisinsight
38+
39+
cd redisinsight && tar -czf build.tar.gz \
40+
--exclude="api/node_modules/**/build/node_gyp_bins/python3" \
41+
api/node_modules \
42+
api/dist \
43+
ui/dist \
44+
LICENSE \
45+
&& cd ..
46+
47+
mkdir -p release/web
48+
cp redisinsight/build.tar.gz release/web/"$FILENAME"
49+
50+
# Minify build via esbuild
51+
echo "Start minifing workflow"
52+
npm_config_arch="$ARCH" \
53+
npm_config_target_arch="$ARCH" \
54+
npm_config_platform="$PLATFORM" \
55+
npm_config_target_platform="$PLATFORM" \
56+
yarn --cwd ./redisinsight/api install
57+
yarn --cwd ./redisinsight/api minify:prod
58+
59+
60+
PACKAGE_JSON_PATH="./redisinsight/api/package.json"
61+
APP_PACKAGE_JSON_PATH="./redisinsight/package.json"
62+
63+
# Extract dependencies from the app package.json
64+
BINARY_PACKAGES=$(jq -r '.dependencies | keys[]' "$APP_PACKAGE_JSON_PATH" | jq -R -s -c 'split("\n")[:-1]')
65+
66+
echo "Binary packages to exclude during minify: $BINARY_PACKAGES"
67+
68+
# Modify the package.json
69+
jq --argjson keep "$BINARY_PACKAGES" \
70+
'del(.devDependencies) | .dependencies |= with_entries(select(.key as $k | $keep | index($k)))' \
71+
"$PACKAGE_JSON_PATH" > temp.json && mv temp.json "$PACKAGE_JSON_PATH"
72+
73+
npm_config_arch="$ARCH" \
74+
npm_config_target_arch="$ARCH" \
75+
npm_config_platform="$PLATFORM" \
76+
npm_config_target_platform="$PLATFORM" \
77+
yarn --cwd ./redisinsight/api install --production
78+
yarn --cwd ./redisinsight/api autoclean --force
79+
80+
# Compress minified build
81+
cd redisinsight && tar -czf build-mini.tar.gz \
82+
--exclude="api/node_modules/**/build/node_gyp_bins/python3" \
83+
api/node_modules \
84+
api/dist-minified \
85+
ui/dist \
86+
LICENSE \
87+
&& cd ..
88+
89+
mkdir -p release/web-mini
90+
cp redisinsight/build-mini.tar.gz release/web-mini/"$FILENAME"
91+
92+
# Restore the original package.json and yarn.lock
93+
git restore redisinsight/api/yarn.lock redisinsight/api/package.json
94+

0 commit comments

Comments
 (0)