-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
69 lines (58 loc) · 1.83 KB
/
Jenkinsfile
File metadata and controls
69 lines (58 loc) · 1.83 KB
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
pipeline {
environment {
SPRING_DATASOURCE_URL = "jdbc:h2:file:./build/test"
SPRING_DATASOURCE_USERNAME = "sa"
SPRING_DATASOURCE_PASSWORD = ""
JWT_SECRET = credentials('findme-jwt-secret')
AWS_ACCESSKEY = credentials('findme-aws-access-key')
AWS_SECRETKEY = credentials('findme-aws-secret-access-key')
AWS_BUCKETNAME = credentials('findme-aws-bucket-name')
npm_config_cache = "npm-cache" // required to prevent issues with file permissions in container
}
agent any
tools {
jdk 'jdk8'
maven 'M3'
}
stages {
stage('Clone FindMe Repo') {
steps {
git 'https://github.com/daniel-cole/FindMe2.0'
}
}
stage('Build FindMe War') {
steps {
sh 'mvn clean package'
}
}
stage('Build FindMe Image') {
steps {
script {
jarFile = sh(
script: 'echo target/$(ls target/ | egrep "findme.*\\.jar$")',
returnStdout: true
).trim()
}
script {
imageId = sh(
script: "docker build -q --build-arg FINDME_JAR=${jarFile} . -t thekingwizard/findme:lts",
returnStdout: true
).trim()
}
}
}
stage('Push FindMe Image') {
steps {
withDockerRegistry([credentialsId: 'docker-hub-credentials', url: 'https://index.docker.io/v1/']) {
sh 'docker push thekingwizard/findme:lts'
sh "docker rmi ${imageId}"
}
}
}
}
post {
success {
archive "target/*.jar"
}
}
}