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

build(deps): bump werkzeug from 2.2.3 to 2.3.8 in /docker/datahub-ingestion-base #32

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
80 changes: 80 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
kind: pipeline
name: default

anchors:
build_frontend: &build_frontend
image: gradle:jdk11
commands:
- cd "/drone/src/$${ENVIRONMENT}"
- sed -i "s/<AMPLITUDE_API_KEY>/$AMPLITUDE_API_KEY/g" datahub-web-react/src/conf/analytics.ts
- cat datahub-web-react/src/conf/analytics.ts
- ./gradlew :datahub-frontend:dist -x test -x yarnTest -x yarnLint --parallel
- ls -la ./datahub-frontend/build/distributions/
- mv ./datahub-frontend/build/distributions/datahub-frontend-*.zip datahub-frontend.zip
depends_on:
- setup

docker_build_config: &docker_build_config
image: plugins/ecr
environment:
ARTIFACTORY_PASSWORD:
from_secret: ARTIFACTORY_PASSWORD
ARTIFACTORY_USER:
from_secret: ARTIFACTORY_USER
GITHUB_TOKEN:
from_secret: GITHUB_TOKEN
settings:
create_repository: true
region: eu-west-1
assume_role: arn:aws:iam::131063299351:role/automation-drone
repository_policy: .ecr-repository-policy.json
repo: datahub-frontend
custom_labels:
- "[email protected]"
cache_from:
- 131063299351.dkr.ecr.eu-west-1.amazonaws.com/datahub-frontend:${DRONE_BRANCH//\//-}
build_args_from_env:
- ARTIFACTORY_PASSWORD
- ARTIFACTORY_USER
- GITHUB_TOKEN

steps:
- name: setup
image: ubuntu
commands:
- mv /drone/src/* /tmp/
- mkdir -p /drone/src/staging/ /drone/src/production/
- cp -r /tmp/* /drone/src/staging/
- cp -r /tmp/* /drone/src/production/

- name: build_frontend_staging
<<: *build_frontend
environment:
ENVIRONMENT: staging
AMPLITUDE_API_KEY: b46a366c22a2e7fb525ae99c14a693ec

- name: build_frontend_production
<<: *build_frontend
environment:
ENVIRONMENT: production
AMPLITUDE_API_KEY: f0b9cf5c530426c3dbacb91e74f009a5

- name: docker_frontend_staging
<<: *docker_build_config
settings:
context: /drone/src/staging/
dockerfile: /drone/src/staging/docker/datahub-frontend/Dockerfile
tags:
- staging
depends_on:
- build_frontend_staging

- name: docker_frontend_production
<<: *docker_build_config
settings:
context: /drone/src/production/
dockerfile: /drone/src/production/docker/datahub-frontend/Dockerfile
tags:
- production
depends_on:
- build_frontend_production
22 changes: 22 additions & 0 deletions .ecr-repository-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ECR Repository Policy",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"ecr:BatchCheckLayerAvailability",
"ecr:BatchGetImage",
"ecr:GetDownloadUrlForLayer"
],
"Condition": {
"StringEquals": {
"aws:PrincipalOrgID": "o-t9bcvmrskg"
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -111,6 +111,7 @@ private List<Highlight> getHighlights() {
getEntityMetadataStats("Pipelines", EntityType.DATA_FLOW).ifPresent(highlights::add);
getEntityMetadataStats("Tasks", EntityType.DATA_JOB).ifPresent(highlights::add);
getEntityMetadataStats("Domains", EntityType.DOMAIN).ifPresent(highlights::add);
getEntityMetadataStats("Data Products", EntityType.DATA_PRODUCT).ifPresent(highlights::add);
return highlights;
}

3 changes: 2 additions & 1 deletion datahub-web-react/src/app/analytics/analytics.ts
Original file line number Diff line number Diff line change
@@ -18,11 +18,12 @@ const { NODE_ENV } = process.env;

export function getMergedTrackingOptions(options?: any) {
const isThirdPartyLoggingEnabled = JSON.parse(localStorage.getItem(THIRD_PARTY_LOGGING_KEY) || 'false');

return {
...options,
plugins: {
mixpanel: isThirdPartyLoggingEnabled,
amplitude: isThirdPartyLoggingEnabled,
amplitude: true, // Only want amplitude so hard-code true. We hard code the API keys too, so 🤷
googleAnalytics: isThirdPartyLoggingEnabled,
},
};
10 changes: 9 additions & 1 deletion datahub-web-react/src/app/analytics/plugin/amplitude.ts
Original file line number Diff line number Diff line change
@@ -7,5 +7,13 @@ const apiKey = isEnabled ? amplitudeConfigs.apiKey : undefined;

export default {
isEnabled,
plugin: apiKey && amplitude({ apiKey, options: {} }),
plugin:
apiKey &&
amplitude({
apiKey,
options: {
apiEndpoint: 'api.eu.amplitude.com',
serverZone: 'EU',
},
}),
};
16 changes: 16 additions & 0 deletions datahub-web-react/src/app/context/UserContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import { useGetMeLazyQuery } from '../../graphql/me.generated';
import { useGetGlobalViewsSettingsLazyQuery } from '../../graphql/app.generated';
import { CorpUser, PlatformPrivileges } from '../../types.generated';
import { UserContext, LocalState, DEFAULT_STATE, State } from './userContext';
import analytics from '../analytics';

// TODO: Migrate all usage of useAuthenticatedUser to using this provider.

@@ -41,6 +42,21 @@ const UserContextProvider = ({ children }: { children: React.ReactNode }) => {
const [getMe, { data: meData, refetch }] = useGetMeLazyQuery({ fetchPolicy: 'cache-first' });
useEffect(() => getMe(), [getMe]);

/**
* Identify the user in the analytics tool once on component mount.
* This lets Amplitude identify (and thus segment) the users on more attributes.
* There may be a more optimal place to put this call, but I'm not sure
*/
useEffect(() => {
if (meData?.me?.corpUser) {
const corpUser = meData.me.corpUser as CorpUser;
const info = corpUser.info ?? {};
analytics.identify(corpUser.urn, {
...info,
});
}
}, [meData]);

/**
* Retrieve the Global View settings once on component mount.
*/
8 changes: 4 additions & 4 deletions datahub-web-react/src/conf/analytics.ts
Original file line number Diff line number Diff line change
@@ -6,10 +6,10 @@ const config: any = {
// mixpanel: {
// token: 'fad1285da4e618b618973cacf6565e61',
// },
// amplitude: {
// apiKey: 'c5c212632315d19c752ab083bc7c92ff',
// },
// logging: true,
amplitude: {
apiKey: '<AMPLITUDE_API_KEY>',
},
logging: true,
datahub: {
enabled: true,
},
2 changes: 1 addition & 1 deletion docker/datahub-ingestion-base/base-requirements.txt
Original file line number Diff line number Diff line change
@@ -370,7 +370,7 @@ wcwidth==0.2.6
webencodings==0.5.1
websocket-client==1.5.2
websockets==11.0.3
Werkzeug==2.2.3
Werkzeug==2.3.8
widgetsnbextension==4.0.7
wrapt==1.15.0
WTForms==3.0.1
Original file line number Diff line number Diff line change
@@ -23,4 +23,5 @@ public class TelemetryConfiguration {
* Whether or not server telemetry should be enabled
*/
public boolean enabledServer;
}

}