Datapipeline {
agent any
environment {
KUBECONFIG = credentials(‘kubeconfig’)
}
stages {
stage('Checkout') {
steps {
sh 'git clone https://github.com/kodekloudhub/jenkins-project.git'
sh "ls -ltr"
}
}
stage('Approval Required') {
steps {
script {
def userInput = input(id: 'userInput', message: 'Approve and Provide docker image', parameters: [
string(name: 'PARAMETER_NAME', defaultValue: 'defaultValue', description: 'Enter the docker image')
])
env.PARAMETER_VALUE = userInput
}
}
}
stage('Deploy to EKS Prod env')
{
steps
{
script
{
withCredentials([aws(accessKeyVariable: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY', credentialsId: 'aws')]) {
def deploymentExists = sh(script: "kubectl get deployment flask-app-deployment-prod -n prod -o json", returnStatus: true)
if (deploymentExists == 0)
{
sh "kubectl set image -n prod deployment/flask-app-deployment-prod flask-app=${env.PARAMETER_VALUE} --record"
echo "Kubernetes deployment updated successfully"
}
else
{
sh "kubectl apply -f jenkins-project/deployment_production.yaml"
echo "Kubernetes deployment created successfully"
}
}
}
}
}
}
}
For this pipeline I am not getting approve prompt despite having installed Input plugin. The pipeline is directly getting successful and also configured aws credentials and kubeconfig file for this lab properly. So what could be the reason that is checkout and approve stage is not executing