85 lines
2.5 KiB
Groovy
85 lines
2.5 KiB
Groovy
#!/usr/bin/env groovy
|
|
|
|
node {
|
|
stage('checkout') {
|
|
checkout scm
|
|
}
|
|
stage('check java') {
|
|
sh "java -version"
|
|
}
|
|
|
|
stage('clean') {
|
|
sh "chmod +x mvnw"
|
|
sh "./mvnw -ntp clean -P-webpack"
|
|
}
|
|
stage('nohttp') {
|
|
sh "./mvnw -ntp checkstyle:check"
|
|
}
|
|
|
|
stage('install tools') {
|
|
sh "./mvnw -ntp com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v12.16.1 -DnpmVersion=6.14.5"
|
|
}
|
|
|
|
stage('npm install') {
|
|
sh "./mvnw -ntp com.github.eirslett:frontend-maven-plugin:npm"
|
|
}
|
|
|
|
stage('Tests') {
|
|
sh "./mvnw test"
|
|
}
|
|
|
|
if (env.BRANCH_NAME == "master") {
|
|
stage('packaging') {
|
|
sh "./mvnw -ntp verify -P-webpack -Pprod -DskipTests"
|
|
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
|
|
}
|
|
|
|
// stage("Prepare for containerizing") {
|
|
// withCredentials([file(credentialsId: 'privatekey', variable: 'privateKey'),
|
|
// file(credentialsId: 'publickey', variable: 'publicKey')]){
|
|
// sh "cp \$privateKey ./"
|
|
// sh "cp \$publicKey ./"
|
|
// }
|
|
// }
|
|
stage("Run docker compose") {
|
|
sh "docker-compose build"
|
|
withCredentials([usernamePassword(credentialsId: 'doApi', passwordVariable: 'doApi', usernameVariable: '')]) {
|
|
sh "docker login -u \$doApi -p \$doApi registry.digitalocean.com"
|
|
// sh "docker push registry.digitalocean.com/nerdfortress/crusadetracker_nginx"
|
|
sh "docker push registry.digitalocean.com/nerdfortress/crusadetracker"
|
|
}
|
|
}
|
|
|
|
stage("Cleanup") {
|
|
sh "rm -f ./privkey.pem ./fullchain.pem"
|
|
}
|
|
}
|
|
}
|
|
// stage('backend tests') {
|
|
// try {
|
|
// sh "./mvnw -ntp verify -P-webpack"
|
|
// } catch(err) {
|
|
// throw err
|
|
// } finally {
|
|
// junit '**/target/test-results/**/TEST-*.xml'
|
|
// }
|
|
// }
|
|
//
|
|
// stage('frontend tests') {
|
|
// try {
|
|
// npm install
|
|
// npm test
|
|
// } catch(err) {
|
|
// throw err
|
|
// } finally {
|
|
// junit '**/target/test-results/**/TEST-*.xml'
|
|
// }
|
|
// }
|
|
|
|
// def dockerImage
|
|
// stage('publish docker') {
|
|
// // A pre-requisite to this step is to setup authentication to the docker registry
|
|
// // https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#authentication-methods
|
|
// sh "./mvnw -ntp jib:build"
|
|
// }
|