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

[pull] master from apache:master #110

Merged
merged 11 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
124 changes: 62 additions & 62 deletions .github/workflows/docker-ephemeral-env.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Push ephmereral env image
name: Push ephemeral env image

on:
workflow_run:
Expand All @@ -17,14 +17,14 @@ jobs:
id: check
shell: bash
run: |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if [ -n "${{ (secrets.AWS_ACCESS_KEY_ID != '' &&
secrets.AWS_ACCESS_KEY_ID != '' &&
secrets.AWS_SECRET_ACCESS_KEY != '' &&
secrets.AWS_SECRET_ACCESS_KEY != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if [ -n "${{ (secrets.AWS_ACCESS_KEY_ID != '' &&
secrets.AWS_ACCESS_KEY_ID != '' &&
secrets.AWS_SECRET_ACCESS_KEY != '' &&
secrets.AWS_SECRET_ACCESS_KEY != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

docker_ephemeral_env:
needs: config
Expand All @@ -33,66 +33,66 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: 'Download artifact'
uses: actions/github-script@v3.1.0
with:
script: |
const artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
- name: "Download artifact"
uses: actions/github-script@v3.1.0
with:
script: |
const artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});

core.info('*** artifacts')
core.info(JSON.stringify(artifacts))
core.info('*** artifacts')
core.info(JSON.stringify(artifacts))

const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "build"
})[0];
if(!matchArtifact) return core.setFailed("Build artifacts not found")
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "build"
})[0];
if(!matchArtifact) return core.setFailed("Build artifacts not found")

const download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/build.zip', Buffer.from(download.data));
const download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/build.zip', Buffer.from(download.data));

- run: unzip build.zip
- run: unzip build.zip

- name: Display downloaded files (debug)
run: ls -la
- name: Display downloaded files (debug)
run: ls -la

- name: Get SHA
id: get-sha
run: echo "::set-output name=sha::$(cat ./SHA)"
- name: Get SHA
id: get-sha
run: echo "::set-output name=sha::$(cat ./SHA)"

