-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
39 lines (39 loc) · 1.29 KB
/
Copy pathJenkinsfile
File metadata and controls
39 lines (39 loc) · 1.29 KB
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
pipeline {
agent any
stages {
stage('preperation') {
steps {
//git clone will be done automatically
echo 'verify the user input file'
script {
// def inFile = input id: 'file1', message: 'Upload a file', parameters: [file(name: 'data.tmp', description: 'Choose a file')]
def inFile = input message: 'Upload file', parameters: [file(name: 'data.tmp', description: 'Upload public key file')]
data = readFile(file: "${inFile}")
echo ("KEY FILE PATH IS : ${inFile}")
echo("KEY CONTENT IS: ${data}")
def file_content = "${data}"
writeFile(file: "ansible/files/3rd-user-key.pub", text: "${file_content}", encoding: "UTF-8")
// Check if file valid public key
def stdout = sh returnStdout: true, script: "ssh-keygen -l -f ${inFile}"
echo("${stdout}")
}
}
}
stage('ansible') {
steps {
sh "ansible-playbook -i ./ansible/inventory ./ansible/setup.yml"
}
}
stage('whats_going_on') {
steps {
sh 'python3 ./whats_going_on.py > /var/lib/jenkins/workspace/results.json'
}
}
}
post {
always {
echo 'One way or another, I have finished'
deleteDir() /* clean up our workspace */
}
}
}