-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
51 lines (43 loc) · 1.16 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
pipeline {
agent {
node {
label 'jenkins-agent'
}
}
tools {
maven 'maven3.9.5'
jdk 'jdk17'
// 'org.jenkinsci.plugins.docker.commons.tools.DockerTool' 'docker'
}
environment {
def dockerHome = tool 'docker'
PATH = "${dockerHome}/bin:${env.PATH}"
}
stages {
stage('checkout code') {
steps {
git branch: 'main', changelog: false, poll: false, url: 'https://github.com/HIMMIREDA/spring-reddit-clone-backend.git'
}
}
stage('Compile') {
steps {
sh 'mvn clean compile'
}
}
stage('run unit tests') {
steps {
sh 'mvn test'
}
}
stage('build docker image'){
steps {
script {
sh 'mvn compile jib:dockerBuild'
withDockerRegistry(credentialsId: '996a93d4-f694-43b6-911e-f9a4be5e9181', toolName: 'docker') {
sh 'docker push redahimmi/spring-reddit-clone'
}
}
}
}
}
}