forked from priyanshutomar/testrepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
44 lines (43 loc) · 2.07 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
pipeline {
agent any
stages {
/* stage('Trigger Job1') {
steps {
echo 'Triggering Job1..'
script {
def path = pwd()
checkout([$class: 'GitSCM', branches: [[name: '*\/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'cd286c7e-b875-4a15-b0e5-e54f0ec6469a', url: '[email protected]:priyanshutomar/testrepo2.git']]])
echo "${path}\n"
println(new File(path + "/csvFile.csv").readLines())
}
// build job: 'slaveJob', parameters: [string(name: 'param1', value: 'ValueOfParam')]
}
} */
stage('Trigger Job2') {
steps {
echo 'Triggering Job2..'
script {
def externalCall = load("util.groovy")
externalCall(pwd() + "/csvFile.csv")
/*
checkout([$class: 'GitSCM', branches: [[name: '*\/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'cd286c7e-b875-4a15-b0e5-e54f0ec6469a', url: '[email protected]:priyanshutomar/testrepo2.git']]])
def content = new File(pwd() + "/csvFile.csv").readLines()
content.eachWithIndex { String line, int i ->
def vals = line.split(',', -1)
def params = []
vals.eachWithIndex { String val, int j ->
if (!(val == null || val == "")) {
params.add(string(name: "${content.get(0).split(',', -1)[j]}", value: "${vals[j]}"))
}
}
if (i != 0) {
stage(vals[0]) {
build job: 'slaveJob', parameters: params
}
}
} */
}
}
}
}
}