changing kubernetes deployment

This commit is contained in:
areeqakbr 2025-02-25 16:23:01 +07:00
parent d005ab82d6
commit 3bbc19ddff
1 changed files with 4 additions and 21 deletions

25
Jenkinsfile vendored
View File

@ -84,27 +84,10 @@ spec:
stage('Deploy to Kubernetes') { stage('Deploy to Kubernetes') {
steps { steps {
container('kubectl') { kubernetesDeploy(
script { kubeconfigId: "${KUBE_CONFIG_ID}",
// Print container info for diagnostics configs: 'deploy/kubernetes',
sh 'echo "Running in $(hostname) with kubectl version: $(kubectl version --client)"' )
withCredentials([file(credentialsId: "${KUBE_CONFIG_ID}", variable: 'KUBE_CONFIG')]) {
// Copy kubeconfig to a location with proper permissions
sh 'mkdir -p ~/.kube'
sh 'cp $KUBE_CONFIG ~/.kube/config'
sh 'chmod 600 ~/.kube/config'
// Apply deployment with proper error handling
sh """
set -xe
kubectl apply -f deploy/kubernetes/dev.yaml
kubectl set image deployment/backend backend=${REGISTRY_URL}/${IMAGE_NAME}:dev-${env.SHORT_SHA} -n nam-backend-dev
kubectl rollout status deployment/backend -n nam-backend-dev --timeout=60s
"""
}
}
}
} }
} }
} }