Remove the Secret from the Script
Use a folder-scoped Jenkins credential without exposing its value.
A intermediate Jenkins challenge worth 10 points. Solve it hands-on in a real Jenkins environment in your browser - no local setup, no fake shells.
The Challenge
Scenario: Security rejected a hardcoded deployment token. The folder already contains secret-text credential lab-deploy-token.
Requirements:
- Bind it with
withCredentials - Expose it only as environment variable
TOKEN - Keep Groovy from interpolating the secret by using a single-quoted shell command
- Run a successful build