Skip to content
Snippets Groups Projects
  • Sébastien Blin's avatar
    91163b8b
    migration: avoid race conditions for account status · 91163b8b
    Sébastien Blin authored
    Setting an account to migrating is asynchronous. So the status
    of the account should be checked via dedicated signals and not
    just at the startup, else the migration view is not shown.
    
    Also removing two accounts to migrate wasn't working correctly.
    
    Change-Id: I0bb716982ec5fe76aaba3ad4cb6f47b1ef0aa710
    GitLab: #1062
    91163b8b
    History
    migration: avoid race conditions for account status
    Sébastien Blin authored
    Setting an account to migrating is asynchronous. So the status
    of the account should be checked via dedicated signals and not
    just at the startup, else the migration view is not shown.
    
    Also removing two accounts to migrate wasn't working correctly.
    
    Change-Id: I0bb716982ec5fe76aaba3ad4cb6f47b1ef0aa710
    GitLab: #1062
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Jenkinsfile 4.96 KiB
/*
 * 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-client-qt']],
            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 refspec to fetch.')
    }

    stages {
        stage('SCM Checkout') {
            steps {
                // Wipe workspace and fetch jami-daemon
                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-client-qt']]]
            }
        }

        stage('Init repository') {
            steps {
                script {
                    sh """
                        git rev-parse HEAD
                        git submodule update --init --recursive
                    """
                }
            }
        }

        stage('Building Docker Image') {
            steps {
                script {
                    docker.build('client-validation', "-f extras/build/docker/Dockerfile.client-qt-gnulinux --no-cache .")
                }
            }
        }

        stage('Build Client') {
            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('client-validation').withRun('-t -u '+jenkinsUser+' -v '+pwd()+':/foo:rw -v /var/cache/jami:/var/cache/jami:rw -w /foo -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+"'" }

                            def dockerTopDir = '/foo/'
                            ansiColor('css') {
                                exec_cmd("""
                                    cd ${dockerTopDir}/daemon/contrib
                                    mkdir native
                                    cd native
                                    ../bootstrap --cache-dir=/var/cache/jami --cache-builds
                                    make list
                                    make fetch
                                """)
                                exec_cmd("""
                                    cd ${dockerTopDir}
                                    ./build.py --install --qt /usr/lib/libqt-jami/
                                    cd build
                                    cmake .. -DENABLE_TESTS=True
                                    make -j${cpuCount}
                                """)
                                // Run tests
                                exec_cmd("""
                                    cd ${dockerTopDir}/build/tests
                                    HOME=/tmp ctest -V -C Release -j${cpuCount}
                                """)
                            }
                        }
                    }
                }
            }
        }
    }
}