forked from fbladilo/v2v-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
176 lines (162 loc) · 4.71 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
@Library('rhv-qe-jenkins-library-khakimi@add_req_ansible') _
properties(
[
parameters(
[
string(defaultValue: 'v2v-node', description: 'Name or label of slave to run on.', name: 'NODE_LABEL'),
string(defaultValue: '', description: 'Gerrit refspec for cherry pick', name: 'JENKINS_GERRIT_REFSPEC'),
booleanParam(defaultValue: false, description: 'Nightly pre check', name: 'MIQ_NIGHTLY_PRE_CHECK'),
booleanParam(defaultValue: false, description: 'Remove existing instance', name: 'MIQ_REMOVE_EXISTING_INSTANCE'),
]
),
]
)
pipeline {
agent {
node {
label params.NODE_LABEL ? params.NODE_LABEL : null
}
}
stages {
stage ("Checkout jenkins repository") {
steps {
checkout(
[
$class: 'GitSCM',
branches: [[name: 'origin/rhevm-4.2']],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'jenkins'],
[$class: 'CleanBeforeCheckout'],
[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true],
[$class: 'PruneStaleBranch']
],
submoduleCfg: [],
userRemoteConfigs: [[url: 'git://git.app.eng.bos.redhat.com/rhevm-jenkins.git']]
]
)
sh '''echo "Executed from: v2v Jenkinsfile"
if [ -d $WORKSPACE/jenkins ]
then
pushd $WORKSPACE/jenkins
echo $JENKINS_GERRIT_REFSPEC
for ref in $JENKINS_GERRIT_REFSPEC ;
do
git fetch git://git.app.eng.bos.redhat.com/rhevm-jenkins.git "$ref" && git cherry-pick FETCH_HEAD || (
echo \'!!! FAIL TO CHERRYPICK !!!\' "$ref" ; false
)
done
popd
fi
'''
}
}
stage ("ManageIQ/CloudForms Pre-Check Nightly") {
when {
expression { params.MIQ_NIGHTLY_PRE_CHECK }
}
steps {
ansible(
playbook: "miq_run_step.yml",
extraVars: ['@jenkins/qe/v2v/extra_vars.yml', 'miq_pre_check_nightly=true'],
tags: ['miq_pre_check_nightly']
)
}
}
stage ("ManageIQ/CloudForms Remove existing instance") {
when {
expression { params.MIQ_REMOVE_EXISTING_INSTANCE }
}
steps {
ansible(
playbook: "miq_run_step.yml",
extraVars: ['@jenkins/qe/v2v/extra_vars.yml', 'miq_pre_check=true', 'v2v_ci_miq_vm_force_remove=true'],
tags: ['miq_pre_check']
)
}
}
stage ("ManageIQ/CloudForms Remove Pre-Check") {
when {
expression { params.MIQ_REMOVE_EXISTING_INSTANCE }
}
steps {
ansible(
playbook: "miq_run_step.yml",
extraVars: ['@jenkins/qe/v2v/extra_vars.yml'],
tags: ['miq_pre_check']
)
}
}
stage ("Deploy ManageIQ/CloudForms") {
steps {
ansible(
playbook: "miq_deploy.yml",
extraVars: ['@jenkins/qe/v2v/extra_vars.yml'],
)
}
}
stage ('Add extra providers') {
steps {
ansible(
playbook: 'miq_run_step.yml',
extraVars: ['@jenkins/qe/v2v/extra_vars.yml'],
tags: ['miq_add_extra_providers']
)
}
}
stage ('Configure oVirt conversion hosts') {
steps {
ansible(
playbook: 'miq_run_step.yml',
extraVars: ['@jenkins/qe/v2v/extra_vars.yml'],
tags: ['miq_config_ovirt_conversion_hosts']
)
}
}
stage ('Configure ESX hosts') {
steps {
ansible(
playbook: 'miq_run_step.yml',
extraVars: ['@jenkins/qe/v2v/extra_vars.yml'],
tags: ['miq_config_vmware_esx_hosts']
)
}
}
stage ('Create transformation mappings') {
steps {
ansible(
playbook: 'miq_run_step.yml',
extraVars: ['@jenkins/qe/v2v/extra_vars.yml'],
tags: ['miq_config_infra_mappings']
)
}
}
stage ('Create transformation plans') {
steps {
ansible(
playbook: 'miq_run_step.yml',
extraVars: ['@jenkins/qe/v2v/extra_vars.yml'],
tags: ['miq_config_migration_plan']
)
}
}
stage ('Execute transformation plans') {
steps {
ansible(
playbook: 'miq_run_step.yml',
extraVars: ['@jenkins/qe/v2v/extra_vars.yml'],
tags: ['miq_order_migration_plan']
)
}
}
stage ('Monitor transformation plans') {
steps {
ansible(
playbook: 'miq_run_step.yml',
extraVars: ['@jenkins/qe/v2v/extra_vars.yml'],
tags: ['miq_monitor_transformations']
)
}
}
}
}