cicd-java-spring-boot/Jenkinsfile

51 lines
943 B
Plaintext
Raw Normal View History

2023-02-01 09:17:31 +00:00
podTemplate(containers: [
containerTemplate(
2023-02-01 09:25:05 +00:00
name: 'gradle',
image: 'gradle:7.6.0-jdk11',
command: 'sleep',
args: '30d'
2023-02-01 09:17:31 +00:00
)
]) {
2023-02-01 08:34:23 +00:00
2023-02-01 09:17:31 +00:00
node(POD_LABEL) {
2023-02-01 09:25:05 +00:00
stage('Get a Gradle project') {
container('gradle') {
stage('Build a Gradle project') {
2023-02-01 09:17:31 +00:00
sh '''
2023-02-01 09:25:05 +00:00
echo "gradle build"
2023-02-01 09:17:31 +00:00
'''
2023-02-01 08:18:35 +00:00
}
}
2023-02-01 07:26:49 +00:00
}
2023-02-01 08:18:35 +00:00
2023-01-31 13:42:28 +00:00
}
2023-02-01 09:48:49 +00:00
}
pipeline {
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
metadata:
labels:
some-label: some-label-value
spec:
containers:
- name: gradle
image: gradle:7.6.0-jdk11
tty: true
'''
retries 2
}
}
stages {
stage('Run gradle') {
steps {
container('gradle') {
sh './gradlew clean build'
}
}
}
}
2023-01-31 13:42:28 +00:00
}