PM2 with jenkins

14 Views Asked by At
    pipeline {
    agent any
    
    stages {
        stage('Checkout') {
            steps {
                git 'https://github.com/suyognepal/devops-assessment.git'
            }
        }
        
        stage('Install Dependencies') {
            steps {
                sh 'npm install'
            }
        }
        
        stage('Test') {
            steps {
                sh 'npm test test/index.js'
            }
        }
        
        stage('Deploy') {
            steps {
                sh 'pm2 stop index.js'
                sh 'pm2 start index.js'
            }
        }                                                                   
    }
}

This is what i am doing i dont want to use sudo user for this operation. Didn't find any thing with out using being sudo.

0

There are 0 best solutions below