What does the post section do in a declarative pipeline?
⚡
Quick Answer
It defines actions that run after stages based on outcome: always, success, failure, unstable, changed.
Detailed Answer
post blocks handle cleanup and notifications regardless of result — e.g. always { cleanWs() } and failure { slackSend(...) }. This ensures workspaces are cleaned and teams notified even when a build fails, which raw stage steps wouldn't guarantee.
💡
Interview Tip
always{} for cleanup, failure{} for alerts.
jenkinspostnotifications