-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
72 lines (60 loc) · 1.67 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
63
64
65
66
67
68
69
70
71
72
pipeline {
agent any
tools {
nodejs '18.12.1'
}
environment {
DOCKERHUB_CREDENTIALS = credentials('dockerhub')
}
stages {
stage('Install dependencies') {
steps {
sh 'yarn'
}
}
stage('Unit Tests') {
steps {
sh 'yarn test --coverage'
}
post {
always {
step([$class: 'CoberturaPublisher', coberturaReportFile: 'coverage/cobertura-coverage.xml'])
}
}
}
stage('Integration Tests') {
steps {
sh 'yarn test:int'
}
}
stage('Build') {
steps {
sh 'yarn build'
}
}
stage('Create image') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
sh 'docker build -t course-platform .'
sh 'docker tag course-platform caiquet/course-platform:' + params.tag
sh 'docker push caiquet/course-platform:' + params.tag
}
}
}
post {
always {
script {
def title
def description
if (currentBuild.currentResult == 'SUCCESS') {
title = 'Pipeline succeeded!'
description = "The app has been built and has already been uploaded to DockerHub"
} else {
title = 'Pipeline failed!'
description = "Something happened while running the pipeline"
}
discordSend description: description, footer: '', image: '', link: '', result: currentBuild.currentResult, scmWebUrl: '', thumbnail: '', title: title, webhookURL: 'https://discord.com/api/webhooks/1109608740216389702/xAUq1P10hz8HFYoEiKAbWkbkVk3bw-yvEE-s0Wwauge_6vkL7mvTThHzNwaAgWg86v5l'
}
}
}
}