diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000000000..e70f8a4f5e379 --- /dev/null +++ b/.drone.yml @@ -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/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: + - "org.fundingcircle.image.manager=data-platform@fundingcircle.com" + 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 diff --git a/.ecr-repository-policy.json b/.ecr-repository-policy.json new file mode 100644 index 0000000000000..0c911601a6c02 --- /dev/null +++ b/.ecr-repository-policy.json @@ -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" + } + } + } + ] + } diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/analytics/resolver/GetHighlightsResolver.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/analytics/resolver/GetHighlightsResolver.java index c631a13b0bcb6..18cd0d7b1672f 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/analytics/resolver/GetHighlightsResolver.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/analytics/resolver/GetHighlightsResolver.java @@ -111,6 +111,7 @@ private List 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; } diff --git a/datahub-web-react/src/app/analytics/analytics.ts b/datahub-web-react/src/app/analytics/analytics.ts index a66d76a09cf4d..2e2fc3c7cce8f 100644 --- a/datahub-web-react/src/app/analytics/analytics.ts +++ b/datahub-web-react/src/app/analytics/analytics.ts @@ -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, }, }; diff --git a/datahub-web-react/src/app/analytics/plugin/amplitude.ts b/datahub-web-react/src/app/analytics/plugin/amplitude.ts index e6346a02e9acd..4cc004032dfe8 100644 --- a/datahub-web-react/src/app/analytics/plugin/amplitude.ts +++ b/datahub-web-react/src/app/analytics/plugin/amplitude.ts @@ -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', + }, + }), }; diff --git a/datahub-web-react/src/app/context/UserContextProvider.tsx b/datahub-web-react/src/app/context/UserContextProvider.tsx index 3bcff15cc2748..1353b195b0b47 100644 --- a/datahub-web-react/src/app/context/UserContextProvider.tsx +++ b/datahub-web-react/src/app/context/UserContextProvider.tsx @@ -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. */ diff --git a/datahub-web-react/src/conf/analytics.ts b/datahub-web-react/src/conf/analytics.ts index 2506ec408b5ba..975a56fac1cec 100644 --- a/datahub-web-react/src/conf/analytics.ts +++ b/datahub-web-react/src/conf/analytics.ts @@ -6,10 +6,10 @@ const config: any = { // mixpanel: { // token: 'fad1285da4e618b618973cacf6565e61', // }, - // amplitude: { - // apiKey: 'c5c212632315d19c752ab083bc7c92ff', - // }, - // logging: true, + amplitude: { + apiKey: '', + }, + logging: true, datahub: { enabled: true, }, diff --git a/docker/datahub-ingestion-base/base-requirements.txt b/docker/datahub-ingestion-base/base-requirements.txt index 82d9a93a9a2c3..4caa6c15d262f 100644 --- a/docker/datahub-ingestion-base/base-requirements.txt +++ b/docker/datahub-ingestion-base/base-requirements.txt @@ -162,7 +162,7 @@ jsonpatch==1.32 jsonpointer==2.3 jsonref==1.1.0 jsonschema==4.17.3 -jupyter-server==1.24.0 +jupyter-server==2.11.2 jupyter_client==7.4.9 jupyter_core==4.12.0 jupyterlab-pygments==0.2.2 diff --git a/metadata-service/configuration/src/main/java/com/linkedin/metadata/config/telemetry/TelemetryConfiguration.java b/metadata-service/configuration/src/main/java/com/linkedin/metadata/config/telemetry/TelemetryConfiguration.java index 3821cbbed83e8..fb807a2495361 100644 --- a/metadata-service/configuration/src/main/java/com/linkedin/metadata/config/telemetry/TelemetryConfiguration.java +++ b/metadata-service/configuration/src/main/java/com/linkedin/metadata/config/telemetry/TelemetryConfiguration.java @@ -23,4 +23,5 @@ public class TelemetryConfiguration { * Whether or not server telemetry should be enabled */ public boolean enabledServer; -} \ No newline at end of file + +}