cicd-java-spring-boot/Jenkinsfile
2023-02-01 09:48:49 +00:00

51 lines
943 B
Groovy

podTemplate(containers: [
containerTemplate(
name: 'gradle',
image: 'gradle:7.6.0-jdk11',
command: 'sleep',
args: '30d'
)
]) {
node(POD_LABEL) {
stage('Get a Gradle project') {
container('gradle') {
stage('Build a Gradle project') {
sh '''
echo "gradle build"
'''
}
}
}
}
}
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'
}
}
}
}
}