Add hooks to debian packages test pipeline
This commit is contained in:
parent
97aa9b61dd
commit
eef92cec62
|
@ -47,16 +47,61 @@ pipeline {
|
|||
stage("Test package installation") {
|
||||
steps {
|
||||
script {
|
||||
nebula.runScriptInNewVM([
|
||||
vmTemplate: params.vmTemplate,
|
||||
script: """
|
||||
set -xeo pipefail
|
||||
wget -qO - https://vulcain.cadoles.com/cadoles.gpg | apt-key add -
|
||||
echo 'deb https://vulcain.cadoles.com ${params.packageRepository} main' > /etc/apt/sources.list.d/${params.packageRepository}.list
|
||||
apt-get update -y
|
||||
apt-get install -y ${params.packageName}${ params.packageVersion?.trim() ? '=' + params.packageVersion?.trim() : ''}
|
||||
"""
|
||||
])
|
||||
nebula.runInNewVM([vmTemplate: params.vmTemplate]) { shell ->
|
||||
|
||||
// On ajoute le dépôt Vulcain sur la machine et on met
|
||||
// à jour la liste des paquets
|
||||
stage("Add Vulcain '${params.packageRepository}' repository") {
|
||||
shell("""
|
||||
set -xeo pipefail
|
||||
wget -qO - https://vulcain.cadoles.com/cadoles.gpg | apt-key add -
|
||||
echo 'deb https://vulcain.cadoles.com ${params.packageRepository} main' > /etc/apt/sources.list.d/${params.packageRepository}.list
|
||||
apt-get update -y
|
||||
""")
|
||||
}
|
||||
|
||||
// On installe le paquet dans la version demandée (si celle ci est fournie)
|
||||
stage("Install package '${params.packageName}${ params.packageVersion?.trim() ? '=' + params.packageVersion?.trim() : ''}'") {
|
||||
hook("pre-install")
|
||||
shell("""
|
||||
set -xeo pipefail
|
||||
apt-get install -y ${params.packageName}${ params.packageVersion?.trim() ? '=' + params.packageVersion?.trim() : ''}
|
||||
""")
|
||||
hook("post-install")
|
||||
}
|
||||
|
||||
// Si le template de VM est basé sur EOLE, alors on tente
|
||||
// d'appliquer un CreoleLint sur les dicos/templates qui pourraient être
|
||||
// distribués par le paquet nouvellement installé
|
||||
if (params.vmTemplate.contains('eole')) {
|
||||
stage("Lint Creole templates") {
|
||||
shell("""
|
||||
set -xeo pipefail
|
||||
TEMPLATES=\$(dpkg -L ${params.packageName} | grep /usr/share/eole/creole/distrib/ || true)
|
||||
if [ -z "\$TEMPLATES" ]; then
|
||||
echo "Aucun template Creole dans le paquet."
|
||||
exit 0
|
||||
fi
|
||||
for tmpl in \$TEMPLATES; do
|
||||
CreoleLint -t \$(basename \$tmpl)
|
||||
done
|
||||
""")
|
||||
}
|
||||
stage("Lint Creole dictionnaries") {
|
||||
shell("""
|
||||
set -xeo pipefail
|
||||
DICOS=\$(dpkg -L ${params.packageName} | grep /usr/share/eole/creole/dicos/ || true)
|
||||
if [ -z "\$DICOS" ]; then
|
||||
echo "Aucun dictionnaire Creole dans le paquet."
|
||||
exit 0
|
||||
fi
|
||||
for dico in \$DICOS; do
|
||||
CreoleLint -d \$(basename \$DICOS)
|
||||
done
|
||||
""")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue