126 lines
5.5 KiB
Plaintext
126 lines
5.5 KiB
Plaintext
pipeline {
|
|
agent any
|
|
|
|
tools {
|
|
maven 'Maven-3.5.0'
|
|
jdk 'OpenJdk-11.0.2'
|
|
}
|
|
|
|
environment {
|
|
JAVA_HOME = '/opt/jdks/jdk-11.0.2'
|
|
}
|
|
|
|
stages {
|
|
stage('Configuration') {
|
|
steps {
|
|
dir('codiki-properties') {
|
|
checkout([$class: 'GitSCM',
|
|
url: 'https://gogs.takiguchi.ovh/florian/codiki-properties.git',
|
|
branches: [[name: '*/master']],
|
|
userRemoteConfigs: [[credentialsId: '7585a4a3-e016-4558-bd8d-e8fde4c48629', url: 'https://gogs.takiguchi.ovh/florian/codiki-properties.git']]
|
|
])
|
|
}
|
|
script {
|
|
|
|
sh """
|
|
cp ./codiki-properties/application-prod.yml ./src/main/resources/application.yml
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Documentation generation') {
|
|
steps {
|
|
script {
|
|
sh """
|
|
echo 'Génération de la documentation d'utilisation...'
|
|
|
|
docPath='../src/main/ts/src/assets/doc/'
|
|
cd \$WORKSPACE/doc/ && unoconv codiki_user_manual.odt
|
|
&& mkdir -p \$docPath
|
|
&& mv codiki_user_manual.pdf \$docPath
|
|
&& cd -
|
|
if [ \$? -eq 0 ]
|
|
then
|
|
echo 'Documentation générée avec succès.'
|
|
else
|
|
echo 'La génération de la documentation s'est terminée en erreur
|
|
fi
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Angular build') {
|
|
steps {
|
|
script {
|
|
sh """
|
|
echo "Construction de l'application Angular..."
|
|
|
|
cd \$WORKSPACE/src/main/ts && npm install && ng build --configuration=production && cd -
|
|
|
|
echo "Application générée avec succès."
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('SpringBoot build') {
|
|
steps {
|
|
sh 'mvn clean package'
|
|
}
|
|
}
|
|
|
|
stage('Publish and restart') {
|
|
steps {
|
|
script {
|
|
sh 'mv target/codiki*.jar target/codiki.jar'
|
|
}
|
|
sshPublisher(
|
|
publishers: [
|
|
sshPublisherDesc(
|
|
configName: 'DebianServer [clubs]',
|
|
transfers: [
|
|
sshTransfer(
|
|
cleanRemote: false,
|
|
excludes: '',
|
|
execCommand: '',
|
|
execTimeout: 120000,
|
|
flatten: false,
|
|
makeEmptyDirs: false,
|
|
noDefaultExcludes: false,
|
|
patternSeparator: '[, ]+',
|
|
remoteDirectory: '',
|
|
remoteDirectorySDF: false,
|
|
removePrefix: 'target/',
|
|
sourceFiles: 'target/codiki.jar'
|
|
),
|
|
sshTransfer(
|
|
cleanRemote: false,
|
|
excludes: '',
|
|
execCommand: """
|
|
mv /opt/codiki-2/codiki.jar /opt/codiki-2/bin/codiki.jar
|
|
sudo /opt/codiki-2/bin/codiki-jenkins.sh
|
|
sudo service codiki-2 restart
|
|
""",
|
|
execTimeout: 120000,
|
|
flatten: false,
|
|
makeEmptyDirs: false,
|
|
noDefaultExcludes: false,
|
|
patternSeparator: '[, ]+',
|
|
remoteDirectory: '',
|
|
remoteDirectorySDF: false,
|
|
removePrefix: '',
|
|
sourceFiles: ''
|
|
)
|
|
],
|
|
usePromotionTimestamp: false,
|
|
useWorkspaceInPromotion: false,
|
|
verbose: false
|
|
)
|
|
]
|
|
)
|
|
}
|
|
}
|
|
}
|
|
} |