Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated normalization version for postgres destination #15397

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airbyte-integrations/bases/base-normalization/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ WORKDIR /airbyte
ENV AIRBYTE_ENTRYPOINT "/airbyte/entrypoint.sh"
ENTRYPOINT ["/airbyte/entrypoint.sh"]

LABEL io.airbyte.version=0.2.16
LABEL io.airbyte.version=0.2.17
LABEL io.airbyte.name=airbyte/normalization
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import pkgutil
import socket
import subprocess
from typing import Any, Dict

import yaml
Expand Down Expand Up @@ -64,6 +65,13 @@ def transform(self, integration_type: DestinationType, config: Dict[str, Any]):

return base_profile

@staticmethod
def create_file(name, content):
f = open(name, "x")
f.write(content)
f.close()
return os.path.abspath(f.name)

@staticmethod
def is_ssh_tunnelling(config: Dict[str, Any]) -> bool:
tunnel_methods = ["SSH_KEY_AUTH", "SSH_PASSWORD_AUTH"]
Expand Down Expand Up @@ -167,9 +175,19 @@ def transform_postgres(config: Dict[str, Any]):
"threads": 8,
}

# if unset, we assume true.
if config.get("ssl", True):
config["sslmode"] = "require"
ssl = config.get("ssl")
if ssl:
ssl_mode = config.get("ssl_mode", "allow")
dbt_config["sslmode"] = ssl_mode.get("mode")
if ssl_mode["mode"] == "verify-ca":
TransformConfig.create_file("ca.crt", ssl_mode["ca_certificate"])
dbt_config["sslrootcert"] = "ca.crt"
elif ssl_mode["mode"] == "verify-full":
dbt_config["sslrootcert"] = TransformConfig.create_file("ca.crt", ssl_mode["ca_certificate"])
dbt_config["sslcert"] = TransformConfig.create_file("client.crt", ssl_mode["client_certificate"])
client_key = TransformConfig.create_file("client.key", ssl_mode["client_key"])
subprocess.call("openssl pkcs8 -topk8 -inform PEM -in client.key -outform DER -out client.pk8 -nocrypt", shell=True)
dbt_config["sslkey"] = client_key.replace("client.key", "client.pk8")

return dbt_config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class NormalizationRunnerFactory {

public static final String BASE_NORMALIZATION_IMAGE_NAME = "airbyte/normalization";
public static final String NORMALIZATION_VERSION = "0.2.16";
public static final String NORMALIZATION_VERSION = "0.2.17";

static final Map<String, ImmutablePair<String, DefaultNormalizationRunner.DestinationType>> NORMALIZATION_MAPPING =
ImmutableMap.<String, ImmutablePair<String, DefaultNormalizationRunner.DestinationType>>builder()
Expand Down