https://github.com/owncloud/core
Raw File
Tip revision: 633eb080206419e865f4f6bf3e5582787f564a9b authored by Patrick Jahns on 08 March 2018, 21:42:43 UTC
run files_external tests with owncloud 10
Tip revision: 633eb08
Jenkinsfile
#!groovy
/*
 * This Jenkinsfile is intended to run on https://ci.owncloud.org and may fail anywhere else.
 * It makes assumptions about plugins being installed, labels mapping to nodes that can build what is needed, etc.
 */

timestampedNode('SLAVE') {
    stage 'Checkout'
        checkout scm

    stage 'make dist'
        sh '''
        phpenv local 7.1.0
        make dist
        '''

    stage 'Files External: SMB/SAMBA'
        executeAndReport('tests/autotest-external-results-sqlite-smb-silvershell.xml') {
            sh '''phpenv local 7.1.0
            export NOCOVERAGE=1
            unset USEDOCKER
            make test-external TEST_EXTERNAL_ENV=smb-silvershell
            '''
        }

    stage 'Files External: swift/ceph'
        executeAndReport('tests/autotest-external-results-sqlite-swift-ceph.xml') {
            sh '''phpenv local 7.1.0
            export NOCOVERAGE=1
            unset USEDOCKER
            make test-external TEST_EXTERNAL_ENV=swift-ceph
            '''
        }

    stage 'Files External: SMB/WINDOWS'
        executeAndReport('tests/autotest-external-results-sqlite-smb-windows.xml') {
            sh '''phpenv local 7.1.0
            export NOCOVERAGE=1
            unset USEDOCKER
            make test-external TEST_EXTERNAL_ENV=smb-windows
            '''
        }

        step([$class: 'JUnitResultArchiver', testResults: 'tests/autotest-external-results-sqlite.xml'])

	stage 'Acceptance Testing'
		executeAndReport('tests/acceptance/output/*.xml') {
			sh '''phpenv local 7.1.0
			rm -rf config/config.php data/*
			./occ maintenance:install --admin-pass=admin
			make clean-test-acceptance
			make test-acceptance OC_TEST_ALT_HOME=1
		   '''
		}

}

def isOnReleaseBranch ()  {
    if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'stable10' || env.BRANCH_NAME == 'stable9.1' || env.BRANCH_NAME == 'stable9' || env.BRANCH_NAME == 'stable8.2') {
        return true;
    }
    return false
}

void executeAndReport(String testResultLocation, def body) {
    def failed = false
    // We're wrapping this in a timeout - if it takes longer, kill it.
    try {
        timeout(time: 120, unit: 'MINUTES') {
            body.call()
        }
    } catch (Exception e) {
        failed = true
        echo "Test execution failed: ${e}"
    } finally {
        step([$class: 'JUnitResultArchiver', testResults: testResultLocation])
    }

    if (failed) {

        if (isOnReleaseBranch()) {
            mail body: "project build error is here: ${env.BUILD_URL}" ,
                subject: "Build on release branch failed: ${env.BRANCH_NAME}",
                to: 'jenkins@owncloud.com'
        }

        error "Test execution failed. Terminating the build"
    }
}

// Runs the given body within a Timestamper wrapper on the given label.
def timestampedNode(String label, Closure body) {
    node(label) {
        wrap([$class: 'TimestamperBuildWrapper']) {
            body.call()
        }
    }
}
back to top