jenkinsfile
Some checks failed
eCommerce-backend/pipeline/head There was a failure building this commit
Some checks failed
eCommerce-backend/pipeline/head There was a failure building this commit
This commit is contained in:
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
@@ -61,10 +61,18 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
withCredentials([file(credentialsId: 'k8s-config', variable: 'KUBECONFIG')]) {
|
withCredentials([file(credentialsId: 'k8s-config', variable: 'KUBECONFIG')]) {
|
||||||
// Now kubectl will exist and be found
|
// 1. Change imagePullPolicy to 'Always'
|
||||||
|
// 2. Ensure imagePullSecrets is added so K8s can login to Harbor
|
||||||
sh """
|
sh """
|
||||||
kubectl --kubeconfig=${KUBECONFIG} patch deployment ${APP_NAME} -n ${NAMESPACE} --patch \
|
kubectl --kubeconfig=${KUBECONFIG} patch deployment ${APP_NAME} -n ${NAMESPACE} --patch \
|
||||||
'{"spec": {"template": {"spec": {"containers": [{"name": "${APP_NAME}", "image": "${IMAGE_TAG}", "imagePullPolicy": "Never"}]}}}}'
|
'{"spec": {"template": {"spec": {
|
||||||
|
"imagePullSecrets": [{"name": "harbor-pull-secret"}],
|
||||||
|
"containers": [{
|
||||||
|
"name": "${APP_NAME}",
|
||||||
|
"image": "${IMAGE_TAG}",
|
||||||
|
"imagePullPolicy": "Always"
|
||||||
|
}]
|
||||||
|
}}}}'
|
||||||
"""
|
"""
|
||||||
sh "kubectl --kubeconfig=${KUBECONFIG} rollout status deployment/${APP_NAME} -n ${NAMESPACE}"
|
sh "kubectl --kubeconfig=${KUBECONFIG} rollout status deployment/${APP_NAME} -n ${NAMESPACE}"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user