Jenkinsfile 5.5 KB
Newer Older
T
add ci  
test 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
pipeline {
    agent none

    options {
        timestamps()
    }

    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: '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
    }

    environment {
        PROJECT_NAME = "milvus"
        LOWER_BUILD_TYPE = params.BUILD_TYPE.toLowerCase()
        SEMVER = "${BRANCH_NAME}"
        JOBNAMES = env.JOB_NAME.split('/')
        PIPELIEN_NAME = "${JOBNAMES[0]}"
    }

    stages {
T
test 已提交
25
        stage("Ubuntu 18.04") {
T
add ci  
test 已提交
26
            environment {
T
test 已提交
27
                OS_NAME = "ubuntu18.04"
T
add ci  
test 已提交
28
                PACKAGE_VERSION = VersionNumber([
29
                    versionNumberString : '${SEMVER}-${LOWER_BUILD_TYPE}-ubuntu18.04-x86_64-${BUILD_DATE_FORMATTED, "yyyyMMdd"}-${BUILDS_TODAY}'
T
add ci  
test 已提交
30 31 32 33 34 35 36 37 38 39
                ]);
                DOCKER_VERSION = "${SEMVER}-${OS_NAME}-${LOWER_BUILD_TYPE}"
            }

            stages {
                stage("Run Build") {
                    agent {
                        kubernetes {
                            label 'build'
                            defaultContainer 'jnlp'
T
test 已提交
40
                            yamlFile 'ci/jenkins/pod/milvus-build-env-pod.yaml'
T
add ci  
test 已提交
41 42 43 44 45 46 47 48
                        }
                    }

                    stages {
                        stage('Build') {
                            steps {
                                container('milvus-build-env') {
                                    script {
49
                                        load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/build.groovy"
T
add ci  
test 已提交
50 51 52 53 54 55 56 57
                                    }
                                }
                            }
                        }
                        stage('Upload Package') {
                            steps {
                                container('milvus-build-env') {
                                    script {
58
                                        load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/package.groovy"
T
add ci  
test 已提交
59 60 61 62 63 64 65 66 67 68 69 70
                                    }
                                }
                            }
                        }
                    }
                }

                stage("Publish docker images") {
                    agent {
                        kubernetes {
                            label 'publish'
                            defaultContainer 'jnlp'
T
test 已提交
71
                            yamlFile 'ci/jenkins/pod/docker-pod.yaml'
T
add ci  
test 已提交
72 73 74 75 76 77 78 79
                        }
                    }

                    stages {
                        stage('Publish') {
                            steps {
                                container('publish-images'){
                                    script {
80
                                        load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/publishImages.groovy"
T
add ci  
test 已提交
81 82 83 84 85 86 87 88 89 90 91 92
                                    }
                                }
                            }
                        }
                    }
                }

                stage("Deploy to Development") {
                    agent {
                        kubernetes {
                            label 'dev-test'
                            defaultContainer 'jnlp'
T
test 已提交
93
                            yamlFile 'ci/jenkins/pod/testEnvironment.yaml'
T
add ci  
test 已提交
94 95 96 97 98 99 100 101
                        }
                    }

                    stages {
                        stage("Deploy to Dev") {
                            steps {
                                container('milvus-test-env') {
                                    script {
102
                                        load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/deploySingle2Dev.groovy"
T
add ci  
test 已提交
103 104 105 106 107 108 109 110 111
                                    }
                                }
                            }
                        }

                        stage("Dev Test") {
                            steps {
                                container('milvus-test-env') {
                                    script {
112
                                        load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/singleDevTest.groovy"
T
add ci  
test 已提交
113 114 115 116 117 118 119 120 121
                                    }
                                }
                            }
                        }

                        stage ("Cleanup Dev") {
                            steps {
                                container('milvus-test-env') {
                                    script {
122
                                        load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/cleanupSingleDev.groovy"
T
add ci  
test 已提交
123 124 125 126 127 128 129 130 131
                                    }
                                }
                            }
                        }
                    }
                    post {
                        unsuccessful {
                            container('milvus-test-env') {
                                script {
132
                                    load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/cleanupSingleDev.groovy"
T
add ci  
test 已提交
133 134 135 136 137 138 139 140 141 142
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}