From 2d814639f147ee91d9200d215bf697fafb07d8a2 Mon Sep 17 00:00:00 2001 From: Claude AI Date: Tue, 6 Jan 2026 09:21:46 +0000 Subject: [PATCH] fix(rollback): Use writeFile for proper variable substitution in HTML --- apps/demo-nginx/Jenkinsfile.rollback | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/apps/demo-nginx/Jenkinsfile.rollback b/apps/demo-nginx/Jenkinsfile.rollback index 5205147..6c47af8 100644 --- a/apps/demo-nginx/Jenkinsfile.rollback +++ b/apps/demo-nginx/Jenkinsfile.rollback @@ -94,7 +94,7 @@ pipeline { kubectl get pods -n ${NAMESPACE} -l app=${APP_NAME} echo "" - echo "=== Rollout History ===\" + echo "=== Rollout History ===" kubectl rollout history deployment/${APP_NAME} -n ${NAMESPACE} """ } @@ -143,20 +143,15 @@ pipeline { echo "🔨 Rebuilding image with updated design..." // Create Dockerfile - sh """ - cat > Dockerfile << 'EOF' -FROM nginx:1.25.3-alpine + writeFile file: 'Dockerfile', text: '''FROM nginx:1.25.3-alpine COPY index.html /usr/share/nginx/html/index.html COPY nginx.conf /etc/nginx/nginx.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] -EOF - """ +''' - // Create HTML with rollback marker - sh """ - cat > index.html << EOF - + // Create HTML with proper variable substitution + def htmlContent = """ Demo Nginx - Rollback @@ -216,13 +211,12 @@ EOF -EOF - """ +""" + + writeFile file: 'index.html', text: htmlContent // Create nginx.conf - sh ''' - cat > nginx.conf << 'EOF' -user nginx; + writeFile file: 'nginx.conf', text: '''user nginx; worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; @@ -250,8 +244,7 @@ http { } } } -EOF - ''' +''' // Build new image sh """