Commit 9fb3fc1e authored by Jin Hai's avatar Jin Hai Committed by GitHub
Browse files

Merge pull request #47 from milvus-ci-robot/0.5.0

Add code coverage for Milvus Jenkins CI

Former-commit-id: cd5fcc8b0d0df112459f27eed284d9fda04d476e
parents 56aae0ee 3043b95f
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -8,9 +8,10 @@ pipeline {
    parameters{
        choice choices: ['Release', 'Debug'], description: '', name: 'BUILD_TYPE'
        string defaultValue: 'cf1434e7-5a4b-4d25-82e8-88d667aef9e5', description: 'GIT CREDENTIALS ID', name: 'GIT_CREDENTIALS_ID', trim: true
        string defaultValue: '1a527823-d2b7-44fd-834b-9844350baf14', description: 'JFROG CREDENTIALS ID', name: 'JFROG_CREDENTIALS_ID', trim: true
        string defaultValue: 'registry.zilliz.com', description: 'DOCKER REGISTRY URL', name: 'DOKCER_REGISTRY_URL', trim: true
        string defaultValue: 'ba070c98-c8cc-4f7c-b657-897715f359fc', description: 'DOCKER CREDENTIALS ID', name: 'DOCKER_CREDENTIALS_ID', trim: true
        string defaultValue: 'http://192.168.1.202/artifactory/milvus', description: 'JFROG ARTFACTORY URL', name: 'JFROG_ARTFACTORY_URL', trim: true
        string defaultValue: '1a527823-d2b7-44fd-834b-9844350baf14', description: 'JFROG CREDENTIALS ID', name: 'JFROG_CREDENTIALS_ID', trim: true
    }

    environment {
@@ -18,7 +19,7 @@ pipeline {
        LOWER_BUILD_TYPE = params.BUILD_TYPE.toLowerCase()
        SEMVER = "${BRANCH_NAME}"
        JOBNAMES = env.JOB_NAME.split('/')
        PIPELIEN_NAME = "${JOBNAMES[0]}"
        PIPELINE_NAME = "${JOBNAMES[0]}"
    }

    stages {
@@ -51,6 +52,15 @@ pipeline {
                                }
                            }
                        }
                        stage('Code Coverage') {
                            steps {
                                container('milvus-build-env') {
                                    script {
                                        load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/coverage.groovy"
                                    }
                                }
                            }
                        }
                        stage('Upload Package') {
                            steps {
                                container('milvus-build-env') {
+2 −5
Original line number Diff line number Diff line
timeout(time: 60, unit: 'MINUTES') {
    dir ("core") {
        sh "git config --global user.email \"test@zilliz.com\""
        sh "git config --global user.name \"test\""
    dir ("ci/jenkins/scripts") {
        sh "./build.sh -l"
        withCredentials([usernamePassword(credentialsId: "${params.JFROG_CREDENTIALS_ID}", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
            sh "export JFROG_ARTFACTORY_URL='${params.JFROG_ARTFACTORY_URL}' && export JFROG_USER_NAME='${USERNAME}' && export JFROG_PASSWORD='${PASSWORD}' && ./build.sh -t ${params.BUILD_TYPE} -d /opt/milvus -j -u -c"
            sh "./coverage.sh -u root -p 123456 -t \$POD_IP"
            sh "export JFROG_ARTFACTORY_URL='${params.JFROG_ARTFACTORY_URL}' && export JFROG_USER_NAME='${USERNAME}' && export JFROG_PASSWORD='${PASSWORD}' && ./build.sh -t ${params.BUILD_TYPE} -o /opt/milvus -d /opt/milvus -j -u -c"
        }
    }
}
+3 −3
Original line number Diff line number Diff line
try {
    sh "helm del --purge ${env.PIPELIEN_NAME}-${env.BUILD_NUMBER}-single-gpu"
    sh "helm del --purge ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu"
} catch (exc) {
    def helmResult = sh script: "helm status ${env.PIPELIEN_NAME}-${env.BUILD_NUMBER}-single-gpu", returnStatus: true
    def helmResult = sh script: "helm status ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu", returnStatus: true
    if (!helmResult) {
        sh "helm del --purge ${env.PIPELIEN_NAME}-${env.BUILD_NUMBER}-single-gpu"
        sh "helm del --purge ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu"
    }
    throw exc
}
+10 −0
Original line number Diff line number Diff line
timeout(time: 60, unit: 'MINUTES') {
    dir ("ci/jenkins/scripts") {
        sh "./coverage.sh -o /opt/milvus -u root -p 123456 -t \$POD_IP"
        // Set some env variables so codecov detection script works correctly
        withCredentials([[$class: 'StringBinding', credentialsId: "${env.PIPELINE_NAME}-codecov-token", variable: 'CODECOV_TOKEN']]) {
            sh 'curl -s https://codecov.io/bash | bash -s - -f output_new.info || echo "Codecov did not collect coverage reports"'
        }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -4,11 +4,11 @@ try {
    dir ('milvus-helm') {
        checkout([$class: 'GitSCM', branches: [[name: "0.5.0"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_CREDENTIALS_ID}", url: "https://github.com/milvus-io/milvus-helm.git", name: 'origin', refspec: "+refs/heads/0.5.0:refs/remotes/origin/0.5.0"]]])
        dir ("milvus-gpu") {
            sh "helm install --wait --timeout 300 --set engine.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP --name ${env.PIPELIEN_NAME}-${env.BUILD_NUMBER}-single-gpu -f ci/values.yaml --namespace milvus ."
            sh "helm install --wait --timeout 300 --set engine.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP --name ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu -f ci/values.yaml --namespace milvus ."
        }
    }
} catch (exc) {
    echo 'Helm running failed!'
    sh "helm del --purge ${env.PIPELIEN_NAME}-${env.BUILD_NUMBER}-single-gpu"
    sh "helm del --purge ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu"
    throw exc
}
Loading