Skip to content

Commit

Permalink
🎉 Sources Appstore Singer: refactor to use the cdk
Browse files Browse the repository at this point in the history
* Source Appstore Singer #7652 - migrate to the CDK

* Source Kustomer #7652 - remove deprecated dependencies

* Source Kustomer #7652 - undo remove deprecated dependencies

* Source Appstore #7652 - refactor

* Source Appstore #7652 - refactor

* Source Appstore #7652 - bump version

* Source Appstore #7652 - fix build

* Source Appstore #7652 - updating dependencies
  • Loading branch information
vitaliizazmic authored Dec 9, 2021
1 parent fe55cab commit 3d7e62d
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"sourceDefinitionId": "2af123bf-0aaf-4e0d-9784-cb497f23741a",
"name": "Appstore",
"dockerRepository": "airbyte/source-appstore-singer",
"dockerImageTag": "0.2.4",
"dockerImageTag": "0.2.5",
"documentationUrl": "https://docs.airbyte.io/integrations/sources/appstore",
"icon": "appstore.svg"
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
- name: Appstore
sourceDefinitionId: 2af123bf-0aaf-4e0d-9784-cb497f23741a
dockerRepository: airbyte/source-appstore-singer
dockerImageTag: 0.2.4
dockerImageTag: 0.2.5
documentationUrl: https://docs.airbyte.io/integrations/sources/appstore
icon: appstore.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-appstore-singer:0.2.4"
- dockerImage: "airbyte/source-appstore-singer:0.2.5"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/sources/appstore"
connectionSpecification:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*
!Dockerfile
!Dockerfile.test
!main.py
!source_appstore_singer
!setup.py
!secrets
43 changes: 32 additions & 11 deletions airbyte-integrations/connectors/source-appstore-singer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
FROM airbyte/integration-base-singer: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 git && 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 libffi-dev openssl-dev

ENV CODE_PATH="source_appstore_singer"
ENV AIRBYTE_IMPL_MODULE="source_appstore_singer"
ENV AIRBYTE_IMPL_PATH="SourceAppstoreSinger"
ENV AIRBYTE_ENTRYPOINT "/airbyte/base.sh"

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_appstore_singer ./source_appstore_singer

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

LABEL io.airbyte.version=0.2.4
LABEL io.airbyte.version=0.2.5
LABEL io.airbyte.name=airbyte/source-appstore-singer

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
plugins {
id 'airbyte-python'
id 'airbyte-docker'
// id 'airbyte-standard-source-test-file'
}

airbytePython {
moduleDirectory 'source_appstore_singer'
}

// https://github.com/airbytehq/airbyte/issues/1651
//airbyteStandardSourceTestFile {
// // For more information on standard source tests, see https://docs.airbyte.io/connector-development/testing-connectors
// specPath = "source_appstore_singer/spec.json"
// configPath = "secrets/config.json"
// configuredCatalogPath = "sample_files/configured_catalog.json"
//}

dependencies {
implementation files(project(':airbyte-integrations:bases:base-standard-source-test-file').airbyteDocker.outputs)
implementation files(project(':airbyte-integrations:bases:base-singer').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_appstore_singer import SourceAppstoreSinger

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# 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-singer
-e ../../bases/base-python
-e .
27 changes: 17 additions & 10 deletions airbyte-integrations/connectors/source-appstore-singer/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@

from setuptools import find_packages, setup

MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1",
"appstoreconnect==0.9.0",
"pyjwt==1.6.4",
"tap-appstore @ https://github.com/airbytehq/tap-appstore/tarball/v0.2.1-airbyte",
]

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

setup(
name="source_appstore_singer",
description="Source implementation for Appstore, built on the Singer tap implementation.",
author="Airbyte",
author_email="[email protected]",
packages=find_packages(),
install_requires=[
"airbyte-protocol",
"appstoreconnect==0.9.0",
"base-singer",
"base-python",
"pyjwt==1.6.4", # required by appstore connect
"pytest==6.1.2",
"tap-appstore @ https://github.com/airbytehq/tap-appstore/tarball/v0.2.1-airbyte",
],
package_data={"": ["*.json"]},
install_requires=MAIN_REQUIREMENTS,
package_data={"": ["*.json", "schemas/*.json", "schemas/shared/*.json"]},
extras_require={
"tests": TEST_REQUIREMENTS,
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
from datetime import date, timedelta
from typing import Dict

from airbyte_protocol import AirbyteConnectionStatus
from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.models import Status, SyncMode
from airbyte_cdk.models.airbyte_protocol import AirbyteConnectionStatus
from airbyte_cdk.sources.singer.singer_helpers import SyncModeInfo
from airbyte_cdk.sources.singer.source import SingerSource
from appstoreconnect import Api
from base_python import AirbyteLogger
from base_singer import SingerSource, Status, SyncMode, SyncModeInfo


class SourceAppstoreSinger(SingerSource):
Expand Down
7 changes: 4 additions & 3 deletions docs/integrations/sources/appstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ Generate/Find all requirements using this [external article](https://leapfin.com

## Changelog

| Version | Date | Pull Request | Subject |
| :--- | :--- | :--- | :--- |
| 0.2.4 | 2021-07-06 | [4539](https://github.com/airbytehq/airbyte/pull/4539) | Add `AIRBYTE_ENTRYPOINT` for Kubernetes support |
| Version | Date | Pull Request | Subject |
|:--------|:-----------| :--- |:------------------------------------------------|
| 0.2.5 | 2021-12-09 | [7757](https://github.com/airbytehq/airbyte/pull/7757) | Migrate to the CDK |
| 0.2.4 | 2021-07-06 | [4539](https://github.com/airbytehq/airbyte/pull/4539) | Add `AIRBYTE_ENTRYPOINT` for Kubernetes support |

0 comments on commit 3d7e62d

Please sign in to comment.