87 lines
2.4 KiB
Plaintext
87 lines
2.4 KiB
Plaintext
|
@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.url?.trim()) {
|
||
|
error("L'URL du paquet n'est pas définie !")
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
stage("Test URL") {
|
||
|
steps {
|
||
|
script {
|
||
|
def w3afImage = buildDockerImage()
|
||
|
def dockerArgs = """
|
||
|
"""
|
||
|
tamarinImage.inside(dockerArgs) {
|
||
|
sh './w3af_console '
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
post {
|
||
|
failure {
|
||
|
wrap([$class: 'BuildUser']) {
|
||
|
rocketSend (
|
||
|
avatar: 'https://jenkins.cadol.es/static/b5f67753/images/headshot.png',
|
||
|
message: """
|
||
|
Le test de sécurité sur l'URL `${params.url}` a échoué:
|
||
|
|
||
|
[Voir le job](${env.RUN_DISPLAY_URL})
|
||
|
|
||
|
@${env.BUILD_USER_ID ? env.BUILD_USER_ID : 'here'}
|
||
|
""".stripIndent(),
|
||
|
rawMessage: true
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
def buildDockerImage() {
|
||
|
dir ('.w3af') {
|
||
|
def dockerfile = libraryResource 'com/cadoles/w3af/Dockerfile'
|
||
|
writeFile file:'Dockerfile', text:dockerfile
|
||
|
|
||
|
def audit = libraryResource 'com/cadoles/w3af/audit.w3af'
|
||
|
writeFile file:'audit.w3af', text:audit
|
||
|
|
||
|
def safeJobName = URLDecoder.decode(env.JOB_NAME).toLowerCase().replace('/', '-').replace(' ', '-')
|
||
|
def imageTag = "${safeJobName}-${env.BUILD_ID}"
|
||
|
return docker.build("w3af:${imageTag}", ".")
|
||
|
}
|
||
|
}
|