jenkinsfile
Some checks failed
eCommerce-backend/pipeline/head There was a failure building this commit

This commit is contained in:
2026-02-20 17:23:21 +00:00
parent 09309ba36c
commit a7d3975db5

12
Jenkinsfile vendored
View File

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