adding container kubectl to make this works

This commit is contained in:
areeqakbr 2025-02-25 14:04:39 +07:00
parent 8f23cfe060
commit cf44fe08ae
1 changed files with 9 additions and 7 deletions

16
Jenkinsfile vendored
View File

@ -79,13 +79,15 @@ spec:
stage('Deploy to Kubernetes') { stage('Deploy to Kubernetes') {
steps { steps {
script { container('kubectl') {
withCredentials([file(credentialsId: "${KUBE_CONFIG_ID}", variable: 'KUBE_CONFIG')]) { script {
writeFile file: 'kubeconfig', text: KUBE_CONFIG withCredentials([file(credentialsId: "${KUBE_CONFIG_ID}", variable: 'KUBE_CONFIG')]) {
sh """ writeFile file: 'kubeconfig', text: KUBE_CONFIG
kubectl apply -f deploy/kubernetes/dev.yaml --kubeconfig=kubeconfig sh """
kubectl set image deployment/backend backend=${REGISTRY_URL}/${IMAGE_NAME}:dev-${env.SHORT_SHA} -n nam-backend-dev --kubeconfig=kubeconfig kubectl apply -f deploy/kubernetes/dev.yaml --kubeconfig=kubeconfig
""" kubectl set image deployment/backend backend=${REGISTRY_URL}/${IMAGE_NAME}:dev-${env.SHORT_SHA} -n nam-backend-dev --kubeconfig=kubeconfig
"""
}
} }
} }
} }