Reputation: 166319
I'm using Jenkins CI and I would like to add some post-build actions.
I've tried to follow suggestions from Execute Shell Script after post build in Jenkins post, but I cannot find such option (Post build task) which should allow me to execute shell commands. I can select Execute shell, but only for Build.
Here are my all options:
Transcript:
Add post-build action:
- Aggregate downstream test results
- Archive the artifacts
- Build other projects
- Console output (build log) parsing
- GitHub PR: add labels
- GitHub PR: close PR
- GitHub PR: post comment
- GitHub PR: remove labels
- GitHub PR: set PR status
- Publish HTML reports
- Publish JUnit test result report
- Publish Javadoc
- Record fingerprints of files to track usage
- Use publishers from another project
- Git Publisher
- Build other projects (manual step)
- E-mail Notification
- Editable Email Notification
- Set build status on GitHub commit [deprecated]
- Set status for GitHub commit [universal]
- Trigger parameterized build on other projects
- Delete workspace when build is done
What am I missing?
Basically I need this to destroy my VM instance in case of provisioning error (e.g. vagrant destroy -f
).
I'm using Jenkins ver. 2.7.1.
Upvotes: 3
Views: 18996
Reputation: 37580
Use the Add post-build action button and select Post build task, which is provided by the mentioned Post build task plugin:
Afterwards, you have Tasks, each with an input field Script, where you can execute your commands:
Upvotes: 10