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" } }