frigate/Jenkinsfile

38 lines
2.7 KiB
Groovy

pipeline {
agent any
stages {
stage('Deploy') {
when {
branch pattern: '^(master|main)$|stable|release', comparator: 'REGEXP'
}
steps {
httpRequest outputFile: 'get_service_config.yaml', url: 'https://gist.githubusercontent.com/computer-geek64/3ed7241e7a74ad6ddd00409900b590e4/raw/39d371d4040b319663bfd339ea1aa56bd37cdf77/get_service_config.yaml'
ansiblePlaybook credentialsId: 'rivendell-ssh-key', disableHostKeyChecking: true, extras: "--extra-vars 'service=\"frigate\"'", playbook: 'get_service_config.yaml'
script {
frigate_config = readJSON file: 'frigate_config.json'
}
ansiblePlaybook credentialsId: 'rivendell-ssh-key', disableHostKeyChecking: true, extras: "--extra-vars 'ipgeolocation_api_key=\"${frigate_config.ipgeolocation.api_key}\" wyze_email=\"${frigate_config.wyze.email}\" wyze_password=\"${frigate_config.wyze.password}\" garage_rtsp_password=\"${frigate_config.rtsp.garage.password}\" front_door_rtsp_password=\"${frigate_config.rtsp.front_door.password}\" doorbell_rtsp_password=\"${frigate_config.rtsp.doorbell.password}\" driveway_rtsp_password=\"${frigate_config.rtsp.driveway.password}\" back_door_rtsp_password=\"${frigate_config.rtsp.back_door.password}\" family_room_rtsp_password=\"${frigate_config.rtsp.family_room.password}\"'", playbook: 'install.yaml'
ansiblePlaybook credentialsId: 'rivendell-ssh-key', disableHostKeyChecking: true, playbook: 'stop.yaml'
ansiblePlaybook credentialsId: 'rivendell-ssh-key', disableHostKeyChecking: true, playbook: 'start.yaml'
}
}
}
post {
failure {
httpRequest contentType: 'APPLICATION_JSON', httpMode: 'POST', ignoreSslErrors: true, requestBody: "{\"topic\": \"jenkins\", \"title\": \"Jenkins\", \"priority\": 4, \"icon\": \"https://jenkins.homelab.net/favicon.ico\", \"click\": \"${BUILD_URL}\", \"message\": \"Build failed for ${JOB_NAME.split('/')[-2]} on ${BRANCH_NAME} branch\"}", responseHandle: 'NONE', url: 'https://ntfy.homelab.net', wrapAsMultipart: false
}
fixed {
httpRequest contentType: 'APPLICATION_JSON', httpMode: 'POST', ignoreSslErrors: true, requestBody: "{\"topic\": \"jenkins\", \"title\": \"Jenkins\", \"priority\": 3, \"icon\": \"https://jenkins.homelab.net/favicon.ico\", \"click\": \"${BUILD_URL}\", \"message\": \"Pipeline fixed for ${JOB_NAME.split('/')[-2]} on ${BRANCH_NAME} branch\"}", responseHandle: 'NONE', url: 'https://ntfy.homelab.net', wrapAsMultipart: false
}
cleanup {
cleanWs()
}
}
}