-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile.vault
176 lines (174 loc) · 10.6 KB
/
Jenkinsfile.vault
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
def erecipients = "[email protected]"
def ebody = """
${currentBuild.fullDisplayName} / ${currentBuild.number}
Check url: ${currentBuild.absoluteUrl}.
"""
def legacy_9_1_machine_names = ["almalinux9-1", "rockylinux9-1", "oracle9-1"]
def legacy_9_0_machine_names = ["almalinux9-0", "rockylinux9-0", "oracle9-0"]
def legacy_8_7_machine_names = ["almalinux8-7", "rockylinux8-7", "oracle8-7"]
def legacy_8_6_machine_names = ["almalinux8-6", "rockylinux8-6", "oracle8-6"]
def legacy_8_5_machine_names = ["almalinux8-5", "centos8-5", "oracle8-5", "rockylinux8-5"]
def legacy_8_4_machine_names = ["almalinux8-4", "centos8-4", "rockylinux8-4"]
pipeline {
agent {
node {
label 'libvirt'
}
}
stages {
stage("Migrate 8.6 systems to EuroLinux 8.6"){
steps{
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script{
parallel legacy_8_6_machine_names.collectEntries { vagrant_machine -> [ "${vagrant_machine}": {
stage("$vagrant_machine") {
sleep(5 * Math.random())
sh("vagrant destroy -f $vagrant_machine")
sh("vagrant up $vagrant_machine")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -b'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/migrate2eurolinux.sh -r /home/vagrant/eurolinux-migration-scripts/vault/vault-8.6.repo -f -v -w'")
sh("vagrant ssh $vagrant_machine -c 'sudo reboot' || true")
sleep(300)
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/test_what_non_el_remains_after_migration.sh'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -a'")
sh("vagrant destroy $vagrant_machine -f")
}
}]
}
}
}
}
}
stage("Migrate 8.5 systems to EuroLinux 8.5"){
steps{
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script{
parallel legacy_8_5_machine_names.collectEntries { vagrant_machine -> [ "${vagrant_machine}": {
stage("$vagrant_machine") {
sleep(5 * Math.random())
sh("vagrant destroy -f $vagrant_machine")
sh("vagrant up $vagrant_machine")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -b'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/migrate2eurolinux.sh -r /home/vagrant/eurolinux-migration-scripts/vault/vault-8.5.repo -f -v -w'")
sh("vagrant ssh $vagrant_machine -c 'sudo reboot' || true")
sleep(300)
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/test_what_non_el_remains_after_migration.sh'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -a'")
sh("vagrant destroy $vagrant_machine -f")
}
}]
}
}
}
}
}
stage("Migrate 8.4 systems to EuroLinux 8.4"){
steps{
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script{
parallel legacy_8_4_machine_names.collectEntries { vagrant_machine -> [ "${vagrant_machine}": {
stage("$vagrant_machine") {
sleep(5 * Math.random())
sh("vagrant destroy -f $vagrant_machine")
sh("vagrant up $vagrant_machine")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -b'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/migrate2eurolinux.sh -r /home/vagrant/eurolinux-migration-scripts/vault/vault-8.4.repo -f -v -w'")
sh("vagrant ssh $vagrant_machine -c 'sudo reboot' || true")
sleep(300)
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/test_what_non_el_remains_after_migration.sh'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -a'")
sh("vagrant destroy $vagrant_machine -f")
}
}]
}
}
}
}
}
stage("Migrate 8.6 systems to EuroLinux 8.6 and preserve non-EuroLinux packages"){
steps{
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script{
parallel legacy_8_6_machine_names.collectEntries { vagrant_machine -> [ "${vagrant_machine}": {
stage("$vagrant_machine") {
sleep(5 * Math.random())
sh("vagrant destroy -f $vagrant_machine")
sh("vagrant up $vagrant_machine")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -b'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/migrate2eurolinux.sh -r /home/vagrant/eurolinux-migration-scripts/vault/vault-8.6.repo -f -v'")
sh("vagrant ssh $vagrant_machine -c 'sudo reboot' || true")
sleep(300)
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/test_what_non_el_remains_after_migration.sh -t'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -a'")
sh("vagrant destroy $vagrant_machine -f")
}
}]
}
}
}
}
}
stage("Migrate 8.5 systems to EuroLinux 8.5 and preserve non-EuroLinux packages"){
steps{
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script{
parallel legacy_8_5_machine_names.collectEntries { vagrant_machine -> [ "${vagrant_machine}": {
stage("$vagrant_machine") {
sleep(5 * Math.random())
sh("vagrant destroy -f $vagrant_machine")
sh("vagrant up $vagrant_machine")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -b'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/migrate2eurolinux.sh -r /home/vagrant/eurolinux-migration-scripts/vault/vault-8.5.repo -f -v'")
sh("vagrant ssh $vagrant_machine -c 'sudo reboot' || true")
sleep(300)
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/test_what_non_el_remains_after_migration.sh -t'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -a'")
sh("vagrant destroy $vagrant_machine -f")
}
}]
}
}
}
}
}
stage("Migrate 8.4 systems to EuroLinux 8.4 and preserve non-EuroLinux packages"){
steps{
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script{
parallel legacy_8_4_machine_names.collectEntries { vagrant_machine -> [ "${vagrant_machine}": {
stage("$vagrant_machine") {
sleep(5 * Math.random())
sh("vagrant destroy -f $vagrant_machine")
sh("vagrant up $vagrant_machine")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -b'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/migrate2eurolinux.sh -r /home/vagrant/eurolinux-migration-scripts/vault/vault-8.4.repo -f -v'")
sh("vagrant ssh $vagrant_machine -c 'sudo reboot' || true")
sleep(300)
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/test_what_non_el_remains_after_migration.sh -t'")
sh("vagrant ssh $vagrant_machine -c 'sudo /home/vagrant/eurolinux-migration-scripts/check_redhat_assets.sh -a'")
sh("vagrant destroy $vagrant_machine -f")
}
}]
}
}
}
}
}
}
post {
success {
echo 'Pipeline finished'
}
failure {
echo 'Pipeline failed'
mail to: erecipients,
subject: "Pipeline failed: ${currentBuild.fullDisplayName}",
body: ebody
}
always {
echo 'Running "vagrant destroy -f"'
sh("vagrant destroy -f")
cleanWs()
}
}
}