Skip to content

Commit 92a1fb9

Browse files
authored
chore: pull latest upstream code (#1043)
* replace everything but CI with upstream * CI updates for upstream changes * add cookie secret for CI * CI use yarn instead of reqs files * update compose redis/pg; try GHA * disable circle and migrate docker image builders to GHA * reenable circleci for now * remove pgautoupgrade * fix docker build conditions for circle * use separate circle builder * disable redash_stmo for testing * skip redash_stmo for testing
1 parent 2a02d8c commit 92a1fb9

File tree

951 files changed

+69508
-50901
lines changed

Some content is hidden

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

951 files changed

+69508
-50901
lines changed

.ci/Dockerfile.cypress

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM cypress/browsers:node18.12.0-chrome106-ff106
2+
3+
ENV APP /usr/src/app
4+
WORKDIR $APP
5+
6+
COPY package.json yarn.lock .yarnrc $APP/
7+
COPY viz-lib $APP/viz-lib
8+
RUN npm install yarn@1.22.22 -g && yarn --frozen-lockfile --network-concurrency 1 > /dev/null
9+
10+
COPY . $APP
11+
12+
RUN ./node_modules/.bin/cypress verify

.ci/compose.ci.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
services:
2+
redash:
3+
build: ../
4+
command: manage version
5+
depends_on:
6+
- postgres
7+
- redis
8+
ports:
9+
- "5000:5000"
10+
environment:
11+
PYTHONUNBUFFERED: 0
12+
REDASH_LOG_LEVEL: "INFO"
13+
REDASH_REDIS_URL: "redis://redis:6379/0"
14+
POSTGRES_PASSWORD: "FmTKs5vX52ufKR1rd8tn4MoSP7zvCJwb"
15+
REDASH_DATABASE_URL: "postgresql://postgres:FmTKs5vX52ufKR1rd8tn4MoSP7zvCJwb@postgres/postgres"
16+
REDASH_COOKIE_SECRET: "2H9gNG9obnAQ9qnR9BDTQUph6CbXKCzF"
17+
redis:
18+
image: redis:7-alpine
19+
restart: unless-stopped
20+
postgres:
21+
image: postgres:18-alpine
22+
command: "postgres -c fsync=off -c full_page_writes=off -c synchronous_commit=OFF"
23+
restart: unless-stopped
24+
environment:
25+
POSTGRES_HOST_AUTH_METHOD: "trust"

.ci/compose.cypress.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
x-redash-service: &redash-service
2+
build:
3+
context: ../
4+
args:
5+
install_groups: "main"
6+
code_coverage: ${CODE_COVERAGE}
7+
x-redash-environment: &redash-environment
8+
REDASH_LOG_LEVEL: "INFO"
9+
REDASH_REDIS_URL: "redis://redis:6379/0"
10+
POSTGRES_PASSWORD: "FmTKs5vX52ufKR1rd8tn4MoSP7zvCJwb"
11+
REDASH_DATABASE_URL: "postgresql://postgres:FmTKs5vX52ufKR1rd8tn4MoSP7zvCJwb@postgres/postgres"
12+
REDASH_RATELIMIT_ENABLED: "false"
13+
REDASH_ENFORCE_CSRF: "true"
14+
REDASH_COOKIE_SECRET: "2H9gNG9obnAQ9qnR9BDTQUph6CbXKCzF"
15+
services:
16+
server:
17+
<<: *redash-service
18+
command: server
19+
depends_on:
20+
- postgres
21+
- redis
22+
ports:
23+
- "5000:5000"
24+
environment:
25+
<<: *redash-environment
26+
PYTHONUNBUFFERED: 0
27+
scheduler:
28+
<<: *redash-service
29+
command: scheduler
30+
depends_on:
31+
- server
32+
environment:
33+
<<: *redash-environment
34+
worker:
35+
<<: *redash-service
36+
command: worker
37+
depends_on:
38+
- server
39+
environment:
40+
<<: *redash-environment
41+
PYTHONUNBUFFERED: 0
42+
cypress:
43+
ipc: host
44+
build:
45+
context: ../
46+
dockerfile: .ci/Dockerfile.cypress
47+
depends_on:
48+
- server
49+
- worker
50+
- scheduler
51+
environment:
52+
CYPRESS_baseUrl: "http://server:5000"
53+
CYPRESS_coverage: ${CODE_COVERAGE}
54+
PERCY_TOKEN: ${PERCY_TOKEN}
55+
PERCY_BRANCH: ${CIRCLE_BRANCH}
56+
PERCY_COMMIT: ${CIRCLE_SHA1}
57+
PERCY_PULL_REQUEST: ${CIRCLE_PR_NUMBER}
58+
COMMIT_INFO_BRANCH: ${CIRCLE_BRANCH}
59+
COMMIT_INFO_MESSAGE: ${COMMIT_INFO_MESSAGE}
60+
COMMIT_INFO_AUTHOR: ${CIRCLE_USERNAME}
61+
COMMIT_INFO_SHA: ${CIRCLE_SHA1}
62+
COMMIT_INFO_REMOTE: ${CIRCLE_REPOSITORY_URL}
63+
CYPRESS_PROJECT_ID: ${CYPRESS_PROJECT_ID}
64+
CYPRESS_RECORD_KEY: ${CYPRESS_RECORD_KEY}
65+
redis:
66+
image: redis:7-alpine
67+
restart: unless-stopped
68+
postgres:
69+
image: postgres:18-alpine
70+
command: "postgres -c fsync=off -c full_page_writes=off -c synchronous_commit=OFF"
71+
restart: unless-stopped
72+
environment:
73+
POSTGRES_HOST_AUTH_METHOD: "trust"

.ci/docker_build

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# This script only needs to run on the main Redash repo
4+
5+
if [ "${GITHUB_REPOSITORY}" != "getredash/redash" ]; then
6+
echo "Skipping image build for Docker Hub, as this isn't the main Redash repository"
7+
exit 0
8+
fi
9+
10+
if [ "${GITHUB_REF_NAME}" != "master" ] && [ "${GITHUB_REF_NAME}" != "preview-image" ]; then
11+
echo "Skipping image build for Docker Hub, as this isn't the 'master' nor 'preview-image' branch"
12+
exit 0
13+
fi
14+
15+
if [ "x${DOCKER_USER}" = "x" ] || [ "x${DOCKER_PASS}" = "x" ]; then
16+
echo "Skipping image build for Docker Hub, as the login details aren't available"
17+
exit 0
18+
fi
19+
20+
set -e
21+
VERSION=$(jq -r .version package.json)
22+
VERSION_TAG="$VERSION.b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}"
23+
24+
export DOCKER_BUILDKIT=1
25+
export COMPOSE_DOCKER_CLI_BUILD=1
26+
27+
docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}"
28+
29+
DOCKERHUB_REPO="redash/redash"
30+
DOCKER_TAGS="-t redash/redash:preview -t redash/preview:${VERSION_TAG}"
31+
32+
# Build the docker container
33+
docker build --build-arg install_groups="main,all_ds,dev" ${DOCKER_TAGS} .
34+
35+
# Push the container to the preview build locations
36+
docker push "${DOCKERHUB_REPO}:preview"
37+
docker push "redash/preview:${VERSION_TAG}"
38+
39+
echo "Built: ${VERSION_TAG}"

