CI: использовать IP из REGISTRY_HOST для token endpoint резолвинга
This commit is contained in:
@@ -169,22 +169,24 @@ jobs:
|
|||||||
SHA_SHORT=$(echo "${GITHUB_SHA}" | cut -c1-7)
|
SHA_SHORT=$(echo "${GITHUB_SHA}" | cut -c1-7)
|
||||||
REPO_OWNER="${GITHUB_REPOSITORY%%/*}"
|
REPO_OWNER="${GITHUB_REPOSITORY%%/*}"
|
||||||
REGISTRY="${REGISTRY_HOST}/${REPO_OWNER}"
|
REGISTRY="${REGISTRY_HOST}/${REPO_OWNER}"
|
||||||
|
REGISTRY_IP="${REGISTRY_HOST%%:*}"
|
||||||
GITEA_HOST=$(echo "${GITHUB_SERVER_URL}" | sed -E 's#https?://([^/:]+).*#\1#')
|
GITEA_HOST=$(echo "${GITHUB_SERVER_URL}" | sed -E 's#https?://([^/:]+).*#\1#')
|
||||||
|
|
||||||
echo "Registry: ${REGISTRY_HOST}"
|
echo "Registry: ${REGISTRY_HOST}"
|
||||||
|
echo "Registry IP: ${REGISTRY_IP}"
|
||||||
echo "Actor: ${GITHUB_ACTOR}"
|
echo "Actor: ${GITHUB_ACTOR}"
|
||||||
echo "Gitea host: ${GITEA_HOST}"
|
echo "Gitea host: ${GITEA_HOST}"
|
||||||
|
|
||||||
# Ensure token endpoint host resolves to internal network IP from runner.
|
# Ensure token endpoint host resolves to internal network IP from runner.
|
||||||
# Registry auth flow may redirect to ${GITEA_HOST} even when pushing to REGISTRY_HOST.
|
# Registry auth flow may redirect to ${GITEA_HOST} even when pushing to REGISTRY_HOST.
|
||||||
echo "10.10.0.10 ${GITEA_HOST}" >> /etc/hosts
|
echo "${REGISTRY_IP} ${GITEA_HOST}" >> /etc/hosts
|
||||||
getent hosts "${GITEA_HOST}" || true
|
getent hosts "${GITEA_HOST}" || true
|
||||||
|
|
||||||
# Some runners have outbound proxy env configured; force direct access
|
# Some runners have outbound proxy env configured; force direct access
|
||||||
# to internal registry/gitea hosts for auth flow.
|
# to internal registry/gitea hosts for auth flow.
|
||||||
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY all_proxy ALL_PROXY
|
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY all_proxy ALL_PROXY
|
||||||
export NO_PROXY="${NO_PROXY:-},10.10.0.10,${GITEA_HOST}"
|
export NO_PROXY="${NO_PROXY:-},${REGISTRY_IP},${GITEA_HOST}"
|
||||||
export no_proxy="${no_proxy:-},10.10.0.10,${GITEA_HOST}"
|
export no_proxy="${no_proxy:-},${REGISTRY_IP},${GITEA_HOST}"
|
||||||
|
|
||||||
echo "${REGISTRY_PASSWORD}" | ./crane auth login --insecure "${REGISTRY_HOST}" -u "${REGISTRY_USER}" --password-stdin
|
echo "${REGISTRY_PASSWORD}" | ./crane auth login --insecure "${REGISTRY_HOST}" -u "${REGISTRY_USER}" --password-stdin
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user