Hi
i have a controller jenkins file as follows
pipeline {
agent any
parameters {
choice(
name: 'APPLICATION',
choices : ['Option A', 'Option B', 'Option C'],
description: 'Choose the Application to Deploy'
)
}
environment {
ACTION = 'Test action'
}
stages {
stage('Load and Execute Other Jenkinsfiles') {
steps {
script {
switch (APPLICATION) {
case 'Option A':
sh 'ls -al'
echo 'I am option A from master'
build job: 'Jenkinsfile-A', parameters: [
string(name: 'ACTION', value: "${ACTION}")
)
]
break
case 'Option B':
sh 'ls -al'
echo 'I am option b from master'
build job: './Jenkinsfile-B', parameters: [
string(name: 'ACTION', value: "${ACTION}")
)
]
break
case 'Option C':
sh 'ls -al'
echo 'I am option A with build job '
build job: 'Jenkinsfile-A', parameters: [
string(name: 'ACTION', value: "${ACTION}")
)
]
break
default:
error "Unknown application: ${APPLICATION}"
}
}
}
}
}
post {
success {
echo 'Test job completed'
}
failure {
echo 'Test job failed'
}
}
}
From this controller jenkins file i want to call the other jenkins file in the same folder. Example of jenkinfile-A is as follows
pipeline {
agent none
environment {
ACTION = 'I am file A'
}
stages {
stage('Deploy Application on AWS') {
agent any
steps {
script {
echo 'I am in this step in jenkins file a '
echo "${ACTION}"
}
}
}
}
post {
success {
echo 'Job A success'
}
failure {
echo 'Job A failed'
}
}
}
When i do an ls -l of the folder i have the following files
ls
Jenkinsfile-A Jenkinsfile-B master-Jenkinsfile
When i run this job in jenkins server it is not able to find the file and returns the error Jenkinsfile-A is not found