Skip to content

Commit

Permalink
ci: Modify Jenkinsfile to add gradle build (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
nusuy committed Oct 11, 2023
1 parent 76bd21f commit 4af9c8f
Showing 1 changed file with 51 additions and 9 deletions.
60 changes: 51 additions & 9 deletions ci/nusuy/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,59 @@ pipeline {
}

stages {
stage('Print Hello') {
stage('Ready') {
steps {
echo '* * * SUCCESS: Hello Jenkins!'
echo 'Ready to build...'
git branch: env.BRANCH_NAME,
credentialsId: 'Iv1.2497a20421157e60',
url: 'https://github.com/GDSC-CUBIX/EZPZ-Infra-Study'
}
}

stage('Set application.properties') {
steps {
withCredentials([file(credentialsId: 'cubix-secret', variable: 'secret'),
file(credentialsId: 'cubix-secret-test', variable: 'testSecret')]) {
script {
sh 'chmod -R 777 dev/nusuy/ext-search-batch/src/'

sh 'cp $secret dev/nusuy/ext-search-batch/src/main/resources/application.properties'
if (fileExists('dev/nusuy/ext-search-batch/src/test/resources/application.properties')) {
sh 'cp $testSecret dev/nusuy/ext-search-batch/src/test/resources/application.properties'
}

sh 'chmod -R 444 dev/nusuy/ext-search-batch/src/'
}
}
}

post {
success {
echo '[SUCCESS] Setting application.properties successed.'
}
failure {
echo '[ERROR] Setting application.properties failed.'
}
}
}
}

/* Cleanup workspace */
post {
always {
deleteDir()
}
}
stage('Build'){
steps {
echo 'Build'
dir('dev/nusuy/ext-search-batch') {
sh 'chmod +x ./gradlew'
sh './gradlew clean build'
}
}

post {
success {
echo '[SUCCESS] Build successed.'
}
failure {
echo '[ERROR] Build failed.'
}
}
}
}
}

0 comments on commit 4af9c8f

Please sign in to comment.