-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
67 lines (62 loc) · 2.35 KB
/
Jenkinsfile
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
pipeline {
agent any
options{
// Max number of build logs to keep and days to keep
buildDiscarder(logRotator(numToKeepStr: '5', daysToKeepStr: '5'))
// Enable timestamp at each job in the pipeline
timestamps()
}
environment{
registry = 'hieugoku/text-image-retrieval-app'
registryCredential = 'dockerhub'
}
stages {
stage('Test') {
steps {
echo 'Testing model correctness..'
echo 'Always pass all test unit :))'
}
}
stage('Build image') {
steps {
script {
echo 'Building image for deployment...'
def imageName = "${registry}:v${BUILD_NUMBER}"
dockerImage = docker.build(imageName, "--file Dockerfile-app-serving .")
echo 'Pushing image to dockerhub...'
docker.withRegistry( '', registryCredential ) {
dockerImage.push()
}
}
}
}
stage('Deploy to Google Kubernetes Engine') {
agent {
kubernetes {
containerTemplate {
name 'helm' // Name of the container to be used for helm upgrade
image 'hieugoku/jenkins:lts' // The image containing helm
}
}
}
steps {
script {
steps
container('helm') {
sh("helm upgrade --install app --set image.repository=${registry} \
--set image.tag=v${BUILD_NUMBER} \
--set env.QDRANT_URL=${QDRANT_URL} \
--set env.QDRANT_CLOUD_KEY=${QDRANT_CLOUD_KEY} \
--set env.COLLECTION_NAME=${COLLECTION_NAME} \
--set env.HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY} \
--set env.DATA_DIR=${DATA_DIR} \
--set env.MODEL_DIR=${MODEL_DIR} \
--set env.BUCKET_NAME=${BUCKET_NAME} \
--set env.IMAGE_URL_TEMPLATE=${IMAGE_URL_TEMPLATE} \
./helm_charts/app --namespace model-serving")
}
}
}
}
}
}