I am creating a simple pipeline for terraform as below in jenkins[installed on windows] seems sh command is not working, i have git bash in my system [i.e.: C:\Program Files\Git\bin)]in my system and have provided path in environment variables, still getting an error as below:
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
Caused: java.io.IOException: Cannot run program "nohup" (in directory "C:\Users\XYZ.jenkins\workspace\Pipe_Groovy"): CreateProcess error=2, The system cannot find the file specified
Code for reference:
pipeline {
agent {
node {
label 'master'
}
}
stages {
stage('terraform started') {
steps {
sh 'echo "Started...!" '
}
}
stage('git clone') {
steps {
sh 'sudo rm -r *;sudo git clone https://gist.github.com/XXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
}
}
stage('tfsvars create'){
steps {
sh 'sudo cp /home/ec2-user/vars.tf ./jenkins/'
}
}
Please advice.