.ci/pack

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
NAME=redash
3+
VERSION=$(jq -r .version package.json)
4+
FULL_VERSION=$VERSION+b$CIRCLE_BUILD_NUM
5+
FILENAME=$NAME.$FULL_VERSION.tar.gz
6+
7+
mkdir -p /tmp/artifacts/
8+
9+
tar -zcv -f /tmp/artifacts/$FILENAME --exclude=".git" --exclude="optipng*" --exclude="cypress" --exclude="*.pyc" --exclude="*.pyo" --exclude="venv" *

.ci/update_version

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
VERSION=$(jq -r .version package.json)
3+
FULL_VERSION=${VERSION}+b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}
4+
5+
sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py
6+
sed -i "s/dev/${GITHUB_SHA}/" client/app/version.json

.circleci/config.yml

Lines changed: 78 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,37 @@ version: 2.0
33
jobs:
44
backend-lint:
55
docker:
6-
- image: circleci/python:3.7.0
6+
- image: cimg/python:3.8
77
steps:
88
- checkout
9-
- run: sudo pip install flake8
10-
- run: ./bin/flake8_tests.sh
9+
- run: pip3 install black==23.1.0 ruff==0.0.287
10+
- run: ruff check .
11+
- run: black --check .
1112
backend-unit-tests:
1213
environment:
1314
COMPOSE_FILE: .circleci/docker-compose.circle.yml
1415
COMPOSE_PROJECT_NAME: redash
1516
docker:
16-
- image: circleci/buildpack-deps:xenial
17+
- image: cimg/base:2025.04
1718
steps:
1819
- setup_remote_docker
1920
- checkout
2021
- run:
2122
name: Build Docker Images
2223
command: |
2324
set -x
24-
docker-compose build --build-arg skip_ds_deps=true --build-arg skip_frontend_build=true
25-
docker-compose up -d
25+
docker compose build --build-arg install_groups="main,all_ds,dev" --build-arg skip_frontend_build=true
26+
docker compose up -d
2627
sleep 10
2728
- run:
2829
name: Create Test Database
29-
command: docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests;"
30+
command: docker compose -p redash run --rm postgres psql -h postgres -U postgres -c "create database tests;"
3031
- run:
3132
name: List Enabled Query Runners
32-
command: docker-compose run --rm redash manage ds list_types
33+
command: docker compose -p redash run --rm redash manage ds list_types
3334
- run:
3435
name: Run Tests
35-
command: docker-compose run --name tests redash tests --junitxml=junit.xml --cov-report xml --cov=redash --cov-config .coveragerc tests/
36+
command: docker compose -p redash run --name tests redash tests --junitxml=junit.xml --cov-report=xml --cov=redash --cov-config=.coveragerc tests/
3637
- run:
3738
name: Copy Test Results
3839
command: |
@@ -46,56 +47,102 @@ jobs:
4647
path: coverage.xml
4748
frontend-lint:
4849
docker:
49-
- image: cimg/node:12.22.8
50+
- image: cimg/node:18.20
5051
steps:
5152
- checkout
5253
- run: mkdir -p /tmp/test-results/eslint
53-
- run: npm ci
54-
- run: npm run lint:ci
54+
- run: |
55+
npm install --global --force yarn@$1.22.22
56+
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
57+
- run: yarn lint:ci
5558
- store_test_results:
5659
path: /tmp/test-results
5760
frontend-unit-tests:
5861
docker:
59-
- image: cimg/node:12.22.8
62+
- image: cimg/node:18.20
6063
steps:
6164
- checkout
62-
- run: sudo apt update
63-
- run: sudo apt install python3-pip
64-
- run: sudo pip3 install -r requirements_bundles.txt
65-
- run: npm ci
66-
- run: npm run bundle
65+
- run: |
66+
npm install --global --force yarn@$1.22.22
67+
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
6768
- run:
6869
name: Run App Tests
69-
command: npm test
70+
command: yarn test
7071
- run:
7172
name: Run Visualizations Tests
72-
command: (cd viz-lib && npm test)
73-
- run: npm run lint
73+
command: (cd viz-lib && yarn test)
74+
- run: yarn lint
75+
76+
frontend-e2e-tests:
77+
environment:
78+
COMPOSE_FILE: .ci/compose.cypress.yml
79+
COMPOSE_PROJECT_NAME: cypress
80+
CYPRESS_INSTALL_BINARY: 0
81+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
82+
# PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
83+
# CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
84+
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
85+
docker:
86+
- image: cimg/node:18.20
87+
steps:
88+
- run: checkout
89+
- run:
90+
name: Install Dependencies
91+
command: |
92+
npm install --global --force yarn@$1.22.22
93+
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
94+
# - name: Enable Code Coverage Report For Master Branch
95+
# if: endsWith(github.ref, '/master')
96+
# run: |
97+
# echo "CODE_COVERAGE=true" >> "$GITHUB_ENV"
98+
- run:
99+
name: Setup Redash Server
100+
command: |
101+
set -x
102+
yarn cypress build
103+
yarn cypress start -- --skip-db-seed
104+
docker compose run cypress yarn cypress db-seed
105+
- run:
106+
name: Execute Cypress Tests
107+
command: yarn cypress run-ci
108+
# - name: "Failure: output container logs to console"
109+
# if: failure()
110+
# run: docker compose logs
111+
- run:
112+
name: Copy Code Coverage Results
113+
command: docker cp cypress:/usr/src/app/coverage ./coverage || true
114+
# - name: Store Coverage Results
115+
# uses: actions/upload-artifact@v4
116+
# with:
117+
# name: coverage
118+
# path: coverage
74119
build-docker-image:
75120
docker:
76-
- image: cimg/node:12.22.8
121+
- image: cimg/node:18.20
77122
steps:
78123
- setup_remote_docker
79124
- checkout
80125
- run: echo "export MOZILLA_VERSION=master" >> $BASH_ENV
81-
- run: sudo apt update
82-
- run: sudo apt install python3-pip
83-
- run: sudo pip3 install -r requirements_bundles.txt
126+
- run: |
127+
npm install --global --force yarn@$1.22.22
128+
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
84129
- run: .circleci/update_version
85-
- run: npm run bundle
130+
# Bundle extensions:
131+
# - run: npm run bundle
86132
- run: .circleci/docker_build
87133
build-docker-image-tag:
88134
docker:
89-
- image: cimg/node:12.22.8
135+
- image: cimg/node:18.20
90136
steps:
91137
- setup_remote_docker
92138
- checkout
93139
- run: echo "export MOZILLA_VERSION=$CIRCLE_TAG" >> $BASH_ENV
94-
- run: sudo apt update
95-
- run: sudo apt install python3-pip
96-
- run: sudo pip3 install -r requirements_bundles.txt
140+
- run: |
141+
npm install --global --force yarn@$1.22.22
142+
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
97143
- run: .circleci/update_version
98-
- run: npm run bundle
144+
# Bundle extensions:
145+
# - run: npm run bundle
99146
- run: .circleci/docker_build
100147
# Create alias from tag to "latest":
101148
- run: docker tag $DOCKERHUB_REPO:$CIRCLE_TAG $DOCKERHUB_REPO:latest

