Files
kiz-shop/Jenkinsfile
mindol1004 d55499f976
All checks were successful
kiz-shop-pipeline/pipeline/head This commit looks good
commit
2023-12-26 14:57:59 +09:00

97 lines
1.7 KiB
Groovy

pipeline {
agent any
tools {
jdk 'jdk17'
}
environment {
imagename = "mindol1004/kiz"
registryCredential = 'docker'
dockerImage = ''
}
stages {
// repository clone
stage('Repository clone') {
steps {
script {
// 새로운 클론
echo 'Cloning Repository'
git url: 'http://mindol.synology.me:8418/kiz-cloud/kiz-shop.git',
branch: 'main',
credentialsId: 'Gitea'
}
}
post {
success {
echo 'Successfully Cloned Repository'
}
failure {
error 'This pipeline stops here...'
}
}
}
// gradle build
stage('Bulid Gradle') {
agent any
steps {
echo 'Bulid Gradle'
dir ('/var/jenkins_home/workspace/kiz-shop'){
sh './gradlew clean build'
}
}
post {
success {
echo 'Successfully Bulid Gradle'
}
failure {
error 'This pipeline stops here...'
}
}
}
// docker build
stage('Bulid Docker') {
agent any
steps {
echo 'Bulid Docker'
script {
dir ('/var/jenkins_home/workspace/kiz-shop'){
dockerImage = docker.build imagename
}
}
}
post {
success {
echo 'Successfully Bulid Docker'
}
failure {
error 'This pipeline stops here...'
}
}
}
// docker push
stage('Push Docker') {
agent any
steps {
echo 'Push Docker'
script {
docker.withRegistry('', registryCredential){
dockerImage.push("1.0")
}
}
}
post {
success {
echo 'Successfully Push Docker'
}
failure {
error 'This pipeline stops here...'
}
}
}
}
}