Skip to content

Commit

Permalink
source-google-analytics-v4: remove dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
alafanechere committed Oct 15, 2023
1 parent 49011d0 commit 50a636f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 23 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
data:
ab_internal:
ql: 400
sl: 200
allowedHosts:
hosts:
- oauth2.googleapis.com
- www.googleapis.com
- analyticsdata.googleapis.com
- analyticsreporting.googleapis.com
connectorBuildOptions:
baseImage: docker.io/airbyte/python-connector-base:1.0.0@sha256:dd17e347fbda94f7c3abff539be298a65af2d7fc27a307d89297df1081a45c27
connectorSubtype: api
connectorType: source
definitionId: eff3616a-f9c3-11eb-9a03-0242ac130003
dockerImageTag: 0.2.1
dockerImageTag: 0.2.2
dockerRepository: airbyte/source-google-analytics-v4
documentationUrl: https://docs.airbyte.com/integrations/sources/google-analytics-v4
githubIssueLabel: source-google-analytics-v4
icon: google-analytics.svg
license: Elv2
Expand All @@ -20,11 +26,7 @@ data:
oss:
enabled: true
releaseStage: generally_available
documentationUrl: https://docs.airbyte.com/integrations/sources/google-analytics-v4
supportLevel: certified
tags:
- language:python
ab_internal:
sl: 200
ql: 400
supportLevel: certified
metadataSpecVersion: "1.0"
57 changes: 56 additions & 1 deletion docs/integrations/sources/google-analytics-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,65 @@ A custom report can contain no more than 10 unique metrics. The default availabl

Incremental sync is supported only if you add `ga:date` dimension to your custom report.


## Build instructions
### Build your own connector image
This connector is built using our dynamic built process.
The base image used to build it is defined within the metadata.yaml file under the `connectorBuildOptions`.
The build logic is defined using [Dagger](https://dagger.io/) [here](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/pipelines/builds/python_connectors.py).
It does not rely on a Dockerfile.

If you would like to patch our connector and build your own a simple approach would be:

1. Create your own Dockerfile based on the latest version of the connector image.
```Dockerfile
FROM airbyte/source-google-analytics-v4:latest

COPY . ./airbyte/integration_code
RUN pip install ./airbyte/integration_code

# The entrypoint and default env vars are already set in the base image
# ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
# ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
```
Please use this as an example. This is not optimized.

2. Build your image:
```bash
docker build -t airbyte/source-google-analytics-v4:dev .
# Running the spec command against your patched connector
docker run airbyte/source-google-analytics-v4:dev spec
```

### Customizing our build process
When contributing on our connector you might need to customize the build process to add a system dependency or set an env var.
You can customize our build process by adding a `build_customization.py` module to your connector.
This module should contain a `pre_connector_install` and `post_connector_install` async function that will mutate the base image and the connector container respectively.
It will be imported at runtime by our build process and the functions will be called if they exist.

Here is an example of a `build_customization.py` module:
```python
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
# Feel free to check the dagger documentation for more information on the Container object and its methods.
# https://dagger-io.readthedocs.io/en/sdk-python-v0.6.4/
from dagger import Container


async def pre_connector_install(base_image_container: Container) -> Container:
return await base_image_container.with_env_variable("MY_PRE_BUILD_ENV_VAR", "my_pre_build_env_var_value")

async def post_connector_install(connector_container: Container) -> Container:
return await connector_container.with_env_variable("MY_POST_BUILD_ENV_VAR", "my_post_build_env_var_value")
```
## Changelog

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :------------------------------------------------------------------------------------------- |
| 0.2.2 | 2023-10-13 | [31377](https://github.com/airbytehq/airbyte/pull/31377) | Use our base image and remove Dockerfile |
| 0.2.1 | 2023-07-11 | [28149](https://github.com/airbytehq/airbyte/pull/28149) | Specify date format to support datepicker in UI |
| 0.2.0 | 2023-06-26 | [27738](https://github.com/airbytehq/airbyte/pull/27738) | License Update: Elv2 |
| 0.1.36 | 2023-04-13 | [22223](https://github.com/airbytehq/airbyte/pull/22223) | Fix custom report with Segments dimensions |
Expand Down Expand Up @@ -226,4 +281,4 @@ Incremental sync is supported only if you add `ga:date` dimension to your custom
| 0.1.3 | 2021-09-21 | [6357](https://github.com/airbytehq/airbyte/pull/6357) | Fix OAuth workflow parameters |
| 0.1.2 | 2021-09-20 | [6306](https://github.com/airbytehq/airbyte/pull/6306) | Support of Airbyte OAuth initialization flow |
| 0.1.1 | 2021-08-25 | [5655](https://github.com/airbytehq/airbyte/pull/5655) | Corrected validation of empty custom report |
| 0.1.0 | 2021-08-10 | [5290](https://github.com/airbytehq/airbyte/pull/5290) | Initial Release |
| 0.1.0 | 2021-08-10 | [5290](https://github.com/airbytehq/airbyte/pull/5290) | Initial Release |

0 comments on commit 50a636f

Please sign in to comment.