.circleci/docker-compose.circle.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ services:
1212
PYTHONUNBUFFERED: 0
1313
REDASH_LOG_LEVEL: "INFO"
1414
REDASH_REDIS_URL: "redis://redis:6379/0"
15+
# POSTGRES_PASSWORD: "FmTKs5vX52ufKR1rd8tn4MoSP7zvCJwb"
1516
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
17+
# REDASH_DATABASE_URL: "postgresql://postgres:FmTKs5vX52ufKR1rd8tn4MoSP7zvCJwb@postgres/postgres"
18+
REDASH_COOKIE_SECRET: "2H9gNG9obnAQ9qnR9BDTQUph6CbXKCzF"
1619
redis:
17-
image: redis:3.0-alpine
20+
image: redis:7-alpine
1821
restart: unless-stopped
1922
postgres:
20-
image: postgres:9.5.6-alpine
23+
image: postgres:18-alpine
2124
command: "postgres -c fsync=off -c full_page_writes=off -c synchronous_commit=OFF"
2225
restart: unless-stopped
26+
environment:
27+
POSTGRES_HOST_AUTH_METHOD: "trust"

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
client/.tmp/
2-
client/dist/
32
node_modules/
43
viz-lib/node_modules/
54
.tmp/

.github/ISSUE_TEMPLATE/---bug_report.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ about: Report reproducible software issues so we can improve
77
88
We use GitHub only for bug reports 🐛
99
10-
Anything else should be posted to https://discuss.redash.io 👫
10+
Anything else should be a discussion: https://github.com/getredash/redash/discussions/ 👫
1111
12-
🚨For support, help & questions use https://discuss.redash.io/c/support
13-
💡For feature requests & ideas use https://discuss.redash.io/c/feature-requests
12+
🚨For support, help & questions use https://github.com/getredash/redash/discussions/categories/q-a
13+
💡For feature requests & ideas use https://github.com/getredash/redash/discussions/categories/ideas
1414
1515
**Found a security vulnerability?** Please email security@redash.io to report any security vulnerabilities. We will acknowledge receipt of your vulnerability and strive to send you regular updates about our progress. If you're curious about the status of your disclosure please feel free to email us again. If you want to encrypt your disclosure email, you can use this PGP key.
1616

0 commit comments

Comments
 (0)