I want to run bash commands throw Jenkins pipeline, I'm calling a function that has some bash commands but I'm getting this error:
java.lang.NoSuchMethodError: No such DSL method 'bash' found among steps
This is the function:
def copy_tools(){
// tools bash '''#!/bin/bash mkdir X6//CX6 cp ${x6_tools_path} . unzip CX6.zip -d .\\\\X6 '''
}
can you please help?
You want to use sh
, not bash
. You aren't directly running bash in your code. You need to run the sh
pipeline step, which will run the configured shell.
def copy_tools(){
// tools
sh '''#!/bin/bash
mkdir X6//CX6
cp ${x6_tools_path} .
unzip CX6.zip -d .\\X6
'''
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.