2019-07-05 18:07:40 +08:00
|
|
|
pipeline {
|
|
|
|
agent none
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
|
|
|
PROJECT_NAME = "milvus"
|
|
|
|
LOWER_BUILD_TYPE = BUILD_TYPE.toLowerCase()
|
|
|
|
SEMVER = "${env.gitlabSourceBranch == null ? params.ENGINE_BRANCH.substring(params.ENGINE_BRANCH.lastIndexOf('/') + 1) : env.gitlabSourceBranch}"
|
|
|
|
GITLAB_AFTER_COMMIT = "${env.gitlabAfter == null ? null : env.gitlabAfter}"
|
|
|
|
SUFFIX_VERSION_NAME = "${env.gitlabAfter == null ? null : env.gitlabAfter.substring(0, 6)}"
|
|
|
|
DOCKER_VERSION_STR = "${env.gitlabAfter == null ? "${SEMVER}-${LOWER_BUILD_TYPE}" : "${SEMVER}-${LOWER_BUILD_TYPE}-${SUFFIX_VERSION_NAME}"}"
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage("Ubuntu 16.04") {
|
|
|
|
environment {
|
|
|
|
PACKAGE_VERSION = VersionNumber([
|
|
|
|
versionNumberString : '${SEMVER}-${LOWER_BUILD_TYPE}-${BUILD_DATE_FORMATTED, "yyyyMMdd"}'
|
|
|
|
]);
|
|
|
|
|
|
|
|
DOCKER_VERSION = VersionNumber([
|
|
|
|
versionNumberString : '${DOCKER_VERSION_STR}'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage("Run Build") {
|
|
|
|
agent {
|
|
|
|
kubernetes {
|
|
|
|
cloud 'build-kubernetes'
|
|
|
|
label 'build'
|
|
|
|
defaultContainer 'jnlp'
|
|
|
|
containerTemplate {
|
|
|
|
name 'milvus-build-env'
|
2019-07-17 13:50:03 +08:00
|
|
|
image 'registry.zilliz.com/milvus/milvus-build-env:v0.11'
|
2019-07-05 18:07:40 +08:00
|
|
|
ttyEnabled true
|
|
|
|
command 'cat'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Build') {
|
|
|
|
steps {
|
|
|
|
gitlabCommitStatus(name: 'Build') {
|
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/milvus_build_no_ut.groovy"
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/packaged_milvus_no_ut.groovy"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
aborted {
|
|
|
|
script {
|
|
|
|
updateGitlabCommitStatus name: 'Build', state: 'canceled'
|
|
|
|
echo "Milvus Build aborted !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
failure {
|
|
|
|
script {
|
|
|
|
updateGitlabCommitStatus name: 'Build', state: 'failed'
|
|
|
|
echo "Milvus Build failure !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage("Publish docker and helm") {
|
|
|
|
agent {
|
|
|
|
kubernetes {
|
|
|
|
label 'publish'
|
|
|
|
defaultContainer 'jnlp'
|
|
|
|
yaml """
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Pod
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: publish
|
|
|
|
componet: docker
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: publish-docker
|
|
|
|
image: registry.zilliz.com/library/zilliz_docker:v1.0.0
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
command:
|
|
|
|
- cat
|
|
|
|
tty: true
|
|
|
|
volumeMounts:
|
|
|
|
- name: docker-sock
|
|
|
|
mountPath: /var/run/docker.sock
|
|
|
|
volumes:
|
|
|
|
- name: docker-sock
|
|
|
|
hostPath:
|
|
|
|
path: /var/run/docker.sock
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Publish Docker') {
|
|
|
|
steps {
|
|
|
|
gitlabCommitStatus(name: 'Publish Docker') {
|
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/publish_docker.groovy"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
aborted {
|
|
|
|
script {
|
|
|
|
updateGitlabCommitStatus name: 'Publish Docker', state: 'canceled'
|
|
|
|
echo "Milvus Publish Docker aborted !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
failure {
|
|
|
|
script {
|
|
|
|
updateGitlabCommitStatus name: 'Publish Docker', state: 'failed'
|
|
|
|
echo "Milvus Publish Docker failure !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage("Deploy to Development") {
|
2019-07-12 23:26:03 +08:00
|
|
|
parallel {
|
2019-07-14 21:50:48 +08:00
|
|
|
stage("Single Node") {
|
|
|
|
agent {
|
|
|
|
kubernetes {
|
|
|
|
label 'dev-test'
|
|
|
|
defaultContainer 'jnlp'
|
|
|
|
yaml """
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Pod
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: milvus
|
|
|
|
componet: test
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: milvus-testframework
|
|
|
|
image: registry.zilliz.com/milvus/milvus-test:v0.2
|
|
|
|
command:
|
|
|
|
- cat
|
|
|
|
tty: true
|
|
|
|
volumeMounts:
|
|
|
|
- name: kubeconf
|
|
|
|
mountPath: /root/.kube/
|
|
|
|
readOnly: true
|
|
|
|
volumes:
|
|
|
|
- name: kubeconf
|
|
|
|
secret:
|
|
|
|
secretName: test-cluster-config
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-05 18:07:40 +08:00
|
|
|
stages {
|
2019-07-12 23:26:03 +08:00
|
|
|
stage("Deploy to Dev") {
|
2019-07-14 21:50:48 +08:00
|
|
|
steps {
|
|
|
|
gitlabCommitStatus(name: 'Deloy to Dev') {
|
|
|
|
container('milvus-testframework') {
|
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/deploy2dev.groovy"
|
2019-07-12 23:26:03 +08:00
|
|
|
}
|
2019-07-05 18:07:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-12 23:26:03 +08:00
|
|
|
stage("Dev Test") {
|
2019-07-14 21:50:48 +08:00
|
|
|
steps {
|
|
|
|
gitlabCommitStatus(name: 'Deloy Test') {
|
|
|
|
container('milvus-testframework') {
|
2019-07-12 23:26:03 +08:00
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/dev_test.groovy"
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/upload_dev_test_out.groovy"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-05 18:07:40 +08:00
|
|
|
}
|
|
|
|
}
|
2019-07-12 23:26:03 +08:00
|
|
|
stage ("Cleanup Dev") {
|
2019-07-14 21:50:48 +08:00
|
|
|
steps {
|
|
|
|
gitlabCommitStatus(name: 'Cleanup Dev') {
|
|
|
|
container('milvus-testframework') {
|
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/cleanup_dev.groovy"
|
2019-07-12 23:26:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-14 21:50:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
container('milvus-testframework') {
|
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/cleanup_dev.groovy"
|
2019-07-05 18:07:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-14 21:50:48 +08:00
|
|
|
success {
|
|
|
|
script {
|
|
|
|
echo "Milvus Single Node CI/CD success !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aborted {
|
|
|
|
script {
|
|
|
|
echo "Milvus Single Node CI/CD aborted !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
failure {
|
|
|
|
script {
|
|
|
|
echo "Milvus Single Node CI/CD failure !"
|
|
|
|
}
|
|
|
|
}
|
2019-07-05 18:07:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-12 23:26:03 +08:00
|
|
|
stage("Cluster") {
|
2019-07-14 21:50:48 +08:00
|
|
|
agent {
|
|
|
|
kubernetes {
|
|
|
|
label 'dev-test'
|
|
|
|
defaultContainer 'jnlp'
|
|
|
|
yaml """
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Pod
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: milvus
|
|
|
|
componet: test
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: milvus-testframework
|
|
|
|
image: registry.zilliz.com/milvus/milvus-test:v0.2
|
|
|
|
command:
|
|
|
|
- cat
|
|
|
|
tty: true
|
|
|
|
volumeMounts:
|
|
|
|
- name: kubeconf
|
|
|
|
mountPath: /root/.kube/
|
|
|
|
readOnly: true
|
|
|
|
volumes:
|
|
|
|
- name: kubeconf
|
|
|
|
secret:
|
|
|
|
secretName: test-cluster-config
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|
2019-07-05 18:07:40 +08:00
|
|
|
stages {
|
2019-07-12 23:26:03 +08:00
|
|
|
stage("Deploy to Dev") {
|
2019-07-14 21:50:48 +08:00
|
|
|
steps {
|
|
|
|
gitlabCommitStatus(name: 'Deloy to Dev') {
|
|
|
|
container('milvus-testframework') {
|
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/cluster_deploy2dev.groovy"
|
2019-07-12 23:26:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-05 18:07:40 +08:00
|
|
|
}
|
2019-07-12 23:26:03 +08:00
|
|
|
stage("Dev Test") {
|
2019-07-14 21:50:48 +08:00
|
|
|
steps {
|
|
|
|
gitlabCommitStatus(name: 'Deloy Test') {
|
|
|
|
container('milvus-testframework') {
|
2019-07-12 23:26:03 +08:00
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/cluster_dev_test.groovy"
|
2019-07-14 21:50:48 +08:00
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/upload_dev_cluster_test_out.groovy"
|
2019-07-12 23:26:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-05 18:07:40 +08:00
|
|
|
}
|
|
|
|
}
|
2019-07-12 23:26:03 +08:00
|
|
|
stage ("Cleanup Dev") {
|
2019-07-14 21:50:48 +08:00
|
|
|
steps {
|
|
|
|
gitlabCommitStatus(name: 'Cleanup Dev') {
|
|
|
|
container('milvus-testframework') {
|
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/cluster_cleanup_dev.groovy"
|
2019-07-12 23:26:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-14 21:50:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
container('milvus-testframework') {
|
|
|
|
script {
|
|
|
|
load "${env.WORKSPACE}/ci/jenkinsfile/cluster_cleanup_dev.groovy"
|
2019-07-12 23:26:03 +08:00
|
|
|
}
|
2019-07-05 18:07:40 +08:00
|
|
|
}
|
|
|
|
}
|
2019-07-14 21:50:48 +08:00
|
|
|
success {
|
|
|
|
script {
|
|
|
|
echo "Milvus Cluster CI/CD success !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aborted {
|
|
|
|
script {
|
|
|
|
echo "Milvus Cluster CI/CD aborted !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
failure {
|
|
|
|
script {
|
|
|
|
echo "Milvus Cluster CI/CD failure !"
|
|
|
|
}
|
|
|
|
}
|
2019-07-05 18:07:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
2019-07-12 23:26:03 +08:00
|
|
|
always {
|
|
|
|
script {
|
2019-07-14 21:50:48 +08:00
|
|
|
if (env.gitlabAfter != null) {
|
|
|
|
if (!currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
|
|
|
|
// Send an email only if the build status has changed from green/unstable to red
|
|
|
|
emailext subject: '$DEFAULT_SUBJECT',
|
|
|
|
body: '$DEFAULT_CONTENT',
|
|
|
|
recipientProviders: [
|
|
|
|
[$class: 'DevelopersRecipientProvider'],
|
|
|
|
[$class: 'RequesterRecipientProvider']
|
|
|
|
],
|
|
|
|
replyTo: '$DEFAULT_REPLYTO',
|
|
|
|
to: '$DEFAULT_RECIPIENTS'
|
|
|
|
}
|
2019-07-12 23:26:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-05 18:07:40 +08:00
|
|
|
success {
|
|
|
|
script {
|
|
|
|
updateGitlabCommitStatus name: 'CI/CD', state: 'success'
|
|
|
|
echo "Milvus CI/CD success !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aborted {
|
|
|
|
script {
|
|
|
|
updateGitlabCommitStatus name: 'CI/CD', state: 'canceled'
|
|
|
|
echo "Milvus CI/CD aborted !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
failure {
|
|
|
|
script {
|
|
|
|
updateGitlabCommitStatus name: 'CI/CD', state: 'failed'
|
|
|
|
echo "Milvus CI/CD failure !"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-12 23:26:03 +08:00
|
|
|
|