Skip to content

Commit 8e23162

Browse files
committed
add step to build jar before image
1 parent 25a8af0 commit 8e23162

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

airbyte_cdk/utils/docker.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,20 @@ def _build_image(
6363
6464
Raises: ConnectorImageBuildError if the build fails.
6565
"""
66+
connector_name = metadata.data.dockerRepository.split("/")[-1]
6667
if metadata.data.language == ConnectorLanguage.JAVA:
6768
# For Java connectors, the context directory is the repo root.
6869
context_dir = context_dir.parent.parent.parent
70+
# For Java connectors, we need to build the connector tar file first.
71+
response: subprocess.CompletedProcess[str] = subprocess.run(
72+
[
73+
"./gradlew",
74+
f":airbyte-integrations:connectors:{connector_name}:distTar",
75+
],
76+
cwd=context_dir,
77+
text=True,
78+
check=True,
79+
)
6980

7081
docker_args: list[str] = [
7182
"docker",

airbyte_cdk/utils/docker_image_templates.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,15 @@
149149
chown airbyte:airbyte /airbyte/base.sh /airbyte/javabase.sh /airbyte/dd-java-agent.jar
150150
151151
# Set environment variables
152+
# These variables tell base.sh what to do:
152153
ENV AIRBYTE_SPEC_CMD="/airbyte/javabase.sh --spec"
153154
ENV AIRBYTE_CHECK_CMD="/airbyte/javabase.sh --check"
154155
ENV AIRBYTE_DISCOVER_CMD="/airbyte/javabase.sh --discover"
155156
ENV AIRBYTE_READ_CMD="/airbyte/javabase.sh --read"
156157
ENV AIRBYTE_WRITE_CMD="/airbyte/javabase.sh --write"
158+
159+
# base.sh will set the classpath for the connector and invoke javabase.sh
160+
# using one of the above commands.
157161
ENV AIRBYTE_ENTRYPOINT="/airbyte/base.sh"
158162
ENV APPLICATION="${CONNECTOR_KEBAB_NAME}"
159163

0 commit comments

Comments
 (0)