-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
73 lines (50 loc) · 2.85 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
pipeline {
agent any
parameters
{
string(name: 'CHG_NUMBER', defaultValue: 'CHG', description: 'Enter Change Ticket Number:')
}
stages {
stage('Deploy to NP3') {
environment {
SSH_CREDS = credentials('myExamPrepPPK') // ssh username with private key
//AN_ACCESS_KEY = credentials('my-predefined-secret-text')
//SERVICE_CREDS = credentials('jenkins') //Example Username/Password
}
steps {
//scp filetocopy.txt z_lnd_etl_svc@np3lndnjsvr01v:/opt/lending/etl/
//scp -r /workspace/directorypath z_lnd_etl_svc@np3lndnjsvr01v:/opt/lending/etl/ // to copy a whole directory instead
echo 'this is where the file transfer will take place from the jenkins workspace to the NP3 server'
//does not work pscp -v -i c:\Users\Elaine\Downloads\NorCalDecember.ppk index.html ec2-user@ec2-13-52-230-121.us-west-1.compute.amazonaws.com:/var/www/html/index.html
//sh 'echo "SSH private key is located at $SSH_CREDS"'
//sh 'echo "SSH user is $SSH_CREDS_USR"'
//sh 'echo "SSH passphrase is $SSH_CREDS_PSW"'
echo "${SSH_CREDS}"
echo "${SSH_CREDS_USR}"
echo 'Successfully deployed to NP3'
} // end steps
}
stage('Deploy to Prod')
{
// ensure that branch is main
// when {
// branch 'main'
// }
steps {
// echo "${branch.name}"
// sh 'python --version'
echo 'Successfully deployed to Prod'
echo "Change Number: ${params.CHG_NUMBER}"
}
}
//end stages
}
post {
always {
echo 'Pipeline completed successfully.'
}
}
//end post
//end pipeline
}