diff --git a/Jenkinsfile b/Jenkinsfile index 43901e2..088d3bd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,10 +61,18 @@ pipeline { steps { script { 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 """ 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}" }