credentials() in the pipeline-level environment{} block causes an immediate
abort before any stage runs if the credential ID does not exist in Jenkins.
The node is released, post{} runs without a node context, and sh steps fail
with 'Required context class hudson.FilePath is missing'.
Fix: remove REGISTRY_CREDS and GITEA_CREDS from environment{}, replace with
withCredentials() inside the stages that actually need them (Build & Push,
Publish). Wrap post{cleanup} sh calls in try/catch as a safety net.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>