From 5de4aab7e8765bba40bd83ee4eadb5d639b39747 Mon Sep 17 00:00:00 2001
From: kmohiuddin <khawajaibrahim2011@hotmail.com>
Date: Wed, 19 Feb 2020 14:46:25 +0500
Subject: [PATCH] add stage checking param

---
 Jenkinsfile | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 0781dba..e782f3c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -11,10 +11,23 @@ pipeline {
                 checkout scm
             }
         }
-        stage('test') {
+        stage('checking params') {
             steps{
-                test("/home/kmohiuddin/.jenkins/workspace/performance_test/file.yaml")
+                script {
+                    // On first build by user just load the parameters as they are not available of first run on new branches
+                    if (env.BUILD_NUMBER.equals("1") && currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause') != null) {
+                        currentBuild.displayName = 'Parameter loading'
+                        addBuildDescription('Please restart pipeline')
+                        currentBuild.result = 'ABORTED'
+                        error('Stopping initial manually triggered build as we only want to get the parameters')
+                    }
+                }
+
             }
         }
+        stage('test') {
+        steps{
+            test("/home/kmohiuddin/.jenkins/workspace/performance_test/file.yaml")
+        }
     }
 }
\ No newline at end of file
-- 
2.18.1