-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
62 lines (58 loc) · 1.88 KB
/
Jenkinsfile
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
#!groovy
pipeline {
agent {
label 'docker'
}
options {
buildDiscarder(logRotator(daysToKeepStr:'15'))
}
stages {
stage('Build') {
steps {
ansiColor('xterm') {
sh "docker build -t epitechcontent/vera:latest ."
}
}
}
stage('Archive') {
when {
not {
expression {
return params.RELEASE
}
}
}
steps {
ansiColor('xterm') {
script {
docker.withRegistry('https://nexus.epitest.eu:9081/', 'nexus-epitest-ci') {
sh "docker tag epitechcontent/vera:latest nexus.epitest.eu:9081/epitechcontent/vera:latest && docker push nexus.epitest.eu:9081/epitechcontent/vera:latest"
}
docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-login') {
sh "docker push epitechcontent/vera:latest"
}
}
}
}
}
}
post {
success {
withCredentials([string(credentialsId: 'teams-webhook', variable: 'TEAMS_WEBHOOK')]) {
script {
office365ConnectorSend message: "Build Success for $JOB_NAME#$BUILD_ID", status:"Success", webhookUrl:"$TEAMS_WEBHOOK"
}
}
}
failure {
withCredentials([string(credentialsId: 'teams-webhook', variable: 'TEAMS_WEBHOOK')]) {
script {
office365ConnectorSend message: "Build Failure for $JOB_NAME#$BUILD_ID", status:"Failure", webhookUrl:"$TEAMS_WEBHOOK"
}
}
}
always {
deleteDir()
}
}
}