-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.cico.pipeline
106 lines (89 loc) · 3.85 KB
/
.cico.pipeline
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
def onmyduffynode(script){
ansiColor('xterm'){
timestamps{
sh 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root ${DUFFY_NODE}.ci.centos.org -t "' + script + '"'
}
}
}
def syncfromduffynode(rsyncpath){
sh 'rsync -e "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root " -Ha --include=' + rsyncpath + " ${DUFFY_NODE}.ci.centos.org:~/ ./"
}
def notifyBuild(String buildStatus = 'STARTED') {
buildStatus = buildStatus ?: 'SUCCESSFUL'
emailext attachmentsPattern: 'compose_tester/*.log', body: "See: ${env.BUILD_URL}", subject: "[${env.JOB_NAME}] Build #${env.BUILD_NUMBER}: ${buildStatus}", to: '[email protected]'
}
node('fedora-qa'){
stage('Allocate Node'){
env.CICO_API_KEY = readFile("${env.HOME}/duffy.key").trim()
duffy_rtn=sh(
script: 'cico --debug node get -f value -c hostname -c comment',
returnStdout: true
).trim().tokenize(' ')
env.DUFFY_NODE=duffy_rtn[0]
env.SSID=duffy_rtn[1]
}
try{
stage('Pre Setup Node'){
onmyduffynode 'yum -y install git ansible'
}
stage('Build') {
//sh '''curl -sb -H "Accept: application/json" "https://kojipkgs.fedoraproject.org/compose/latest-Fedora-Modular-26/STATUS" | grep FINISHED'''
//def response = httpRequest 'https://kojipkgs.fedoraproject.org/compose/latest-Fedora-Modular-26/STATUS'
//println("Content: "+response.content)
//assert response.content == "FINISHED\n": "The Build status is not FINISHED, aborting."
}
stage('git clone Tests') {
onmyduffynode '''git clone "https://github.com/alexxa/compose_tester.git" && ls -la'''
}
stage('Setup Environment') {
onmyduffynode '''cd compose_tester &&
ansible-playbook deploy.yaml --extra-vars "compose=jamesantill/boltron-27" --tags env_setup'''
}
stage('Pull Image') {
onmyduffynode '''cd compose_tester &&
ansible-playbook deploy.yaml --extra-vars "compose=jamesantill/boltron-27" --tags pull_image'''
}
stage('Create Container') {
onmyduffynode '''cd compose_tester &&
ansible-playbook deploy.yaml --extra-vars "compose=jamesantill/boltron-27" --tags create_container'''
}
stage('Mini test') {
onmyduffynode '''cd compose_tester &&
ansible-playbook deploy.yaml --extra-vars "compose=jamesantill/boltron-27" --tags mini | tee output.log'''
}
stage('Module Install') {
onmyduffynode '''cd compose_tester &&
ansible-playbook deploy.yaml --extra-vars "compose=jamesantill/boltron-27" --tags modules_install | tee -a output.log'''
}
stage('Module Update') {
onmyduffynode '''cd compose_tester &&
//ansible-playbook deploy.yaml --extra-vars "compose=jamesantill/boltron-27" --tags modules_update | tee -a output.log'''
}
stage('Create Errors Log') {
onmyduffynode '''cd compose_tester &&
sed -n \'/^TASK/{ x; /failed:/p; d; }; /failed:/H; \\${ x; /failed:/p; }\' output.log >> error.log &&
bash tests/parse_output.sh tests/f27_modules.yaml >> mod_install_results.log
'''
}
}catch (e){
currentBuild.result = "FAILED"
throw e
} finally {
try {
stage('Archive the Logs'){
syncfromduffynode('*.log')
archiveArtifacts('compose_tester/*.log')
}
} catch (e){
currentBuild.result = "FAILED"
throw e
} finally {
stage('Deallocate Node'){
sh 'cico node done ${SSID}'
}
stage('Notify Recipients'){
notifyBuild(currentBuild.result)
}
}
}
}