138 lines
7.5 KiB
Groovy
138 lines
7.5 KiB
Groovy
pipeline {
|
|
agent any
|
|
stages {
|
|
stage('Flutter Cleanup/Update') {
|
|
steps {
|
|
sh '''cd fbla_ui
|
|
flutter upgrade --force
|
|
flutter pub upgrade
|
|
flutter --version
|
|
flutter doctor
|
|
flutter clean'''
|
|
}
|
|
}
|
|
stage('Build API & UI') {
|
|
parallel {
|
|
stage('Build API') {
|
|
steps {
|
|
sh '''cd fbla-api
|
|
docker image prune -f
|
|
docker build --no-cache -t fbla-api .'''
|
|
}
|
|
}
|
|
stage('UI Web Build') {
|
|
steps {
|
|
sh '''cd fbla_ui
|
|
flutter build web --release --base-href /fbla/'''
|
|
}
|
|
}
|
|
stage('UI Linux Build') {
|
|
steps {
|
|
sh '''cd fbla_ui
|
|
flutter build linux --release'''
|
|
}
|
|
}
|
|
stage('UI APK Build') {
|
|
steps {
|
|
sh '''cd fbla_ui
|
|
flutter build apk --release'''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Deploy and Save') {
|
|
parallel {
|
|
stage('Save Other Builds') {
|
|
steps {
|
|
script {
|
|
def remote = [
|
|
name : 'HostServer',
|
|
host : '192.168.0.216',
|
|
user : "${env.JOBLINK_LOCAL_USER}",
|
|
password : "${env.JOBLINK_LOCAL_PASSWD}",
|
|
allowAnyHosts: true,
|
|
]
|
|
if (env.BRANCH_NAME == 'main') {
|
|
sshRemove(path: "/home/${env.JOBLINK_LOCAL_USER}/builds/main/linux", remote: remote)
|
|
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux"
|
|
sshPut(from: 'fbla_ui/build/linux/x64/release', into: "/home/${env.JOBLINK_LOCAL_USER}/builds/main/linux", remote: remote)
|
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux"
|
|
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux/release/"
|
|
sshRemove(path: "/home/${env.JOBLINK_LOCAL_USER}/builds/main/apk", remote: remote)
|
|
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk"
|
|
sshPut(from: 'fbla_ui/build/app/outputs/apk/release', into: "/home/${env.JOBLINK_LOCAL_USER}/builds/main/apk", remote: remote)
|
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk"
|
|
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk/release/"
|
|
} else {
|
|
sshRemove(path: "/home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux", remote: remote)
|
|
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux"
|
|
sshPut(from: 'fbla_ui/build/linux/x64/release', into: "/home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux", remote: remote)
|
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux"
|
|
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux/release/"
|
|
sshRemove(path: "/home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk", remote: remote)
|
|
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk"
|
|
sshPut(from: 'fbla_ui/build/app/outputs/apk/release', into: "/home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk", remote: remote)
|
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk"
|
|
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk/release/"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Deploy Remote Web UI') {
|
|
when {
|
|
expression {
|
|
env.BRANCH_NAME == 'main'
|
|
}
|
|
}
|
|
steps {
|
|
script {
|
|
def remote = [
|
|
name : 'MarinoDev',
|
|
host : 'marinodev.com',
|
|
port : 21098,
|
|
user : "${env.JOBLINK_REMOTE_USER}",
|
|
identityFile : '/var/jenkins_home/marinoDevPrivateKey',
|
|
passphrase : "${env.JOBLINK_REMOTE_PASSWD}",
|
|
allowAnyHosts: true,
|
|
]
|
|
sshRemove(path: "/home/${env.JOBLINK_REMOTE_USER}/public_html/fbla", remote: remote)
|
|
sshPut(from: 'fbla_ui/build/web/', into: "/home/${env.JOBLINK_REMOTE_USER}/public_html/", remote: remote)
|
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_REMOTE_USER}/public_html/web /home/${env.JOBLINK_REMOTE_USER}/public_html/fbla"
|
|
}
|
|
}
|
|
}
|
|
stage('Deploy Local Web UI') {
|
|
steps {
|
|
script {
|
|
def remote = [
|
|
name : 'HostServer',
|
|
host : '192.168.0.216',
|
|
user : "${env.JOBLINK_LOCAL_USER}",
|
|
password : "${env.JOBLINK_LOCAL_PASSWD}",
|
|
allowAnyHosts: true,
|
|
]
|
|
sshRemove(path: "/home/${env.JOBLINK_LOCAL_USER}/fbla-webserver/webfiles/fbla", remote: remote)
|
|
sshPut(from: 'fbla_ui/build/web/', into: "/home/${env.JOBLINK_LOCAL_USER}/fbla-webserver", remote: remote)
|
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/fbla-webserver/web /home/${env.JOBLINK_LOCAL_USER}/fbla-webserver/webfiles/fbla"
|
|
}
|
|
}
|
|
}
|
|
stage('Start API') {
|
|
steps {
|
|
sh '''cd fbla-api
|
|
docker-compose down
|
|
docker-compose up -d'''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Run API Tests') {
|
|
steps {
|
|
sh '''cd fbla-api
|
|
dart pub get
|
|
dart run ./test/fbla_api_test.dart'''
|
|
}
|
|
}
|
|
}
|