File size: 688 Bytes
5120311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
node {
    checkout scm

    env.DOCKER_API_VERSION="1.23"
    registry_host = env.registry_host
    appName = "clusteringcpu"

    sh "git rev-parse --short HEAD > commit-id"
    tag = readFile('commit-id').replace("\n", "").replace("\r", "")

    stage("build"){
        sh "docker build --tag ${registry_host}/${appName}:${tag} --file Dockerfile ."
    }
    stage("push"){
        sh "docker push ${registry_host}/${appName}:${tag}"
    }
    stage("deploy"){
        sh "sed -i s/{{tag}}/${tag}/g deployment.yaml \
        && sed -i 's|{{registry_host}}|${registry_host}|g' deployment.yaml \
        && kubectl ${env.token_kube} apply -f deployment.yaml"
    }
}