Skip to content

Commit 58cc49b

Browse files
authored
Revert build (2 of 2) (#6967)
1 parent 753ea84 commit 58cc49b

15 files changed

+263
-195
lines changed
File renamed without changes.

.ci/compose.ci.yaml

+25
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: pgautoupgrade/pgautoupgrade:latest
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

+73
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: pgautoupgrade/pgautoupgrade:latest
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

+39
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

+9
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

+6
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

Dockerfile

+22-28
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
1-
# Controls whether to build the frontend assets
2-
ARG FRONTEND_BUILD_MODE=0
1+
FROM node:18-bookworm as frontend-builder
32

4-
# MODE 0: create empty files. useful for backend tests
5-
FROM alpine:3.19 as frontend-builder-0
6-
RUN \
7-
mkdir -p /frontend/client/dist && \
8-
touch /frontend/client/dist/multi_org.html && \
9-
touch /frontend/client/dist/index.html
3+
RUN npm install --global --force [email protected]
104

11-
# MODE 1: copy static frontend from host, useful for CI to ignore building static content multiple times
12-
FROM alpine:3.19 as frontend-builder-1
13-
COPY client/dist /frontend/client/dist
5+
# Controls whether to build the frontend assets
6+
ARG skip_frontend_build
147

15-
# MODE 2: build static content in docker, can be used for a local development
16-
FROM node:18-bookworm as frontend-builder-2
17-
RUN npm install --global --force [email protected]
188
ENV CYPRESS_INSTALL_BINARY=0
199
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
10+
2011
RUN useradd -m -d /frontend redash
2112
USER redash
13+
2214
WORKDIR /frontend
2315
COPY --chown=redash package.json yarn.lock .yarnrc /frontend/
2416
COPY --chown=redash viz-lib /frontend/viz-lib
2517
COPY --chown=redash scripts /frontend/scripts
2618

27-
RUN yarn --frozen-lockfile --network-concurrency 1;
19+
# Controls whether to instrument code for coverage information
20+
ARG code_coverage
21+
ENV BABEL_ENV=${code_coverage:+test}
22+
23+
RUN if [ "x$skip_frontend_build" = "x" ] ; then yarn --frozen-lockfile --network-concurrency 1; fi
24+
2825
COPY --chown=redash client /frontend/client
2926
COPY --chown=redash webpack.config.js /frontend/
30-
RUN yarn build
31-
32-
FROM frontend-builder-${FRONTEND_BUILD_MODE} as frontend-builder
27+
RUN if [ "x$skip_frontend_build" = "x" ] ; then yarn build; else mkdir -p /frontend/client/dist && touch /frontend/client/dist/multi_org.html && touch /frontend/client/dist/index.html; fi
3328

3429
FROM python:3.8-slim-bookworm
3530

@@ -66,18 +61,17 @@ RUN apt-get update && \
6661
apt-get clean && \
6762
rm -rf /var/lib/apt/lists/*
6863

69-
RUN \
70-
curl https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
71-
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg && \
72-
apt update && \
73-
ACCEPT_EULA=Y apt install -y --no-install-recommends msodbcsql18 && \
74-
apt clean && \
75-
rm -rf /var/lib/apt/lists/*
7664

7765
ARG TARGETPLATFORM
7866
ARG databricks_odbc_driver_url=https://databricks-bi-artifacts.s3.us-east-2.amazonaws.com/simbaspark-drivers/odbc/2.6.26/SimbaSparkODBC-2.6.26.1045-Debian-64bit.zip
7967
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
80-
curl "$databricks_odbc_driver_url" --location --output /tmp/simba_odbc.zip \
68+
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg \
69+
&& curl https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list \
70+
&& apt-get update \
71+
&& ACCEPT_EULA=Y apt-get install -y --no-install-recommends msodbcsql17 \
72+
&& apt-get clean \
73+
&& rm -rf /var/lib/apt/lists/* \
74+
&& curl "$databricks_odbc_driver_url" --location --output /tmp/simba_odbc.zip \
8175
&& chmod 600 /tmp/simba_odbc.zip \
8276
&& unzip /tmp/simba_odbc.zip -d /tmp/simba \
8377
&& dpkg -i /tmp/simba/*.deb \
@@ -97,8 +91,8 @@ COPY pyproject.toml poetry.lock ./
9791
ARG POETRY_OPTIONS="--no-root --no-interaction --no-ansi"
9892
# for LDAP authentication, install with `ldap3` group
9993
# disabled by default due to GPL license conflict
100-
ARG INSTALL_GROUPS="main,all_ds,dev"
101-
RUN /etc/poetry/bin/poetry install --only $INSTALL_GROUPS $POETRY_OPTIONS
94+
ARG install_groups="main,all_ds,dev"
95+
RUN /etc/poetry/bin/poetry install --only $install_groups $POETRY_OPTIONS
10296

10397
COPY --chown=redash . /app
10498
COPY --from=frontend-builder --chown=redash /frontend/client/dist /app/client/dist

Makefile

+4-20
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
.PHONY: compose_build up test_db create_database create_db clean clean-all down tests lint backend-unit-tests frontend-unit-tests pydeps test build watch start redis-cli bash
2-
3-
export COMPOSE_DOCKER_CLI_BUILD=1
4-
export DOCKER_BUILDKIT=1
5-
export COMPOSE_PROFILES=local
1+
.PHONY: compose_build up test_db create_database clean clean-all down tests lint backend-unit-tests frontend-unit-tests test build watch start redis-cli bash
62

73
compose_build: .env
8-
docker compose build
4+
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose build
95

106
up:
11-
docker compose up -d redis postgres
12-
docker compose exec -u postgres postgres psql postgres --csv \
13-
-1tqc "SELECT table_name FROM information_schema.tables WHERE table_name = 'organizations'" 2> /dev/null \
14-
| grep -q "organizations" || make create_database
15-
docker compose up -d --build
7+
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose up -d --build
168

179
test_db:
1810
@for i in `seq 1 5`; do \
@@ -21,11 +13,9 @@ test_db:
2113
done
2214
docker compose exec postgres sh -c 'psql -U postgres -c "drop database if exists tests;" && psql -U postgres -c "create database tests;"'
2315

24-
create_db: .env
16+
create_database: .env
2517
docker compose run server create_db
2618

27-
create_database: create_db
28-
2919
clean:
3020
docker compose down
3121
docker compose --project-name cypress down
@@ -54,12 +44,6 @@ env: .env
5444
format:
5545
pre-commit run --all-files
5646

57-
pydeps:
58-
pip3 install wheel
59-
pip3 install --upgrade black ruff launchpadlib pip setuptools
60-
pip3 install poetry
61-
poetry install --only main,all_ds,dev
62-
6347
tests:
6448
docker compose run server tests
6549

0 commit comments

Comments
 (0)