updated Jenkinsfile

This commit is contained in:
Marcel Peterkau 2025-06-02 09:38:21 +02:00
parent 4d020b5ced
commit 8c022188c6

78
Jenkinsfile vendored
View File

@ -1,13 +1,7 @@
pipeline { pipeline {
agent any agent any
options {
timestamps()
ansiColor('xterm')
}
environment { environment {
// Default-Env, kann später via Parameter überschrieben werden
BUILD_ENV = "pcb_rev_1-4_serial" BUILD_ENV = "pcb_rev_1-4_serial"
PIO_HOME_DIR = "${WORKSPACE}/.pio" PIO_HOME_DIR = "${WORKSPACE}/.pio"
} }
@ -16,69 +10,83 @@ pipeline {
choice( choice(
name: 'BUILD_ENV', name: 'BUILD_ENV',
choices: ['pcb_rev_1-2_serial', 'pcb_rev_1-3_serial', 'pcb_rev_1-4_serial'], choices: ['pcb_rev_1-2_serial', 'pcb_rev_1-3_serial', 'pcb_rev_1-4_serial'],
description: 'Welches Environment soll gebaut werden?' description: 'Firmware-Umgebung auswählen'
) )
} }
stages { stages {
stage('🧼 Cleanup') { stage('🧹 Cleanup') {
steps { steps {
deleteDir() deleteDir()
} }
} }
stage('Checkout') { // Kein Checkout nötig SCM ist über UI definiert
stage('🧰 Setup PlatformIO') {
steps { steps {
sshagent(['gitea-ssh']) { dir('Software') {
sh 'git clone git@git.hiabuto.net:souko/Kettenoeler.git .' sh '''
python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip platformio
'''
} }
} }
} }
stage('🧪 Python & PlatformIO Setup') { stage('📄 Dummy WiFi-Creds') {
steps { steps {
sh ''' dir('Software') {
python3 -m venv .venv writeFile file: 'wifi_credentials.ini', text: '''
. .venv/bin/activate
pip install --upgrade pip platformio
'''
}
}
stage('📄 Dummy-Credential-Datei erstellen') {
steps {
writeFile file: 'wifi_credentials.ini', text: '''
[wifi_cred] [wifi_cred]
wifi_ssid_client = DummySSID wifi_ssid_client = DummySSID
wifi_password_client = DummyPass wifi_password_client = DummyPass
admin_password = Admin1234 admin_password = Admin123
wifi_ap_password = ApPass1234 wifi_ap_password = DummyAP
'''.stripIndent() '''.stripIndent()
}
} }
} }
stage('⚙️ Build Environment: ${params.BUILD_ENV}') { stage('🧪 Build Firmware') {
steps { steps {
sh ''' dir('Software') {
. .venv/bin/activate sh '''
platformio run -e ${BUILD_ENV} . .venv/bin/activate
''' platformio run -e ${params.BUILD_ENV}
'''
}
} }
} }
stage('📦 Firmware sichern') { stage('📦 Archive Firmware') {
steps { steps {
archiveArtifacts artifacts: ".pio/build/${params.BUILD_ENV}/firmware.bin", fingerprint: true archiveArtifacts artifacts: "Software/.pio/build/${params.BUILD_ENV}/firmware.bin", fingerprint: true
}
}
stage('🔌 Flash Hardware (Dummy)') {
steps {
echo "TODO: Flashen mit z.B. esptool oder PySerial in Hardware/flash.py"
}
}
stage('🧠 Run Tests (Dummy)') {
steps {
dir('Testing') {
echo "TODO: Starte Tests mit Testing/test_runner.py oder pytest"
}
} }
} }
} }
post { post {
success { success {
echo "✅ Build erfolgreich abgeschlossen Firmware liegt bereit als Artefakt." echo "✅ CI abgeschlossen Firmware gebaut, Tests vorbereitet"
} }
failure { failure {
echo "💣 Build fehlgeschlagen bitte Logs prüfen!" echo "❌ Fehler im Build schau in die Logs, Commander"
} }
} }
} }