diff --git a/.gitea/workflows/python-dependency-check.yml b/.gitea/workflows/python-dependency-check.yml index 0cc76c5..8519401 100644 --- a/.gitea/workflows/python-dependency-check.yml +++ b/.gitea/workflows/python-dependency-check.yml @@ -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" diff --git a/.gitea/workflows/python-dependency-outdated.yml b/.gitea/workflows/python-dependency-outdated.yml index 5fc7eb0..aff10b7 100644 --- a/.gitea/workflows/python-dependency-outdated.yml +++ b/.gitea/workflows/python-dependency-outdated.yml @@ -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" diff --git a/.gitea/workflows/python-docker-release.yml b/.gitea/workflows/python-docker-release.yml index 6fb5bcb..997cb4c 100644 --- a/.gitea/workflows/python-docker-release.yml +++ b/.gitea/workflows/python-docker-release.yml @@ -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" diff --git a/.gitea/workflows/python-quality-gates.yml b/.gitea/workflows/python-quality-gates.yml index 75bb210..70e469f 100644 --- a/.gitea/workflows/python-quality-gates.yml +++ b/.gitea/workflows/python-quality-gates.yml @@ -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"