Kettenoeler/Software/Jenkinsfile

85 lines
2.1 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

pipeline {
agent any
options {
timestamps()
ansiColor('xterm')
}
environment {
// Default-Env, kann später via Parameter überschrieben werden
BUILD_ENV = "pcb_rev_1-4_serial"
PIO_HOME_DIR = "${WORKSPACE}/.pio"
}
parameters {
choice(
name: 'BUILD_ENV',
choices: ['pcb_rev_1-2_serial', 'pcb_rev_1-3_serial', 'pcb_rev_1-4_serial'],
description: 'Welches Environment soll gebaut werden?'
)
}
stages {
stage('🧼 Cleanup') {
steps {
deleteDir()
}
}
stage('Checkout') {
steps {
sshagent(['gitea-ssh']) {
sh 'git clone git@git.hiabuto.net:souko/Kettenoeler.git .'
}
}
}
stage('🧪 Python & PlatformIO Setup') {
steps {
sh '''
python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip platformio
'''
}
}
stage('📄 Dummy-Credential-Datei erstellen') {
steps {
writeFile file: 'wifi_credentials.ini', text: '''
[wifi_cred]
wifi_ssid_client = DummySSID
wifi_password_client = DummyPass
admin_password = Admin1234
wifi_ap_password = ApPass1234
'''.stripIndent()
}
}
stage('⚙️ Build Environment: ${params.BUILD_ENV}') {
steps {
sh '''
. .venv/bin/activate
platformio run -e ${BUILD_ENV}
'''
}
}
stage('📦 Firmware sichern') {
steps {
archiveArtifacts artifacts: ".pio/build/${params.BUILD_ENV}/firmware.bin", fingerprint: true
}
}
}
post {
success {
echo "✅ Build erfolgreich abgeschlossen Firmware liegt bereit als Artefakt."
}
failure {
echo "💣 Build fehlgeschlagen bitte Logs prüfen!"
}
}
}