blob: 3f372e8570e89c7ca1d6a81afe2692dc2e636dab (
plain)
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
#!/bin/bash
# Copyright 2012,2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
#
# define some variables
#
URL="http://anonscm.debian.org/viewvc/d-i/trunk/.mrconfig?view=co"
FAIL=false
DI_BUILD_JOB_PATTERN=d-i_build_
DI_MANUAL_JOB_PATTERN=d-i_manual_
TMPFILE=$(mktemp)
JOB_TEMPLATES=$(mktemp)
PROJECT_JOBS=$(mktemp)
CLEANUP=$(mktemp)
#
# check for missing d-i package build jobs
# for this, we compare referred git repos in .mrconfig against locally existing jenkins jobs
# (see http://wiki.debian.org/DebianInstaller/CheckOut)
#
echo
echo "Scanning $URL for referred git repos which have no jenkins job associated."
curl $URL > $TMPFILE 2>/dev/null
PACKAGES=$( grep git.debian.org/git/d-i $TMPFILE|cut -d "/" -f6-|cut -d " " -f1)
#
# check for each git repo if a jenkins job exists
#
for PACKAGE in $PACKAGES ; do
if grep -A 1 git+ssh://git.debian.org/git/d-i/$PACKAGE $TMPFILE | grep -q "deleted = true" ; then
# ignore deleted repos
echo "Info: git+ssh://git.debian.org/git/d-i/$PACKAGE ignored as it has been deleted."
continue
elif [ ! -d ~jenkins/jobs/${DI_BUILD_JOB_PATTERN}${PACKAGE} ] ; then
echo "Warning: No build job '${DI_BUILD_JOB_PATTERN}${PACKAGE}'."
FAIL=true
#
# prepare yaml bits
#
echo " - '{name}_build_$PACKAGE':" >> $PROJECT_JOBS
echo " gitrepo: 'git://git.debian.org/git/d-i/$PACKAGE'" >> $PROJECT_JOBS
echo "- job-template:" >> $JOB_TEMPLATES
echo " defaults: d-i-build" >> $JOB_TEMPLATES
echo " name: '{name}_build_$PACKAGE'" >> $JOB_TEMPLATES
else
echo "Ok: Job '${DI_BUILD_JOB_PATTERN}${PACKAGE}' exists."
fi
done
echo
#
# check for each job if there still is a git repo
#
echo "Checking if there are jenkins jobs for which there is no repo in $URL - or only a deleted one."
for JOB in $(ls -1 ~jenkins/jobs/ | grep ${DI_BUILD_JOB_PATTERN}) ; do
REPONAME=${JOB:10}
if grep -q git+ssh://git.debian.org/git/d-i/$REPONAME $TMPFILE ; then
if grep -A 1 git+ssh://git.debian.org/git/d-i/$REPONAME $TMPFILE | grep -q "deleted = true" ; then
echo "Warning: Job $JOB exists, but has 'deleted = true' set in .mrconfig."
if ! grep -q "'git://git.debian.org/git/d-i/$REPONAME'" /srv/jenkins/job-cfg/d-i.yaml ; then
echo "jenkins-jobs delete $JOB" >> $CLEANUP
else
echo "# Please remove $JOB from job-cfg/d-i.yaml before deleting the job." >> $CLEANUP
fi
else
echo "Ok: Job $JOB for git+ssh://git.debian.org/git/d-i/$REPONAME found."
fi
else
echo "Warning: Git repo $REPONAME not found in $URL, but job $JOB exists."
fi
done
# cleanup
rm $TMPFILE
echo
#
# check for missing d-i manual language build jobs
#
# first the xml translations...
#
cd ~jenkins/jobs/d-i_manual/workspace/manual
IGNORE="build debian doc README scripts build-stamp doc-base-stamp po"
for DIRECTORY in * ; do
# Some languages are unsupported
case $DIRECTORY in
eu) echo "The manual for the language $DIRECTORY has been disabled."
continue ;;
esac
for i in $IGNORE ; do
if [ "$DIRECTORY" = "$i" ] ; then
DIRECTORY=""
break
fi
done
if [ "$DIRECTORY" = "" ] ; then
continue
else
for FORMAT in pdf html ; do
if [ $FORMAT = pdf ] ; then
# Some languages are unsupported in PDF
case $DIRECTORY in
el|ja|vi|zh_CN|zh_TW) continue ;;
esac
fi
if [ ! -d ~jenkins/jobs/${DI_MANUAL_JOB_PATTERN}${DIRECTORY}_${FORMAT} ] ; then
echo "Warning: No build job '${DI_MANUAL_JOB_PATTERN}${DIRECTORY}_${FORMAT}'."
FAIL=true
#
# prepare yaml bits
#
echo " - '{name}_manual_${DIRECTORY}_${FORMAT}':" >> $PROJECT_JOBS
echo " lang: '$DIRECTORY'" >> $PROJECT_JOBS
echo " languagename: 'FIXME: $DIRECTORY'" >> $PROJECT_JOBS
echo "- job-template:" >> $JOB_TEMPLATES
echo " defaults: d-i-manual-${FORMAT}" >> $JOB_TEMPLATES
echo " name: '{name}_manual_${DIRECTORY}_${FORMAT}'" >> $JOB_TEMPLATES
fi
done
fi
done
# FIXME: check for removed manuals (but with existing jobs) missing - for all types of manuals and build jobs
#
# ...and now the translations kept in po files....
cd po
IGNORE="pot README"
for DIRECTORY in * ; do
for i in $IGNORE ; do
if [ "$DIRECTORY" = "$i" ] ; then
DIRECTORY=""
break
fi
done
if [ "$DIRECTORY" = "" ] ; then
continue
else
for FORMAT in pdf html ; do
if [ $FORMAT = pdf ] ; then
# Some languages are unsupported in PDF
case $DIRECTORY in
el|ja|vi|zh_CN|zh_TW) continue ;;
esac
fi
if [ ! -d ~jenkins/jobs/${DI_MANUAL_JOB_PATTERN}${DIRECTORY}_${FORMAT} ] ; then
echo "Warning: No build job '${DI_MANUAL_JOB_PATTERN}${DIRECTORY}_${FORMAT}'."
FAIL=true
#
# prepare yaml bits - po2xml jobs just use different defaults
#
echo " - '{name}_manual_${DIRECTORY}_${FORMAT}':" >> $PROJECT_JOBS
echo " lang: '$DIRECTORY'" >> $PROJECT_JOBS
echo " languagename: 'FIXME: $DIRECTORY'" >> $PROJECT_JOBS
echo "- job-template:" >> $JOB_TEMPLATES
echo " defaults: d-i-manual-${FORMAT}-po2xml" >> $JOB_TEMPLATES
echo " name: '{name}_manual_${DIRECTORY}_${FORMAT}'" >> $JOB_TEMPLATES
fi
done
fi
done
#
# fail this job if missing d-i jobs are detected
#
echo
if $FAIL ; then
figlet "Missing jobs!"
echo
echo "Add these job templates to job-cfg/d-i.yaml:"
cat $JOB_TEMPLATES
echo
echo
echo "Append this to the project definition in job-cfg/d-i.yaml:"
cat $PROJECT_JOBS
echo
rm -f $JOB_TEMPLATES $PROJECT_JOBS $CLEANUP
exit 1
elif [ -s $CLEANUP ] ; then
echo
echo "Warning: some jobs exist which should be deleted, run these commands to clean up:"
echo
cat $CLEANUP
echo
echo "Jobs need to be deleted from job-cfg/d-i.yaml first, before deleting them with jenkins-jobs, cause else they will be recreated and then builds will be attempted, which will fail and cause notifications..."
else
echo "Everything ok."
fi
rm -f $CLEANUP
echo
|