Skip to content
Open
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
23 changes: 23 additions & 0 deletions scripts/build-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -e

VERSION=${VERSION}
ARCH=$(uname -m)
REPO="brigad/irdu-data/prefect/production"
ACCOUNT="227743832892.dkr.ecr.eu-west-1.amazonaws.com"
FULL_REPO="${ACCOUNT}/${REPO}"

echo $FULL_REPO

docker build --build-arg PYTHON_VERSION=3.11 --build-arg BUILD_PYTHON_VERSION=3.11 -f ../Dockerfile .. -t ${FULL_REPO}:${VERSION}-${ARCH}

docker push ${FULL_REPO}:${VERSION}-${ARCH}

IMAGES=$(aws ecr list-images --repository-name ${REPO} |jq -c '.imageIds[] | select(has("imageTag") and (.imageTag | contains("2.11.4-"))) | .imageTag' | xargs -I% echo ${FULL_REPO}:% | xargs)

echo ${IMAGES}

docker manifest create ${FULL_REPO}:${VERSION} ${IMAGES} --amend

docker manifest push ${FULL_REPO}:${VERSION}
6 changes: 6 additions & 0 deletions src/prefect/client/orchestration.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
PREFECT_API_URL,
PREFECT_CLOUD_API_URL,
PREFECT_UNIT_TEST_MODE,
PREFECT_API_BASIC_AUTH
)
from prefect.utilities.collections import AutoEnum

Expand Down Expand Up @@ -142,6 +143,7 @@ def get_client(httpx_settings: Optional[dict] = None) -> "PrefectClient":
return PrefectClient(
api,
api_key=PREFECT_API_KEY.value(),
api_basic_auth=PREFECT_API_BASIC_AUTH.value(),
httpx_settings=httpx_settings,
)

Expand All @@ -153,6 +155,7 @@ class PrefectClient:
Args:
api: the REST API URL or FastAPI application to connect to
api_key: An optional API key for authentication.
api_basic_auth: An optional basic auth string for authentication.
api_version: The API version this client is compatible with.
httpx_settings: An optional dictionary of settings to pass to the underlying
`httpx.AsyncClient`
Expand All @@ -177,6 +180,7 @@ def __init__(
api: Union[str, FastAPI],
*,
api_key: str = None,
api_basic_auth: str = None,
api_version: str = None,
httpx_settings: dict = None,
) -> None:
Expand All @@ -194,6 +198,8 @@ def __init__(
httpx_settings["headers"].setdefault("X-PREFECT-API-VERSION", api_version)
if api_key:
httpx_settings["headers"].setdefault("Authorization", f"Bearer {api_key}")
if api_basic_auth:
httpx_settings["headers"].setdefault("Authorization", f"Basic {api_basic_auth}")

# Context management
self._exit_stack = AsyncExitStack()
Expand Down
7 changes: 7 additions & 0 deletions src/prefect/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,13 @@ def default_cloud_ui_url(settings, value):
)
"""API key used to authenticate with a the Prefect API. Defaults to `None`."""

PREFECT_API_BASIC_AUTH = Setting(
str,
default=None,
is_secret=True,
)
"""BASIC Auth token to authenticate with a the Prefect API. Defaults to `None`."""

PREFECT_API_ENABLE_HTTP2 = Setting(bool, default=True)
"""
If true, enable support for HTTP/2 for communicating with an API.
Expand Down