- name: Get PR
id: get-pr
run: echo "::set-output name=num::$(cat ./PR-NUM)"
- name: Get PR
id: get-pr
run: echo "::set-output name=num::$(cat ./PR-NUM)"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Load, tag and push image to ECR
id: push-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: superset-ci
SHA: ${{ steps.get-sha.outputs.sha }}
IMAGE_TAG: pr-${{ steps.get-pr.outputs.num }}
run: |
docker load < $SHA.tar.gz
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$SHA
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
- name: Load, tag and push image to ECR
id: push-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: superset-ci
SHA: ${{ steps.get-sha.outputs.sha }}
IMAGE_TAG: pr-${{ steps.get-pr.outputs.num }}
run: |
docker load < $SHA.tar.gz
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$SHA
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
3 changes: 2 additions & 1 deletion RESOURCES/FEATURE_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ These features are **finished** but currently being tested. They are usable, but
- DASHBOARD_EDIT_CHART_IN_NEW_TAB
- DASHBOARD_FILTERS_EXPERIMENTAL
- DASHBOARD_VIRTUALIZATION
- DRILL_BY
- DRILL_TO_DETAIL
- DYNAMIC_PLUGINS: [(docs)](https://superset.apache.org/docs/installation/running-on-kubernetes)
- ENABLE_JAVASCRIPT_CONTROLS
Expand All @@ -76,7 +77,6 @@ These features flags are **safe for production**. They have been tested and will
- ALLOW_ADHOC_SUBQUERY
- DASHBOARD_CROSS_FILTERS
- DASHBOARD_RBAC [(docs)](https://superset.apache.org/docs/creating-charts-dashboards/first-dashboard#manage-access-to-dashboards)
- DASHBOARD_NATIVE_FILTERS
- DATAPANEL_CLOSED_BY_DEFAULT
- DISABLE_LEGACY_DATASOURCE_EDITOR
- DRUID_JOINS
Expand All @@ -98,4 +98,5 @@ These features flags currently default to True and **will be removed in a future

[//]: # "PLEASE KEEP THE LIST SORTED ALPHABETICALLY"

- DASHBOARD_NATIVE_FILTERS
- GENERIC_CHART_AXES
1 change: 1 addition & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ assists people when migrating to a new version.
- [22798](https://github.com/apache/superset/pull/22798): To make the welcome page more relevant in production environments, the last tab on the welcome page has been changed from to feature all charts/dashboards the user has access to (previously only examples were shown). To keep current behavior unchanged, add the following to your `superset_config.py`: `WELCOME_PAGE_LAST_TAB = "examples"`
- [22328](https://github.com/apache/superset/pull/22328): For deployments that have enabled the "THUMBNAILS" feature flag, the function that calculates dashboard digests has been updated to consider additional properties to more accurately identify changes in the dashboard metadata. This change will invalidate all currently cached dashboard thumbnails.
- [21765](https://github.com/apache/superset/pull/21765): For deployments that have enabled the "ALERT_REPORTS" feature flag, Gamma users will no longer have read and write access to Alerts & Reports by default. To give Gamma users the ability to schedule reports from the Dashboard and Explore view like before, create an additional role with "can read on ReportSchedule" and "can write on ReportSchedule" permissions. To further give Gamma users access to the "Alerts & Reports" menu and CRUD view, add "menu access on Manage" and "menu access on Alerts & Report" permissions to the role.
- [22325](https://github.com/apache/superset/pull/22325): "RLS_FORM_QUERY_REL_FIELDS" is replaced by "RLS_BASE_RELATED_FIELD_FILTERS" feature flag. Its value format stays same.

### Potential Downtime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default function EchartsTimeseries({
const pointerEvent = eventParams.event.event;
const values = [
...(eventParams.name ? [eventParams.name] : []),
...labelMap[seriesName],
...(labelMap[seriesName] ?? []),
];
if (data && xAxis.type === AxisType.time) {
drillToDetailFilters.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import React from 'react';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { render } from 'spec/helpers/testing-library';
import { fireEvent, render } from 'spec/helpers/testing-library';
import { Store } from 'redux';
import {
initialState,
Expand Down Expand Up @@ -90,4 +90,49 @@ describe('EstimateQueryCostButton', () => {

expect(queryByText('Estimate selected query cost')).toBeTruthy();
});

it('renders estimation error result', async () => {
const { queryByText, getByText } = setup(
{},
mockStore({
...initialState,
sqlLab: {
...initialState.sqlLab,
queryCostEstimates: {
[defaultQueryEditor.id]: {
error: 'Estimate error',
},
},
},
}),
);

expect(queryByText('Estimate cost')).toBeTruthy();
fireEvent.click(getByText('Estimate cost'));

expect(queryByText('Estimate error')).toBeTruthy();
});

it('renders estimation success result', async () => {
const { queryByText, getByText } = setup(
{},
mockStore({
...initialState,
sqlLab: {
...initialState.sqlLab,
queryCostEstimates: {
[defaultQueryEditor.id]: {
completed: true,
cost: [{ 'Total cost': '1.2' }],
},
},
},
}),
);

expect(queryByText('Estimate cost')).toBeTruthy();
fireEvent.click(getByText('Estimate cost'));

expect(queryByText('Total cost')).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import configureStore from 'redux-mock-store';
import fetchMock from 'fetch-mock';
import thunk from 'redux-thunk';
import { fireEvent, render, waitFor } from 'spec/helpers/testing-library';
import { Store } from 'redux';
import { SupersetClientClass } from '@superset-ui/core';
import { initialState } from 'src/SqlLab/fixtures';

import ExploreCtasResultsButton, {
ExploreCtasResultsButtonProps,
} from 'src/SqlLab/components/ExploreCtasResultsButton';

const middlewares = [thunk];
const mockStore = configureStore(middlewares);

const getOrCreateTableEndpoint = `glob:*/superset/get_or_create_table/`;

const setup = (props: Partial<ExploreCtasResultsButtonProps>, store?: Store) =>
render(
<ExploreCtasResultsButton
table="test"
schema="test_schema"
dbId={12346}
{...props}
/>,
{
useRedux: true,
...(store && { store }),
},
);

describe('ExploreCtasResultsButton', () => {
const postFormSpy = jest.spyOn(SupersetClientClass.prototype, 'postForm');
postFormSpy.mockImplementation(jest.fn());

it('renders', async () => {
const { queryByText } = setup({}, mockStore(initialState));

expect(queryByText('Explore')).toBeTruthy();
});

it('visualize results', async () => {
const { getByText } = setup({}, mockStore(initialState));

postFormSpy.mockClear();
fetchMock.reset();
fetchMock.post(getOrCreateTableEndpoint, { table_id: 1234 });

fireEvent.click(getByText('Explore'));

await waitFor(() => {
expect(postFormSpy).toHaveBeenCalledTimes(1);
expect(postFormSpy).toHaveBeenCalledWith('http://localhost/explore/', {
form_data:
'{"datasource":"1234__table","metrics":["count"],"groupby":[],"viz_type":"table","since":"100 years ago","all_columns":[],"row_limit":1000}',
});
});
});

it('visualize results fails', async () => {
const { getByText } = setup({}, mockStore(initialState));

postFormSpy.mockClear();
fetchMock.reset();
fetchMock.post(getOrCreateTableEndpoint, {
status: 500,
body: { message: 'Unexpected all to v1 API' },
});

fireEvent.click(getByText('Explore'));

await waitFor(() => {
expect(postFormSpy).toHaveBeenCalledTimes(0);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Button from 'src/components/Button';
import { exploreChart } from 'src/explore/exploreUtils';
import { SqlLabRootState } from 'src/SqlLab/types';

interface ExploreCtasResultsButtonProps {
export interface ExploreCtasResultsButtonProps {
table: string;
schema?: string | null;
dbId: number;
Expand Down
Loading