Skip to content

Commit

Permalink
Source Google Workspace Admin Reports #7531 - migrate to the CDK
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliizazmic committed Nov 4, 2021
1 parent 85381bd commit 42a4944
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*
!Dockerfile
!Dockerfile.test
!main.py
!source_google_workspace_admin_reports
!setup.py
!secrets
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
FROM airbyte/integration-base-python:0.1.1
FROM python:3.7.11-alpine3.14 as base

# Bash is installed for more convenient debugging.
RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/*
# build and load all requirements
FROM base as builder
WORKDIR /airbyte/integration_code

# upgrade pip to the latest version
RUN apk --no-cache upgrade \
&& pip install --upgrade pip \
&& apk --no-cache add tzdata build-base

ENV CODE_PATH="source_google_workspace_admin_reports"
ENV AIRBYTE_IMPL_MODULE="source_google_workspace_admin_reports"
ENV AIRBYTE_IMPL_PATH="SourceGoogleWorkspaceAdminReports"

WORKDIR /airbyte/integration_code
COPY $CODE_PATH ./$CODE_PATH
COPY setup.py ./
RUN pip install .
# install necessary packages to a temporary folder
RUN pip install --prefix=/install .

# build a clean environment
FROM base
WORKDIR /airbyte/integration_code

# copy all loaded and built libraries to a pure basic image
COPY --from=builder /install /usr/local
# add default timezone settings
COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime
RUN echo "Etc/UTC" > /etc/timezone

# bash is installed for more convenient debugging.
RUN apk --no-cache add bash

# copy payload code only
COPY main.py ./
COPY source_google_workspace_admin_reports ./source_google_workspace_admin_reports

ENV AIRBYTE_ENTRYPOINT "/airbyte/base.sh"
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.5
LABEL io.airbyte.name=airbyte/source-google-workspace-admin-reports
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ airbytePython {
moduleDirectory 'source_google_workspace_admin_reports'
}

dependencies {
implementation files(project(':airbyte-integrations:bases:source-acceptance-test').airbyteDocker.outputs)
implementation files(project(':airbyte-integrations:bases:base-python').airbyteDocker.outputs)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import sys

from base_python.entrypoint import launch
from airbyte_cdk.entrypoint import launch
from source_google_workspace_admin_reports import SourceGoogleWorkspaceAdminReports

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This file is autogenerated -- only edit if you know what you are doing. Use setup.py for declaring dependencies.
-e ../../bases/airbyte-protocol
-e ../../bases/base-python
-e ../../bases/source-acceptance-test
-e .
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@

from setuptools import find_packages, setup

MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1",
"google-api-python-client==2.0.2",
"google-auth-httplib2==0.1.0",
"google-auth-oauthlib==0.4.3",
"backoff==1.10.0",
"pendulum==2.1.2",
]

TEST_REQUIREMENTS = [
"pytest~=6.1",
"pytest-mock~=3.6.1",
"source-acceptance-test",
]

Expand All @@ -16,16 +26,8 @@
author="Airbyte",
author_email="[email protected]",
packages=find_packages(),
install_requires=[
"airbyte-protocol",
"base-python",
"google-api-python-client==2.0.2",
"google-auth-httplib2==0.1.0",
"google-auth-oauthlib==0.4.3",
"backoff==1.10.0",
"pendulum==2.1.2",
],
package_data={"": ["*.json", "schemas/*.json"]},
install_requires=MAIN_REQUIREMENTS,
package_data={"": ["*.json", "schemas/*.json", "schemas/shared/*.json"]},
extras_require={
"tests": TEST_REQUIREMENTS,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import backoff
import pendulum
import pytz
from base_python.entrypoint import logger
from airbyte_cdk.entrypoint import logger
from google.oauth2 import service_account
from googleapiclient.discovery import Resource, build
from googleapiclient.errors import HttpError as GoogleApiHttpError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from typing import Any, Mapping, Optional, Tuple

from base_python import BaseClient
from airbyte_cdk.sources.deprecated.client import BaseClient

from .api import API, AdminAPI, DriveAPI, IncrementalStreamAPI, LoginsAPI, MobileAPI, OAuthTokensAPI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#


from base_python import BaseSource
from airbyte_cdk.sources.deprecated.base_source import BaseSource

from .client import Client

Expand Down

0 comments on commit 42a4944

Please sign in to comment.