Bash command inside Groovy

Bash command inside Groovy, helps with improving your Jenkins pipelines.



def run_bash_command(){
    try {
        cmd_output = sh script:  """
        #!/bin/bash -e
        """, returnStdout: true
        return cmd_output
    catch (error) {
        echo "${error}"
        currentBuild.result = 'FAILURE'
        throw error

Vote Here

You must earn at least 1 vote on your snippets to be allowed to vote

Terms Of Use

Privacy Policy

Featured snippets are MIT license

Gears & Masters

Advertise © 2020