-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraalvm-native-maven-template-alternative.yaml
148 lines (148 loc) · 4.14 KB
/
graalvm-native-maven-template-alternative.yaml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
apiVersion: v1
kind: Template
metadata:
creationTimestamp: null
name: graalvm-native-maven-template
parameters:
- name: GIT_REPO
description: "The git repo to use"
- name: GIT_BRANCH
description: "The git repo branch to use"
- name: APP_NAME
descriptiom: "The app name used in build config and image stream names"
- name: REFLECTION_CONFIGURATION_RESOURCES
description: classpath location of resources for reflection configuration.
objects:
- apiVersion: v1
kind: BuildConfig
metadata:
creationTimestamp: null
name: ${APP_NAME}-pipeline
spec:
nodeSelector: {}
output: {}
postCommit: {}
resources: {}
runPolicy: Serial
strategy:
jenkinsPipelineStrategy:
jenkinsfile: |-
pipeline {
agent {
node {
label 'maven'
}
}
stages {
stage('checkout'){
steps{
git url: '${GIT_REPO}', branch: '${GIT_BRANCH}'
}
}
stage('build') {
steps {
sh '''
mvn install:install-file -Dfile=${JAVA_HOME}/jre/lib/svm/builder/svm.jar -DgroupId=com.oracle.substratevm -DartifactId=svm -Dversion=GraalVM-1.0.0-rc5 -Dpackaging=jar
mvn clean package
'''
}
}
stage('build image') {
steps {
sh '''
cd target
native-image \
--no-server \
-H:+ReportUnsupportedElementsAtRuntime \
-H:ReflectionConfigurationResources=${REFLECTION_CONFIGURATION_RESOURCES} \
--static \
-jar $(ls *.jar)
mv $(basename $(ls *.jar) .jar) app
'''
}
}
stage('scratch image build') {
steps {
sh '''
oc start-build ${APP_NAME}-scratch --from-dir=. --follow
'''
}
}
}
}
triggers: []
status:
lastVersion: 0
- apiVersion: v1
kind: BuildConfig
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewBuild
creationTimestamp: null
labels:
build: ${APP_NAME}-scratch
name: ${APP_NAME}-scratch
spec:
failedBuildsHistoryLimit: 5
nodeSelector: null
output:
to:
kind: ImageStreamTag
name: ${APP_NAME}-scratch:latest
postCommit: {}
resources: {}
runPolicy: Serial
source:
dockerfile: |-
FROM scratch
COPY target/app /app
CMD ["/app"]
strategy:
dockerStrategy:
noCache: true
from:
kind: DockerImage
name: scratch
type: Docker
successfulBuildsHistoryLimit: 5
triggers:
- github:
secret: 3ThIYgvq0CGJ3be_QgFY
type: GitHub
- generic:
secret: W_uXkLseAnD4Y5lgJ31G
type: Generic
- imageChange:
from:
kind: ImageStreamTag
name: ${APP_NAME}-ubuntu:latest
type: ImageChange
- type: ConfigChange
status:
lastVersion: 0
- apiVersion: v1
kind: ImageStream
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewBuild
openshift.io/image.dockerRepositoryCheck: 2018-08-19T09:30:21Z
creationTimestamp: null
generation: 2
labels:
build: ${APP_NAME}-scratch
name: ${APP_NAME}-scratch
spec:
lookupPolicy:
local: false
tags:
- annotations: null
from:
kind: DockerImage
name: 172.30.1.1:5000/myproject/${APP_NAME}-scratch:latest
generation: 2
importPolicy: {}
name: latest
referencePolicy:
type: Source
status:
dockerImageRepository: ""