From 7875fce1e9a30e0893462bf9e9ec25c9301bda4c Mon Sep 17 00:00:00 2001 From: Viacheslav Bocharov Date: Thu, 6 Jun 2024 15:15:35 +0300 Subject: [PATCH] Allow to pass docker login credentials to oras-cli for and CI environment Signed-off-by: Viacheslav Bocharov --- lib/functions/host/docker.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/functions/host/docker.sh b/lib/functions/host/docker.sh index 0477366088..ac4cc40ec5 100644 --- a/lib/functions/host/docker.sh +++ b/lib/functions/host/docker.sh @@ -460,6 +460,8 @@ function docker_cli_prepare_launch() { DOCKER_ARGS+=("--mount" "type=bind,source=${GITHUB_STEP_SUMMARY},target=${GITHUB_STEP_SUMMARY}") DOCKER_ARGS+=("--env" "GITHUB_STEP_SUMMARY=${GITHUB_STEP_SUMMARY}") + fi + if [[ "${CI}" == "true" ]]; then # For pushing/pulling from OCI/ghcr.io; if OCI_TARGET_BASE is set: # - bind-mount the Docker config file (if it exists) if [[ -n "${OCI_TARGET_BASE}" ]]; then @@ -467,7 +469,7 @@ function docker_cli_prepare_launch() { DOCKER_ARGS+=("--env" "OCI_TARGET_BASE=${OCI_TARGET_BASE}") fi - # Mount the Docker config file (if it exists) -- always, even if OCI_TARGET_BASE is not set; @TODO: why only in GitHub actions? + # Mount the Docker config file (if it exists) -- always, even if OCI_TARGET_BASE is not set; local docker_config_file_host="${HOME}/.docker/config.json" local docker_config_file_docker="/root/.docker/config.json" # inside Docker if [[ -f "${docker_config_file_host}" ]]; then