This repository has been archived by the owner on Jul 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Jenkinsfile
108 lines (107 loc) · 5.59 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
pipeline {
options {
disableConcurrentBuilds()
}
agent {
node {
label 'python27'
}
}
stages {
stage('Write SSH Key') {
steps {
writeFile file: "/tmp/akamai-ssh", text: "${env.AKAMAI_SSH_KEY}\n-----END RSA PRIVATE KEY-----"
sh 'chmod 600 /tmp/akamai-ssh'
}
}
stage('Check GPG') {
steps {
sh """
gpg --no-default-keyring --keyring ./redhattools.pub.gpg --verify uploader.v2.json.asc uploader.v2.json
gpg --no-default-keyring --keyring ./redhattools.pub.gpg --verify uploader.json.asc uploader.json
gpg --no-default-keyring --keyring ./redhattools.pub.gpg --verify insights-core.egg.asc insights-core.egg
"""
}
}
stage('Deploy Uploader JSON') {
when {
branch 'master'
not {
changeRequest()
}
}
steps {
sh 'rsync -arv -e "ssh -i /tmp/akamai-ssh -o StrictHostKeyChecking=no" ./uploader* [email protected]:/114034/r/insights/v1/static/core/'
sh 'rsync -arv -e "ssh -i /tmp/akamai-ssh -o StrictHostKeyChecking=no" ./uploader* [email protected]:/114034/r/insights/v1/static/'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: "cloud-netstorage",
keyFileVariable: "privateKeyFile")]) {
configFileProvider([configFile(fileId: "9f0c91bc-4feb-4076-9f3e-13da94ff3cef", variable: "AKAMAI_HOST_KEY")]) {
sh """
eval `ssh-agent`
ssh-add \"$privateKeyFile\"
cp $AKAMAI_HOST_KEY ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
rsync -arv -e \"ssh -2\" ./uploader* [email protected]:/822386/api/v1/static/
"""
}
}
}
}
stage('Deploy Egg') {
when {
branch 'master'
not {
changeRequest()
}
}
steps {
sh 'rsync -arv -e "ssh -i /tmp/akamai-ssh -o StrictHostKeyChecking=no" ./insights-core.egg* [email protected]:/114034/r/insights/v1/static/core/'
sh 'rsync -arv -e "ssh -i /tmp/akamai-ssh -o StrictHostKeyChecking=no" ./changelog.txt [email protected]:/114034/r/insights/v1/static/core/'
sh 'rsync -arv -e "ssh -i /tmp/akamai-ssh -o StrictHostKeyChecking=no" ./insights-core.egg* [email protected]:/114034/r/insights/v1/static/release/'
sh 'rsync -arv -e "ssh -i /tmp/akamai-ssh -o StrictHostKeyChecking=no" ./changelog.txt [email protected]:/114034/r/insights/v1/static/release/'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: "cloud-netstorage",
keyFileVariable: "privateKeyFile")]) {
configFileProvider([configFile(fileId: "9f0c91bc-4feb-4076-9f3e-13da94ff3cef", variable: "AKAMAI_HOST_KEY")]) {
sh """
eval `ssh-agent`
ssh-add \"$privateKeyFile\"
cp $AKAMAI_HOST_KEY ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
rsync -arv -e \"ssh -2\" ./insights-core.egg* [email protected]:/822386/api/v1/static/
rsync -arv -e \"ssh -2\" ./changelog.txt [email protected]:/822386/api/v1/static/
rsync -arv -e \"ssh -2\" ./insights-core.egg* [email protected]:/822386/api/v1/static/release/
rsync -arv -e \"ssh -2\" ./changelog.txt [email protected]:/822386/api/v1/static/release/
"""
}
}
}
}
stage('Deploy Egg to Pre-Prod') {
when {
branch 'pre_prod'
not {
changeRequest()
}
}
steps {
sh 'rsync -arv -e "ssh -i /tmp/akamai-ssh -o StrictHostKeyChecking=no" ./insights-core.egg* [email protected]:/114034/r/insights/v1/static/testing/'
sh 'rsync -arv -e "ssh -i /tmp/akamai-ssh -o StrictHostKeyChecking=no" ./changelog.txt [email protected]:/114034/r/insights/v1/static/testing/'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: "cloud-netstorage",
keyFileVariable: "privateKeyFile")]) {
configFileProvider([configFile(fileId: "9f0c91bc-4feb-4076-9f3e-13da94ff3cef", variable: "AKAMAI_HOST_KEY")]) {
sh """
eval `ssh-agent`
ssh-add \"$privateKeyFile\"
mkdir ~/.ssh
chmod 700 ~/.ssh
cp $AKAMAI_HOST_KEY ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
rsync -arv -e \"ssh -2\" ./insights-core.egg* [email protected]:/822386/api/v1/static/testing
rsync -arv -e \"ssh -2\" ./changelog.txt [email protected]:/822386/api/v1/static/testing
"""
}
}
}
}
}
}