-
Notifications
You must be signed in to change notification settings - Fork 16
/
Jenkinsfile
70 lines (60 loc) · 2.54 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
def onmyduffynode(script){
ansiColor('xterm'){
timestamps{
sh 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root ${DUFFY_NODE}.ci.centos.org -t \"export REPO=${REPO}; export BRANCH=${BRANCH};\" "' + script + '"'
}
}
}
def synctoduffynode(source)
{
sh 'scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r ' + source + " " + "root@" + "${DUFFY_NODE}.ci.centos.org:~/"
}
node('userspace-containerization'){
stage('Checkout'){
checkout scm
}
stage('Build'){
try{
stage ("Allocate node"){
env.CICO_API_KEY = readFile("${env.HOME}/duffy.key").trim()
duffy_rtn=sh(
script: "cico --debug node get --arch x86_64 -f value -c hostname -c comment",
returnStdout: true
).trim().tokenize(' ')
env.DUFFY_NODE=duffy_rtn[0]
env.DUFFY_SSID=duffy_rtn[1]
}
stage ("Setup"){
onmyduffynode "yum -y install epel-release"
onmyduffynode "yum -y install python36-pip python36-devel rpmdevtools docker ansible"
onmyduffynode "yum -y remove git"
onmyduffynode "curl -o /etc/yum.repos.d/git-epel-7.repo https://copr.fedorainfracloud.org/coprs/g/git-maint/git/repo/epel-7/group_git-maint-git-epel-7.repo"
onmyduffynode "yum -y install git-core"
onmyduffynode "pip3 install pre-commit"
onmyduffynode "pip3 install --upgrade pip"
onmyduffynode "export RPM_PY_SYS=true"
onmyduffynode "yum install -y rebase-helper krb5-libs krb5-devel krb5-workstation"
synctoduffynode "./." // copy all source files (hidden too, we need .git/)
}
stage ("Setup Openshift Cluster"){
onmyduffynode "ansible-playbook -v -i localhost, --connection=local ./files/install-openshift.yaml"
}
stage ("Image build"){
onmyduffynode "make test-image-build"
}
stage ("Tests"){
onmyduffynode "pytest --color=yes --verbose --showlocals ./tests"
}
stage ("Linters"){
onmyduffynode "pre-commit run --all-files"
}
} catch (e) {
currentBuild.result = "FAILURE"
throw e
} finally {
stage("Cleanup"){
sh 'cico node done ${DUFFY_SSID}'
}
}
}
}