From c8f9cb6bf787cbb08a7b24e0491d7a4c3597525a Mon Sep 17 00:00:00 2001 From: dudgns2947 <dudgns2947@gmail.com> Date: Thu, 21 Jul 2022 16:02:17 +0900 Subject: [PATCH] modify JenkinsFile --- Jenkinsfile | 113 ++++++++++++++++++---------------------------------- 1 file changed, 38 insertions(+), 75 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1f2d94b..d9dd54d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,81 +1,44 @@ pipeline { - - agent any - - stages { - - stage('Prepare') { - - agent any - - steps { - - checkout scm - - } - - post { - - success { - - echo 'prepare success' - - } - - always { - - echo 'done prepare' - - } - - cleanup { - - echo 'after all other post conditions' - + agent any + environment { + userId = "KYH" + } + stages { + stage('Prepare'){ + agent any + steps { + checkout scm + } + }post { + success{ + echo 'prepare success' + } + always{ + echo 'done prepare' + slackSend (channel: '#devops', color: '#FFFF00'), + message: "${env.userId}" STARTED:Job '${env.JOB_NAME}' [$(env.BUILD_NUMBER)](${env.BUILD_URL}) + } + cleanup{ + echo 'after all other post conditions' + } } - - } - } - - - -pipeline { - - agent any - - stages { - - stage('Prepare') { - - agent any - - steps { - - checkout scm - - } - - post { - - success { - - echo 'prepare success' - + stage('maven build'){ + steps { + sh 'mvn package' } - - always { - - echo 'done prepare' - + post { + success{ + echo 'maven build success' + } + always{ + echo 'done maven build' + slackSend (channel: '#devops', color: '#FFFF00'), + message: "${env.userId}" STARTED:Job '${env.JOB_NAME}' [$(env.BUILD_NUMBER)](${env.BUILD_URL}) + } } - - cleanup { - - echo 'after all other post conditions' - + failure { + echo 'maven build failed' } - - } - - } \ No newline at end of file + } +} \ No newline at end of file -- GitLab