-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkinsfile
40 lines (36 loc) · 872 Bytes
/
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
pipeline {
agent { label 'Jenkins-Agent' }
tools {
jdk 'Java17'
maven 'Maven3'
}
environment {
APP_NAME = "simple-app-pipeline"
RELEASE = "1.0.0"
DOCKER_USER = "ritish134"
DOCKER_PASS = 'dockerhub'
IMAGE_NAME = "${DOCKER_USER}" + "/" + "${APP_NAME}"
IMAGE_TAG = "${RELEASE}-${BUILD_NUMBER}"
JENKINS_API_TOKEN = credentials("JENKINS_API_TOKEN")
}
stages{
stage("Cleanup Workspace"){
steps {
cleanWs()
}
}
stage("Checkout from SCM"){
steps {
git branch: 'main', credentialsId: 'github', url: 'https://github.com/ritish134/simple-app'
}
}
stage("Build Application"){
steps {
sh "mvn clean package"
}
}
stage("Test Application"){
steps {
sh "mvn test"
}
}