Add 'Jenkinsfile'
Some checks failed
Plugins/ThemeParkConnector/pipeline/head There was a failure building this commit
Some checks failed
Plugins/ThemeParkConnector/pipeline/head There was a failure building this commit
This commit is contained in:
parent
738f09eb9a
commit
c82f17ba2d
1 changed files with 51 additions and 0 deletions
51
Jenkinsfile
vendored
Normal file
51
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
def projectTitle = "ThemeParkConnector"
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
tools {
|
||||
maven "maven-3.9.0"
|
||||
jdk "jdk11-adoptium"
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build Artifact') {
|
||||
steps {
|
||||
sh "mvn clean package -Dnoobfus=true"
|
||||
archiveArtifacts artifacts: 'target/*.jar'
|
||||
}
|
||||
}
|
||||
|
||||
stage('SonarQube Analysis') {
|
||||
steps {
|
||||
withSonarQubeEnv('sonarqube') {
|
||||
sh "mvn sonar:sonar -Dsonar.projectKey=${projectTitle}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
def discordFooter = "Copyright © SBDevelopment"
|
||||
def buildNumber = currentBuild.number
|
||||
def buildStatus = currentBuild.result
|
||||
def prevBuild = currentBuild.getPreviousBuild()
|
||||
def prevGitRev = prevBuild ? env.GIT_PREVIOUS_COMMIT : ''
|
||||
def gitRange = prevGitRev ? "${prevGitRev}..HEAD" : "HEAD~1..HEAD"
|
||||
def gitChanges = sh(returnStdout: true, script: "git log --pretty=format:\"- %h %s\" ${gitRange}")
|
||||
def discordTitle = "Build #${buildNumber} - ${projectTitle}"
|
||||
def discordDescription = "**Status:** ${buildStatus}\n**Changes:**\n${gitChanges}"
|
||||
|
||||
discordSend(
|
||||
webhookURL: 'https://discord.com/api/webhooks/1079797247807598644/s57XSXoirtflA66DVVrZDtEHCfmi2XoK-eSRYWMMD5MTcK_W3EFQOCM8SnKSekxrQae_',
|
||||
title: discordTitle,
|
||||
description: discordDescription,
|
||||
footer: discordFooter,
|
||||
result: currentBuild.currentResult
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue