diff --git a/scripts/build-images.sh b/scripts/build-images.sh new file mode 100755 index 000000000000..6dbcbe88fb2e --- /dev/null +++ b/scripts/build-images.sh @@ -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} diff --git a/src/prefect/client/orchestration.py b/src/prefect/client/orchestration.py index 7d90546e6b89..74ee783fe7d8 100644 --- a/src/prefect/client/orchestration.py +++ b/src/prefect/client/orchestration.py @@ -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 @@ -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, ) @@ -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` @@ -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: @@ -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() diff --git a/src/prefect/settings.py b/src/prefect/settings.py index 37948954fa64..18fa7f0bdb0f 100644 --- a/src/prefect/settings.py +++ b/src/prefect/settings.py @@ -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.