How to execute shell as post-build action?

17,986

Use the Add post-build action button and select Post build task, which is provided by the mentioned Post build task plugin:

enter image description here

Afterwards, you have Tasks, each with an input field Script, where you can execute your commands:

enter image description here

Share:
17,986
glerYbo
Author by

glerYbo

I'm a DevOps guy, also IT engineer programming in anything that has syntax. "Life is about making a big impact in the other people's lives."

Updated on July 19, 2022

Comments

  • glerYbo
    glerYbo almost 2 years

    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:

    Jenkins - Add post-build action

    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.