From e939fe13538b8324ff5d600f6f9261c6ba0b1c41 Mon Sep 17 00:00:00 2001 From: VIPIN Date: Thu, 28 Aug 2025 15:51:16 +0530 Subject: [PATCH] Update Jenkinsfile: use npm install instead of npm ci --- Jenkinsfile | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7ec319f..607c5a1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,14 +1,29 @@ pipeline { agent any - tools { nodejs 'Node' } + tools { nodejs 'Node' } // make sure in Jenkins -> Global Tool Config -> NodeJS is named "Node" environment { WEB_IP = '13.49.223.142' // your EC2 web server IP SSH_CRED = 'deploy-ec2-key' // Jenkins credential ID for SSH key } stages { - stage('Checkout') { steps { checkout scm } } - stage('Install') { steps { sh 'npm ci || npm install' } } - stage('Build') { steps { sh 'npm run build' } } + stage('Checkout') { + steps { + checkout scm + } + } + + stage('Install') { + steps { + sh 'npm install' // + } + } + + stage('Build') { + steps { + sh 'npm run build' + } + } + stage('Package') { steps { sh ''' @@ -24,6 +39,7 @@ pipeline { archiveArtifacts artifacts: 'build.tar.gz' } } + stage('Deploy') { steps { sshagent(credentials: [env.SSH_CRED]) { @@ -40,6 +56,7 @@ pipeline { } } } + post { success { echo "✅ Deployed successfully" } failure { echo "❌ Failed — check console" }