forked from milvus-io/milvus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPublishMigrationImage.groovy
68 lines (64 loc) · 2.53 KB
/
PublishMigrationImage.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env groovy
def app="meta-migration"
def date=""
def gitShortCommit=""
pipeline {
agent {
kubernetes {
defaultContainer 'main'
yamlFile "ci/jenkins/pod/meta-migration.yaml"
customWorkspace '/home/jenkins/agent/workspace'
}
}
options {
timestamps()
timeout(time: 36, unit: 'MINUTES')
disableConcurrentBuilds()
}
environment {
HARBOR_REPO = "harbor.milvus.io"
CI_DOCKER_CREDENTIAL_ID="harbor-milvus-io-registry"
}
stages {
stage('Publish Meta Migration Images') {
steps {
container('main'){
script {
sh 'ls -lah'
sh './build/set_docker_mirror.sh'
sh """
build/builder.sh /bin/bash -c \"make install && make meta-migration \"
"""
date=sh(returnStdout: true, script: 'date +%Y%m%d').trim()
gitShortCommit=sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
sh 'printenv'
def tag="${date}-${gitShortCommit}"
def image="${env.HARBOR_REPO}/milvus/${app}:${tag}"
withCredentials([usernamePassword(credentialsId: "${env.CI_DOCKER_CREDENTIAL_ID}", usernameVariable: 'CI_REGISTRY_USERNAME', passwordVariable: 'CI_REGISTRY_PASSWORD')]){
sh "docker login ${env.HARBOR_REPO} -u '${CI_REGISTRY_USERNAME}' -p '${CI_REGISTRY_PASSWORD}'"
sh """
docker build -t ${image} -f build/docker/meta-migration/Dockerfile .
docker push ${image}
docker logout
"""
}
}
}
}
}
}
post {
unsuccessful {
container('jnlp') {
script {
emailext subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [developers(), culprits()],
replyTo: '$DEFAULT_REPLYTO',
// to: "${authorEmail},qa@zilliz.com,devops@zilliz.com"
to: "devops@zilliz.com"
}
}
}
}
}