🐛 fix(ci): extra-index-gitea letto come env, non nel campo if dello step
- nel workflow_call di act_runner il with: del chiamante non arriva a inputs nel campo if: lo step "Registry PyPI di Gitea" veniva saltato (run 67345 di python-chatterbox-api) - lo step gira sempre, legge EXTRA_INDEX_GITEA dall'env e termina se non e' true (confronto case-insensitive) - il secret BuildKit passa per l'output secret_files dello step, la pulizia del netrc gira con if: always() Fixes #18 @30m
This commit is contained in:
1 parent
4b2d986929
commit
8b63ed6820
4 files changed
+45
-13
No files matched your search
@@ -38,13 +38,20 @@ jobs:
|
||||
# Registry PyPI privato di Gitea (#17). Le credenziali vanno in un file netrc e non
|
||||
# nell'URL: PIP_EXTRA_INDEX_URL resta senza segreti, pip legge utente e token dal file
|
||||
# indicato da NETRC, e nulla di sensibile passa per l'env esportato o per i log.
|
||||
# L'input si legge come variabile d'ambiente e non nel campo `if:` dello step: nel
|
||||
# workflow_call di act_runner i valori `with:` del chiamante non arrivano al contesto
|
||||
# `inputs` in quella posizione (stesso problema di owns-auth-roles in quality-gates.yml).
|
||||
- name: Registry PyPI di Gitea
|
||||
id: pypi-gitea
|
||||
if: ${{ inputs.extra-index-gitea }}
|
||||
env:
|
||||
EXTRA_INDEX_GITEA: ${{ inputs.extra-index-gitea }}
|
||||
G_USER: ${{ secrets.G_USER }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
if ! printf "%s" "$EXTRA_INDEX_GITEA" | grep -qix "true"; then
|
||||
echo "extra-index-gitea non attivo: solo PyPI pubblico."
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "$G_USER" ] || [ -z "$NPM_TOKEN" ]; then
|
||||
echo "::error::extra-index-gitea richiede i secrets G_USER e NPM_TOKEN: serve 'secrets: inherit' nel workflow chiamante."
|
||||
exit 1
|
||||
@@ -53,7 +60,8 @@ jobs:
|
||||
( umask 077; printf 'machine gitea.pzetatouch.it\nlogin %s\npassword %s\n' "$G_USER" "$NPM_TOKEN" > "$NETRC_FILE" )
|
||||
echo "NETRC=$NETRC_FILE" >> "$GITHUB_ENV"
|
||||
echo "PIP_EXTRA_INDEX_URL=https://gitea.pzetatouch.it/api/packages/PZeta_Touch/pypi/simple/" >> "$GITHUB_ENV"
|
||||
echo "netrc=$NETRC_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "secret_files=pip_netrc=$NETRC_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "Registry PyPI di Gitea aggiunto come indice extra (credenziali da netrc)."
|
||||
|
||||
- name: Cache pip
|
||||
uses: https://github.com/actions/cache@v4
|
||||
@@ -146,5 +154,5 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Rimozione credenziali registry PyPI
|
||||
if: ${{ always() && inputs.extra-index-gitea }}
|
||||
if: always()
|
||||
run: rm -f "$RUNNER_TEMP/pip-gitea.netrc"
|
||||
@@ -38,13 +38,20 @@ jobs:
|
||||
# Registry PyPI privato di Gitea (#17). Le credenziali vanno in un file netrc e non
|
||||
# nell'URL: PIP_EXTRA_INDEX_URL resta senza segreti, pip legge utente e token dal file
|
||||
# indicato da NETRC, e nulla di sensibile passa per l'env esportato o per i log.
|
||||
# L'input si legge come variabile d'ambiente e non nel campo `if:` dello step: nel
|
||||
# workflow_call di act_runner i valori `with:` del chiamante non arrivano al contesto
|
||||
# `inputs` in quella posizione (stesso problema di owns-auth-roles in quality-gates.yml).
|
||||
- name: Registry PyPI di Gitea
|
||||
id: pypi-gitea
|
||||
if: ${{ inputs.extra-index-gitea }}
|
||||
env:
|
||||
EXTRA_INDEX_GITEA: ${{ inputs.extra-index-gitea }}
|
||||
G_USER: ${{ secrets.G_USER }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
if ! printf "%s" "$EXTRA_INDEX_GITEA" | grep -qix "true"; then
|
||||
echo "extra-index-gitea non attivo: solo PyPI pubblico."
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "$G_USER" ] || [ -z "$NPM_TOKEN" ]; then
|
||||
echo "::error::extra-index-gitea richiede i secrets G_USER e NPM_TOKEN: serve 'secrets: inherit' nel workflow chiamante."
|
||||
exit 1
|
||||
@@ -53,7 +60,8 @@ jobs:
|
||||
( umask 077; printf 'machine gitea.pzetatouch.it\nlogin %s\npassword %s\n' "$G_USER" "$NPM_TOKEN" > "$NETRC_FILE" )
|
||||
echo "NETRC=$NETRC_FILE" >> "$GITHUB_ENV"
|
||||
echo "PIP_EXTRA_INDEX_URL=https://gitea.pzetatouch.it/api/packages/PZeta_Touch/pypi/simple/" >> "$GITHUB_ENV"
|
||||
echo "netrc=$NETRC_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "secret_files=pip_netrc=$NETRC_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "Registry PyPI di Gitea aggiunto come indice extra (credenziali da netrc)."
|
||||
|
||||
- name: Cache pip
|
||||
uses: https://github.com/actions/cache@v4
|
||||
@@ -134,5 +142,5 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Rimozione credenziali registry PyPI
|
||||
if: ${{ always() && inputs.extra-index-gitea }}
|
||||
if: always()
|
||||
run: rm -f "$RUNNER_TEMP/pip-gitea.netrc"
|
||||
@@ -57,13 +57,20 @@ jobs:
|
||||
# Registry PyPI privato di Gitea (#17). Le credenziali vanno in un file netrc e non
|
||||
# nell'URL: PIP_EXTRA_INDEX_URL resta senza segreti, pip legge utente e token dal file
|
||||
# indicato da NETRC, e nulla di sensibile passa per l'env esportato o per i log.
|
||||
# L'input si legge come variabile d'ambiente e non nel campo `if:` dello step: nel
|
||||
# workflow_call di act_runner i valori `with:` del chiamante non arrivano al contesto
|
||||
# `inputs` in quella posizione (stesso problema di owns-auth-roles in quality-gates.yml).
|
||||
- name: Registry PyPI di Gitea
|
||||
id: pypi-gitea
|
||||
if: ${{ inputs.extra-index-gitea }}
|
||||
env:
|
||||
EXTRA_INDEX_GITEA: ${{ inputs.extra-index-gitea }}
|
||||
G_USER: ${{ secrets.G_USER }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
if ! printf "%s" "$EXTRA_INDEX_GITEA" | grep -qix "true"; then
|
||||
echo "extra-index-gitea non attivo: solo PyPI pubblico."
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "$G_USER" ] || [ -z "$NPM_TOKEN" ]; then
|
||||
echo "::error::extra-index-gitea richiede i secrets G_USER e NPM_TOKEN: serve 'secrets: inherit' nel workflow chiamante."
|
||||
exit 1
|
||||
@@ -72,7 +79,8 @@ jobs:
|
||||
( umask 077; printf 'machine gitea.pzetatouch.it\nlogin %s\npassword %s\n' "$G_USER" "$NPM_TOKEN" > "$NETRC_FILE" )
|
||||
echo "NETRC=$NETRC_FILE" >> "$GITHUB_ENV"
|
||||
echo "PIP_EXTRA_INDEX_URL=https://gitea.pzetatouch.it/api/packages/PZeta_Touch/pypi/simple/" >> "$GITHUB_ENV"
|
||||
echo "netrc=$NETRC_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "secret_files=pip_netrc=$NETRC_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "Registry PyPI di Gitea aggiunto come indice extra (credenziali da netrc)."
|
||||
|
||||
- name: Cache pip
|
||||
uses: https://github.com/actions/cache@v4
|
||||
@@ -160,8 +168,8 @@ jobs:
|
||||
# Dockerfile lo monta solo per la durata del RUN che installa
|
||||
# RUN --mount=type=secret,id=pip_netrc,target=/root/.netrc pip install ...
|
||||
# e il token non entra negli strati dell'immagine. Vuoto se l'input non e' attivo.
|
||||
secret-files: ${{ inputs.extra-index-gitea && format('pip_netrc={0}', steps.pypi-gitea.outputs.netrc) || '' }}
|
||||
secret-files: ${{ steps.pypi-gitea.outputs.secret_files }}
|
||||
|
||||
- name: Rimozione credenziali registry PyPI
|
||||
if: ${{ always() && inputs.extra-index-gitea }}
|
||||
if: always()
|
||||
run: rm -f "$RUNNER_TEMP/pip-gitea.netrc"
|
||||
@@ -50,13 +50,20 @@ jobs:
|
||||
# Registry PyPI privato di Gitea (#17). Le credenziali vanno in un file netrc e non
|
||||
# nell'URL: PIP_EXTRA_INDEX_URL resta senza segreti, pip legge utente e token dal file
|
||||
# indicato da NETRC, e nulla di sensibile passa per l'env esportato o per i log.
|
||||
# L'input si legge come variabile d'ambiente e non nel campo `if:` dello step: nel
|
||||
# workflow_call di act_runner i valori `with:` del chiamante non arrivano al contesto
|
||||
# `inputs` in quella posizione (stesso problema di owns-auth-roles in quality-gates.yml).
|
||||
- name: Registry PyPI di Gitea
|
||||
id: pypi-gitea
|
||||
if: ${{ inputs.extra-index-gitea }}
|
||||
env:
|
||||
EXTRA_INDEX_GITEA: ${{ inputs.extra-index-gitea }}
|
||||
G_USER: ${{ secrets.G_USER }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
if ! printf "%s" "$EXTRA_INDEX_GITEA" | grep -qix "true"; then
|
||||
echo "extra-index-gitea non attivo: solo PyPI pubblico."
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "$G_USER" ] || [ -z "$NPM_TOKEN" ]; then
|
||||
echo "::error::extra-index-gitea richiede i secrets G_USER e NPM_TOKEN: serve 'secrets: inherit' nel workflow chiamante."
|
||||
exit 1
|
||||
@@ -65,7 +72,8 @@ jobs:
|
||||
( umask 077; printf 'machine gitea.pzetatouch.it\nlogin %s\npassword %s\n' "$G_USER" "$NPM_TOKEN" > "$NETRC_FILE" )
|
||||
echo "NETRC=$NETRC_FILE" >> "$GITHUB_ENV"
|
||||
echo "PIP_EXTRA_INDEX_URL=https://gitea.pzetatouch.it/api/packages/PZeta_Touch/pypi/simple/" >> "$GITHUB_ENV"
|
||||
echo "netrc=$NETRC_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "secret_files=pip_netrc=$NETRC_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "Registry PyPI di Gitea aggiunto come indice extra (credenziali da netrc)."
|
||||
|
||||
- name: Cache pip
|
||||
uses: https://github.com/actions/cache@v4
|
||||
@@ -102,5 +110,5 @@ jobs:
|
||||
run: pytest --tb=short -q
|
||||
|
||||
- name: Rimozione credenziali registry PyPI
|
||||
if: ${{ always() && inputs.extra-index-gitea }}
|
||||
if: always()
|
||||
run: rm -f "$RUNNER_TEMP/pip-gitea.netrc"
|
||||
Reference in new issue
Block a user