forked from RedHatInsights/insights-core-assets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
89 lines (88 loc) · 3.79 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
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/'
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/
"""
}
}
}
}
}
post {
success {
slackSend channel: '#team-platform-data',
color: 'good',
message: 'Uploader.json and Egg successfully Deployed'
}
failure {
slackSend channel: '#team-platform-data',
color: 'bad',
message: 'Something went wrong with uploader.json and egg deployment'
}
}
}