Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M23 rebase #3936

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
42b438d
In docker-entrypoint ensure tables exist
Apr 12, 2017
45c007c
Update Circle CI for our workflow
robotblake Apr 19, 2017
9e976f8
Add migrations-graph helper script.
jezdez May 20, 2019
cfc8ac6
Switch to PyMySQL for MySQL 5.7 support
Sep 14, 2017
e687f91
Don't execute query when changing data sources (fixes #29)
Feb 10, 2017
900d674
Add compare query version support (re #7)
spasovski Feb 6, 2017
9f489f5
Filter tables from schema browser (re #31)
Jul 9, 2018
d52b90a
Merge mozilla schema updates with schema from master
Dec 12, 2017
e635b3c
merge upstream db changes
Feb 14, 2018
3f352b8
Properly rollback failed db commits
Mar 21, 2018
2b1ff56
Install redash-stmo.
jezdez Feb 28, 2018
26b4ca5
Unique names for query parameters (re #164)
Jan 16, 2018
18055cc
Closes #396: Integration with Flower.
May 11, 2018
cd79722
Use production build of react when deployed (fixes #606)
Nov 9, 2018
ea1ab65
Enable documentation links and versions of data sources (re #6).
Nov 8, 2016
3b54439
Show query results for execution after changing data sources (re #29)…
Jan 29, 2019
f42e8a1
Aggregate query results (re #35) (#339)
Mar 26, 2019
41a70d1
Add empty migration to replace the removed schedule_until migration
Mar 25, 2019
af72a2a
Add merge migration.
Mar 26, 2019
eee3e6c
Schema Viewer Drawer (#3291)
Jul 28, 2017
ed3d67e
Schema Improvements Part 2: Add data source config options.
Nov 1, 2018
b1412ad
Schema Improvements Part 2: Rebase Commit.
May 14, 2019
156ecb0
Adding BigQuery schema drawer with data types and samples.
Apr 30, 2019
4d800d8
Reprocess tables with empty samples sooner.
May 10, 2019
25adf75
Fix query id in parameter querystring names (fixes #942) (#969)
Jun 26, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 60 additions & 41 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,42 +61,18 @@ jobs:
steps:
- checkout
- run: sudo apt install python-pip
- run: sudo pip install -r requirements_bundles.txt
- run: sudo pip install -r requirements_bundles.txt -r requirements.txt
- run: npm install
- run: npm run bundle
- run: npm test
- run: npm run lint
frontend-e2e-tests:
environment:
COMPOSE_FILE: .circleci/docker-compose.cypress.yml
COMPOSE_PROJECT_NAME: cypress
PERCY_TOKEN_ENCODED: ZGRiY2ZmZDQ0OTdjMzM5ZWE0ZGQzNTZiOWNkMDRjOTk4Zjg0ZjMxMWRmMDZiM2RjOTYxNDZhOGExMjI4ZDE3MA==
CYPRESS_PROJECT_ID_ENCODED: OTI0Y2th
CYPRESS_RECORD_KEY_ENCODED: YzA1OTIxMTUtYTA1Yy00NzQ2LWEyMDMtZmZjMDgwZGI2ODgx
docker:
- image: circleci/node:8
steps:
- setup_remote_docker
- checkout
- run:
name: Install npm dependencies
command: |
npm install
- run:
name: Setup Redash server
command: |
npm run cypress start
docker-compose run cypress npm run cypress db-seed
- run:
name: Execute Cypress tests
command: npm run cypress run-ci
build-tarball:
docker:
- image: circleci/node:8
steps:
- checkout
- run: sudo apt install python-pip
- run: sudo pip install -r requirements_bundles.txt
- run: sudo pip install -r requirements_bundles.txt -r requirements.txt
- run: npm install
- run: .circleci/update_version
- run: npm run bundle
Expand All @@ -107,47 +83,90 @@ jobs:
path: /tmp/artifacts/
build-docker-image:
docker:
- image: circleci/node:8
- image: circleci/buildpack-deps:xenial
steps:
- setup_remote_docker
- checkout
- run: sudo apt install python-pip
- run: sudo pip install -r requirements_bundles.txt
- run: .circleci/update_version
- run: sudo apt install python-pip npm
- run: sudo pip install -r requirements_bundles.txt -r requirements.txt
- run: .circleci/update_version "master"
- run: npm run bundle
- run: .circleci/docker_build
- run: .circleci/docker_build "master"
build-docker-image-rc:
docker:
- image: circleci/buildpack-deps:xenial
steps:
- setup_remote_docker
- checkout
- run: sudo apt install python-pip npm
- run: sudo pip install -r requirements_bundles.txt -r requirements.txt
- run: .circleci/update_version "rc"
- run: npm run bundle
- run: .circleci/docker_build "rc"
build-docker-image-tag:
docker:
- image: circleci/buildpack-deps:xenial
steps:
- setup_remote_docker
- checkout
- run: sudo apt install python-pip npm
- run: sudo pip install -r requirements_bundles.txt -r requirements.txt
- run: .circleci/update_version "$CIRCLE_TAG"
- run: npm run bundle
- run: .circleci/docker_build "$CIRCLE_TAG"
# Create alias from tag to "latest":
- run: docker tag $DOCKERHUB_REPO:$CIRCLE_TAG $DOCKERHUB_REPO:latest
- run: docker push $DOCKERHUB_REPO:latest
workflows:
version: 2
build:
jobs:
- python-flake8-tests
- legacy-python-flake8-tests
- backend-unit-tests
- frontend-lint
- backend-unit-tests:
filters:
tags:
only: /^m[0-9]+(\.[0-9]+)?$/
- frontend-lint:
filters:
tags:
only: /^m[0-9]+(\.[0-9]+)?$/
- frontend-unit-tests:
requires:
- frontend-lint
- frontend-e2e-tests:
requires:
- frontend-lint
filters:
tags:
only: /^m[0-9]+(\.[0-9]+)?$/
- build-tarball:
requires:
- backend-unit-tests
- frontend-unit-tests
- frontend-e2e-tests
filters:
branches:
only:
- master
- /release\/.*/
- build-docker-image:
requires:
- backend-unit-tests
- frontend-unit-tests
- frontend-e2e-tests
filters:
branches:
only:
- master
- preview-image
- /release\/.*/
- build-docker-image-rc:
requires:
- backend-unit-tests
- frontend-unit-tests
filters:
branches:
only:
- release
- build-docker-image-tag:
requires:
- backend-unit-tests
- frontend-unit-tests
filters:
branches:
ignore: /.*/
tags:
only: /^m[0-9]+(\.[0-9]+)?$/
14 changes: 3 additions & 11 deletions .circleci/docker_build
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/bin/bash
VERSION=$(jq -r .version package.json)
VERSION_TAG=$VERSION.b$CIRCLE_BUILD_NUM
VERSION_TAG="$1"

docker login -u $DOCKER_USER -p $DOCKER_PASS

if [ $CIRCLE_BRANCH = master ] || [ $CIRCLE_BRANCH = preview-image ]
then
docker build -t redash/redash:preview -t redash/preview:$VERSION_TAG .
docker push redash/redash:preview
docker push redash/preview:$VERSION_TAG
else
docker build -t redash/redash:$VERSION_TAG .
docker push redash/redash:$VERSION_TAG
fi
docker build -t $DOCKERHUB_REPO:$VERSION_TAG .
docker push $DOCKERHUB_REPO:$VERSION_TAG

echo "Built: $VERSION_TAG"
5 changes: 4 additions & 1 deletion .circleci/update_version
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
MOZILLA_VERSION="$1"
bin/dockerflow-version "$MOZILLA_VERSION"

VERSION=$(jq -r .version package.json)
FULL_VERSION=$VERSION+b$CIRCLE_BUILD_NUM
FULL_VERSION=$VERSION+b$CIRCLE_BUILD_NUM-$MOZILLA_VERSION

sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '$FULL_VERSION'/" redash/__init__.py
sed -i "s/dev/$CIRCLE_SHA1/" client/app/version.json
4 changes: 2 additions & 2 deletions bin/bundle-extensions
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def load_bundles():
setup(
# ...
entry_points={
"redash.bundles": [
"redash.extensions": [
"wide_footer = my_extensions.wide_footer",
]
# ...
Expand All @@ -78,7 +78,7 @@ def load_bundles():

"""
bundles = odict()
for entry_point in entry_points().get("redash.bundles", []):
for entry_point in entry_points().get("redash.extensions", []):
logger.info('Loading Redash bundle "%s".', entry_point.name)
module = entry_point_module(entry_point)
# Try to get a list of bundle files
Expand Down
3 changes: 3 additions & 0 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -e

worker() {
/app/manage.py db upgrade
WORKERS_COUNT=${WORKERS_COUNT:-2}
QUEUES=${QUEUES:-queries,scheduled_queries,celery,schemas}
WORKER_EXTRA_OPTIONS=${WORKER_EXTRA_OPTIONS:-}
Expand All @@ -11,6 +12,7 @@ worker() {
}

scheduler() {
/app/manage.py db upgrade
WORKERS_COUNT=${WORKERS_COUNT:-1}
QUEUES=${QUEUES:-celery}
SCHEDULE_DB=${SCHEDULE_DB:-celerybeat-schedule}
Expand All @@ -21,6 +23,7 @@ scheduler() {
}

server() {
/app/manage.py db upgrade
exec /usr/local/bin/gunicorn -b 0.0.0.0:5000 --name redash -w${REDASH_WEB_WORKERS:-4} redash.wsgi:app
}

Expand Down
13 changes: 13 additions & 0 deletions bin/dockerflow-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -eo pipefail

VERSION="$1"

printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n' \
"$CIRCLE_SHA1" \
"$VERSION" \
"$CIRCLE_PROJECT_USERNAME" \
"$CIRCLE_PROJECT_REPONAME" \
"$CIRCLE_BUILD_URL" \
> version.json
87 changes: 87 additions & 0 deletions bin/migrations-graph
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env python
"""
A quick helper script to print the Alembic migration history
via Graphiz and show it via GraphvizOnline on
https://dreampuf.github.io/GraphvizOnline/.

This requires the Graphviz Python library:

$ pip install --user graphviz

Then run it with the path to the Alembic config file:

$ migrations-graph --config migrations/alembic.ini

"""
import os
import sys
import urllib

import click
from alembic import util
from alembic.script import ScriptDirectory
from alembic.config import Config
from alembic.util import CommandError
from graphviz import Digraph

# Make sure redash can be imported in the migration files
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))


def get_revisions(config, rev_range=None):
script = ScriptDirectory.from_config(config)

if rev_range is not None:
if ":" not in rev_range:
raise util.CommandError(
"History range requires [start]:[end], [start]:, or :[end]"
)
base, head = rev_range.strip().split(":")
else:
base = head = None

return script.walk_revisions(base=base or "base", head=head or "heads")


def generate_revision_graph(revisions):
dot = Digraph()
for revision in revisions:
dot.node(revision.revision)
if revision.down_revision is None:
dot.edge("base", revision.revision)
continue
if isinstance(revision.down_revision, basestring):
dot.edge(revision.down_revision, revision.revision)
continue
for down_revision in revision.down_revision:
dot.edge(down_revision, revision.revision)
return dot


@click.command()
@click.option("--config", default="alembic.ini", help="path to alembic config file")
@click.option("--name", default="alembic", help="name of the alembic ini section")
def cli(config, name):
"""
Generates a simple Graphviz dot file and creates a link to
view it online via https://dreampuf.github.io/GraphvizOnline/.
"""
alembic_config = Config(file_=config, ini_section=name)
try:
revisions = get_revisions(alembic_config)
except CommandError as e:
sys.exit(e)

dot = generate_revision_graph(revisions)
encoded_dot = urllib.quote(str(dot.source))
viz_url = "https://dreampuf.github.io/GraphvizOnline/#%s" % encoded_dot
data = urllib.urlencode({"url": viz_url})
try:
url = urllib.urlopen("https://git.io/", data).headers["location"]
except KeyError:
sys.exit("Must be a github.com URL.")
print("Generated graph for migration history in %s: %s " % (config, url))


if __name__ == "__main__":
cli()
1 change: 1 addition & 0 deletions client/app/assets/less/ant.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@import '~antd/lib/radio/style/index';
@import '~antd/lib/time-picker/style/index';
@import '~antd/lib/pagination/style/index';
@import '~antd/lib/drawer/style/index';
@import '~antd/lib/table/style/index';
@import '~antd/lib/popover/style/index';
@import '~antd/lib/icon/style/index';
Expand Down
14 changes: 9 additions & 5 deletions client/app/assets/less/inc/schema-browser.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ div.table-name {
border-radius: @redash-radius;
position: relative;

.copy-to-editor {
.copy-to-editor, .info {
display: none;
}

&:hover {
background: fade(@redash-gray, 10%);

.copy-to-editor {
.copy-to-editor, .info {
display: flex;
}
}
Expand All @@ -36,7 +36,7 @@ div.table-name {
background: transparent;
}

.copy-to-editor {
.copy-to-editor, .info {
color: fade(@redash-gray, 90%);
cursor: pointer;
position: absolute;
Expand All @@ -49,21 +49,25 @@ div.table-name {
justify-content: center;
}

.info {
right: 20px
}

.table-open {
padding: 0 22px 0 26px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
position: relative;

.copy-to-editor {
.copy-to-editor, .info {
display: none;
}

&:hover {
background: fade(@redash-gray, 10%);

.copy-to-editor {
.copy-to-editor, .info {
display: flex;
}
}
Expand Down
Loading