| /* |
| * Copyright (C) 2022-2023 Savoir-faire Linux Inc. |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU Affero General Public License as |
| * published by the Free Software Foundation; either version 3 of the |
| * License, or (at your option) any later version. |
| * |
| * This program is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU Affero General Public License for more details. |
| * |
| * You should have received a copy of the GNU Affero General Public |
| * License along with this program. If not, see |
| * <https://www.gnu.org/licenses/>. |
| */ |
| |
| // Requirements: |
| // - gerrit-trigger plugin |
| // - Docker plugin |
| // - ansicolor plugin |
| |
| pipeline { |
| agent { |
| node { |
| label 'jami-buildmachine-04.mtl.sfl' |
| } |
| } |
| |
| triggers { |
| gerrit customUrl: '', |
| gerritProjects: [ |
| [branches: [[compareType: 'PLAIN', pattern: 'master']], |
| compareType: 'PLAIN', |
| disableStrictForbiddenFileVerification: false, |
| pattern: 'jami-plugins']], |
| triggerOnEvents: [ |
| commentAddedContains('!build'), |
| patchsetCreated(excludeDrafts: true, excludeNoCodeChange: true, |
| excludeTrivialRebase: true)] |
| } |
| |
| options { |
| ansiColor('xterm') |
| } |
| |
| parameters { |
| string(name: 'GERRIT_REFSPEC', |
| defaultValue: 'refs/heads/master', |
| description: 'The Gerrit plugins refspec to fetch.') |
| string(name: 'DAEMON_REFSPEC', |
| defaultValue: 'refs/heads/master', |
| description: 'The Gerrit daemon refspec to fetch.') |
| string(name: 'dockerfile', |
| defaultValue: 'Dockerfile_ubuntu_20.04_onnxruntime', |
| description: 'Dockerfile in plugins/docker/ repository to use for the build') |
| string(name: 'GERRIT_TOPIC', |
| defaultValue: '', |
| description: 'topic must match the plugins name if the pipeline is to build that plugins.') |
| } |
| |
| environment { |
| jenkinsUID = sh(returnStdout: true, script: 'id -u jenkins').replaceAll("\n", '').trim() |
| jenkinsGID = sh(returnStdout: true, script: 'id -g jenkins').replaceAll("\n", '').trim() |
| jenkinsUser = '${jenkinsUID}:${jenkinsGID}' |
| cpuCount = sh returnStdout: true, script: 'nproc || echo -n 4' |
| } |
| |
| stages { |
| stage('SCM Checkout') { |
| steps { |
| // Wipe workspace and fetch jami-plugins |
| checkout changelog: true, poll: false, |
| scm: [$class: 'GitSCM', |
| branches: [[name: 'FETCH_HEAD']], |
| doGenerateSubmoduleConfigurations: false, |
| extensions: [ |
| [$class: 'CloneOption', noTags: true, reference: '', shallow: true], |
| [$class: 'WipeWorkspace']], |
| submoduleCfg: [], |
| userRemoteConfigs: [[refspec: '${GERRIT_REFSPEC}', url: 'https://${JAMI_GERRIT_URL}/jami-plugins']]] |
| } |
| } |
| |
| stage('Init repository') { |
| steps { |
| script { |
| sh """ |
| git rev-parse HEAD |
| git submodule update --init --recursive |
| """ |
| if (env.DAEMON_REFSPEC != null) { |
| sh """ |
| cd daemon |
| git fetch origin ${DAEMON_REFSPEC} && git checkout FETCH_HEAD |
| """ |
| } |
| } |
| } |
| } |
| |
| stage('Building Docker Image') { |
| steps { |
| script { |
| docker.build('plugins-linux', "-f docker/${dockerfile} --no-cache .") |
| } |
| } |
| } |
| |
| stage('Setup and Build Dependencies') { |
| steps { |
| script { |
| def jenkinsUID = sh(returnStdout: true, script: 'id -u jenkins').replaceAll("\n", '').trim() |
| def jenkinsGID = sh(returnStdout: true, script: 'id -g jenkins').replaceAll("\n", '').trim() |
| def jenkinsUser = jenkinsUID+':'+jenkinsGID |
| def cpuCount = sh returnStdout: true, script: 'nproc || echo -n 4' |
| docker.image('plugins-linux').withRun('-t -u '+jenkinsUser+' -v '+pwd()+':/root/jami/:rw -w /root/ -e BATCH_MODE=1', '/bin/bash') { |
| container -> code:{ |
| def base_cmd = 'docker exec -t '+container.id+" sh -c '" |
| def exec_cmd = { cmd -> sh base_cmd+cmd+"'" } |
| |
| ansiColor('css') { |
| exec_cmd(""" |
| pwd |
| cd ./jami/daemon/contrib |
| mkdir native |
| cd native |
| ../bootstrap --enable-ffmpeg --disable-argon2 --disable-asio --enable-fmt --disable-gcrypt --disable-gmp --disable-gnutls --disable-gpg-error --disable-gsm --disable-http_parser --disable-iconv --disable-jack --disable-jsoncpp --disable-libarchive --disable-libressl --disable-msgpack --disable-natpmp --disable-nettle --enable-opencv --disable-opendht --disable-pjproject --disable-portaudio --disable-restinio --disable-secp256k1 --disable-speexdsp --disable-upnp --disable-uuid --disable-yaml-cpp --disable-zlib |
| make list |
| make -j${cpuCount} |
| """) |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| stage('Build GreenScreen cpu') { |
| steps { |
| script { |
| if(env.GERRIT_TOPIC == "all" || env.GERRIT_TOPIC == "GreenScreen") { |
| docker.image('plugins-linux').withRun('-t -u '+jenkinsUser+' -v '+pwd()+':/root/jami/:rw -w /root/ -e BATCH_MODE=1', '/bin/bash') { |
| container -> code:{ |
| def base_cmd = 'docker exec -t '+container.id+" sh -c '" |
| def exec_cmd = { cmd -> sh base_cmd+cmd+"'" } |
| |
| ansiColor('css') { |
| exec_cmd(""" |
| cd jami |
| AUTHOR="SFL" DIVISION="Internal" python3 build-plugin.py --projects="GreenScreen" |
| """) |
| } |
| } |
| } |
| if (!fileExists("./build/x86_64-linux-gnu/cpu/GreenScreen.jpl")) { |
| error "GreenScreen build output not found" |
| } |
| archiveArtifacts 'build/x86_64-linux-gnu/cpu/GreenScreen.jpl' |
| } |
| } |
| } |
| } |
| |
| stage('Build GreenScreen nvidia-gpu') { |
| steps { |
| script { |
| if(env.GERRIT_TOPIC == "all" || env.GERRIT_TOPIC == "GreenScreen") { |
| docker.image('plugins-linux').withRun('-t -u '+jenkinsUser+' -v '+pwd()+':/root/jami/:rw -w /root/ -e BATCH_MODE=1', '/bin/bash') { |
| container -> code:{ |
| def base_cmd = 'docker exec -t '+container.id+" sh -c '" |
| def exec_cmd = { cmd -> sh base_cmd+cmd+"'" } |
| |
| ansiColor('css') { |
| exec_cmd(""" |
| cd jami |
| AUTHOR="SFL" DIVISION="Internal" PROCESSOR=NVIDIA python3 build-plugin.py --projects="GreenScreen" |
| """) |
| } |
| } |
| } |
| if (!fileExists("./build/x86_64-linux-gnu/nvidia-gpu/GreenScreen.jpl")) { |
| error "GreenScreen build output not found" |
| } |
| archiveArtifacts 'build/x86_64-linux-gnu/nvidia-gpu/GreenScreen.jpl' |
| } |
| } |
| } |
| } |
| |
| stage('Build AudioFilter') { |
| steps { |
| script { |
| if(env.GERRIT_TOPIC == "all" || env.GERRIT_TOPIC == "AudioFilter") { |
| docker.image('plugins-linux').withRun('-t -u '+jenkinsUser+' -v '+pwd()+':/root/jami/:rw -w /root/ -e BATCH_MODE=1', '/bin/bash') { |
| container -> code:{ |
| def base_cmd = 'docker exec -t '+container.id+" sh -c '" |
| def exec_cmd = { cmd -> sh base_cmd+cmd+"'" } |
| |
| ansiColor('css') { |
| exec_cmd(""" |
| cd jami |
| AUTHOR="SFL" DIVISION="Internal" python3 build-plugin.py --projects="AudioFilter" |
| """) |
| } |
| } |
| } |
| if (!fileExists("./build/x86_64-linux-gnu/AudioFilter.jpl")) { |
| error "AudioFilter build output not found" |
| } |
| archiveArtifacts 'build/x86_64-linux-gnu/AudioFilter.jpl' |
| } |
| } |
| } |
| } |
| |
| stage('Build AutoAnswer') { |
| steps { |
| script { |
| if(env.GERRIT_TOPIC == "all" || env.GERRIT_TOPIC == "AutoAnswer") { |
| docker.image('plugins-linux').withRun('-t -u '+jenkinsUser+' -v '+pwd()+':/root/jami/:rw -w /root/ -e BATCH_MODE=1', '/bin/bash') { |
| container -> code:{ |
| def base_cmd = 'docker exec -t '+container.id+" sh -c '" |
| def exec_cmd = { cmd -> sh base_cmd+cmd+"'" } |
| |
| ansiColor('css') { |
| exec_cmd(""" |
| cd jami |
| AUTHOR="SFL" DIVISION="Internal" python3 build-plugin.py --projects="AutoAnswer" |
| """) |
| } |
| } |
| } |
| if (!fileExists("./build/x86_64-linux-gnu/AutoAnswer.jpl")) { |
| error "AutoAnswer build output not found" |
| } |
| archiveArtifacts 'build/x86_64-linux-gnu/AutoAnswer.jpl' |
| } |
| } |
| } |
| } |
| |
| stage('Build WaterMark') { |
| steps { |
| script { |
| if(env.GERRIT_TOPIC == "all" || env.GERRIT_TOPIC == "WaterMark") { |
| docker.image('plugins-linux').withRun('-t -u '+jenkinsUser+' -v '+pwd()+':/root/jami/:rw -w /root/ -e BATCH_MODE=1', '/bin/bash') { |
| container -> code:{ |
| def base_cmd = 'docker exec -t '+container.id+" sh -c '" |
| def exec_cmd = { cmd -> sh base_cmd+cmd+"'" } |
| |
| ansiColor('css') { |
| exec_cmd(""" |
| cd jami |
| AUTHOR="SFL" DIVISION="Internal" python3 build-plugin.py --projects="WaterMark" |
| """) |
| } |
| } |
| } |
| if (!fileExists("./build/x86_64-linux-gnu/WaterMark.jpl")) { |
| error "WaterMark build output not found" |
| } |
| archiveArtifacts 'build/x86_64-linux-gnu/WaterMark.jpl' |
| } |
| } |
| } |
| } |
| |
| stage('Build Whisper') { |
| steps { |
| script { |
| if(env.GERRIT_TOPIC == "all" || env.GERRIT_TOPIC == "Whisper" || env.GERRIT_TOPIC == "WhisperTranscript") { |
| docker.image('plugins-linux').withRun('-t -u '+jenkinsUser+' -v '+pwd()+':/root/jami/:rw -w /root/ -e BATCH_MODE=1', '/bin/bash') { |
| container -> code:{ |
| def base_cmd = 'docker exec -t '+container.id+" sh -c '" |
| def exec_cmd = { cmd -> sh base_cmd+cmd+"'" } |
| |
| ansiColor('css') { |
| exec_cmd(""" |
| cd jami |
| AUTHOR="SFL" DIVISION="Internal" python3 build-plugin.py --projects="WhisperTranscript" |
| """) |
| } |
| } |
| } |
| if (!fileExists("./build/x86_64-linux-gnu/WhisperTranscript.jpl")) { |
| error "WhisperTranscript build output not found" |
| } |
| archiveArtifacts 'build/x86_64-linux-gnu/WhisperTranscript.jpl' |
| } |
| } |
| } |
| } |
| |
| stage('Build test dependencies') { |
| steps { |
| sh 'pip install -r ./SDK/certificate_requirements.txt' |
| sh 'pip install -r ./SDK/requirements.txt' |
| } |
| } |
| |
| stage('Test Certificate') { |
| steps { |
| sh 'PYTHONPATH="./SDK/" python3 ./extras/tests/CertificateTester.py' |
| } |
| } |
| |
| stage('Test Plugin Certificate') { |
| steps { |
| sh 'PYTHONPATH="./SDK/" python3 ./extras/tests/PluginCertificateTester.py' |
| } |
| } |
| } |
| } |