2019-03-01 15:16:42 +01:00
|
|
|
@Library("cadoles") _
|
|
|
|
|
|
|
|
pipeline {
|
|
|
|
|
|
|
|
agent {
|
|
|
|
label 'common'
|
|
|
|
}
|
|
|
|
|
|
|
|
parameters {
|
|
|
|
string(
|
|
|
|
name: 'packageName',
|
|
|
|
description: 'Nom du paquet à installer'
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'packageVersion',
|
|
|
|
defaultValue: '',
|
|
|
|
description: 'Version du paquet à installer'
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'packageRepository',
|
|
|
|
description: 'Dépôt de paquets à utiliser sur Vulcain'
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'vmTemplate',
|
|
|
|
description: 'Template OpenNebula de la VM à utiliser pour le test d\'installation'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
|
|
|
|
stage("Check parameters") {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
if (!params.packageName?.trim()) {
|
|
|
|
error("Le nom du paquet n'est pas défini !")
|
|
|
|
}
|
|
|
|
if (!params.vmTemplate?.trim()) {
|
|
|
|
error("Le template de VM n'est pas défini !")
|
|
|
|
}
|
|
|
|
if (!params.packageRepository?.trim()) {
|
|
|
|
error("Le dépôt de paquets n'est pas défini !")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage("Test package installation") {
|
|
|
|
steps {
|
|
|
|
script {
|
2019-03-01 15:27:08 +01:00
|
|
|
nebula.runScriptInNewVM([
|
2019-03-01 15:16:42 +01:00
|
|
|
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() : ''}
|
|
|
|
"""
|
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
|
|
|
failure {
|
|
|
|
wrap([$class: 'BuildUser']) {
|
|
|
|
rocketSend (
|
|
|
|
avatar: 'https://jenkins.cadol.es/static/b5f67753/images/headshot.png',
|
|
|
|
message: """
|
|
|
|
Le test d'installation du paquet `${params.packageName}` a échoué:
|
|
|
|
|
|
|
|
- Version `${params.packageVersion}`
|
|
|
|
- Dépôt `${params.packageRepository}`
|
|
|
|
- Template de la VM `${params.vmTemplate}`
|
|
|
|
|
|
|
|
[Voir le job](${env.RUN_DISPLAY_URL})
|
|
|
|
|
|
|
|
@${env.BUILD_USER_ID ? env.BUILD_USER_ID : 'here'}
|
|
|
|
""".stripIndent(),
|
|
|
|
rawMessage: true
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|