Skip to content

Commit 339f93a

Browse files
committed
Fix Artifactory action: separate OIDC platform URL from PyPI index URL
1 parent 7fb27d9 commit 339f93a

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

.github/actions/artifactory-oidc/action.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ description: "Exchange GitHub OIDC token for Artifactory access token and config
33

44
inputs:
55
artifactory-url:
6-
description: "Base Artifactory platform URL. Falls back to ARTIFACTORY_URL env var."
6+
description: "JFrog platform base URL for OIDC token exchange. Falls back to ARTIFACTORY_URL env var."
7+
required: false
8+
default: ""
9+
pypi-index-url:
10+
description: "Full PyPI index base URL (without /simple). Falls back to ARTIFACTORY_PYPI_URL env var, then derived from artifactory-url."
711
required: false
812
default: ""
913
oidc-provider-name:
1014
description: "OIDC provider name configured in Artifactory"
1115
required: false
1216
default: "github-actions"
1317
pypi-repo:
14-
description: "Artifactory virtual PyPI repository name"
18+
description: "Artifactory virtual PyPI repository name (used only when deriving index URL from artifactory-url)"
1519
required: false
1620
default: "virtual-pypi-thirdparty"
1721

@@ -22,6 +26,7 @@ runs:
2226
shell: bash
2327
env:
2428
INPUT_ARTIFACTORY_URL: ${{ inputs.artifactory-url }}
29+
INPUT_PYPI_INDEX_URL: ${{ inputs.pypi-index-url }}
2530
OIDC_PROVIDER_NAME: ${{ inputs.oidc-provider-name }}
2631
PYPI_REPO: ${{ inputs.pypi-repo }}
2732
run: |
@@ -55,10 +60,18 @@ runs:
5560
fi
5661
echo "::add-mask::$ART_TOKEN"
5762
58-
HOST=$(echo "${ARTIFACTORY_URL}" | sed -E 's#^https?://##')
59-
INDEX_URL="https://:${ART_TOKEN}@${HOST}/artifactory/api/pypi/${PYPI_REPO}/simple/"
63+
# Determine the PyPI index base URL:
64+
# 1. explicit input, 2. ARTIFACTORY_PYPI_URL env var, 3. derived from ARTIFACTORY_URL
65+
PYPI_BASE="${INPUT_PYPI_INDEX_URL:-${ARTIFACTORY_PYPI_URL:-}}"
66+
if [ -z "$PYPI_BASE" ]; then
67+
HOST=$(echo "${ARTIFACTORY_URL}" | sed -E 's#^https?://##')
68+
PYPI_BASE="https://${HOST}/artifactory/api/pypi/${PYPI_REPO}"
69+
fi
70+
PYPI_BASE="${PYPI_BASE%/}" # strip trailing slash
71+
72+
INDEX_URL="https://:${ART_TOKEN}@$(echo "${PYPI_BASE}" | sed -E 's#^https?://##')/simple/"
6073
6174
echo "::add-mask::${INDEX_URL}"
6275
echo "UV_INDEX_URL=${INDEX_URL}" >> "$GITHUB_ENV"
6376
echo "PIP_INDEX_URL=${INDEX_URL}" >> "$GITHUB_ENV"
64-
echo "Configured to resolve through Artifactory (${PYPI_REPO})"
77+
echo "Configured PyPI index through Artifactory"

0 commit comments

Comments
 (0)