forked from peterarsentev/job4j_devops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
61 lines (58 loc) · 1.68 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
pipeline {
agent { label 'agent-jdk21' }
tools {
git 'Default'
}
stages {
stage('Prepare Environment') {
steps {
sh 'chmod +x ./gradlew'
}
}
stage('Check') {
steps {
sh './gradlew check -P"dotenv.filename"="/var/agent-jdk21/env/.env.develop"'
}
}
stage('Package') {
steps {
sh './gradlew build -P"dotenv.filename"="/var/agent-jdk21/env/.env.develop"'
}
}
stage('JaCoCo Report') {
steps {
sh './gradlew jacocoTestReport -P"dotenv.filename"="/var/agent-jdk21/env/.env.develop"'
}
}
stage('JaCoCo Verification') {
steps {
sh './gradlew jacocoTestCoverageVerification -P"dotenv.filename"="/var/agent-jdk21/env/.env.develop"'
}
}
stage('Docker Build') {
steps {
sh 'docker build -t job4j_devops .'
}
}
stage('Update DB') {
steps {
script {
sh './gradlew update -P"dotenv.filename"="/var/agent-jdk21/env/.env.develop"'
}
}
}
}
post {
always {
script {
def buildInfo = """
Build number: ${currentBuild.number}
Build status: ${currentBuild.currentResult}
Started at: ${new Date(currentBuild.startTimeInMillis)}
Duration: ${currentBuild.durationString}
"""
telegramSend(message: buildInfo)
}
}
}
}