pipeline { agent any environment { NODE_ENV = 'production' } stages { stage('Setup Node.js') { steps { nodejs(nodeJSInstallationName: 'Node23') { sh 'node -v' sh 'npm -v' } } } stage('Install Dependencies') { steps { nodejs(nodeJSInstallationName: 'Node23') { sh 'npm ci --include=dev' } } } stage('Build') { steps { nodejs(nodeJSInstallationName: 'Node23') { sh 'npm run build' } } } stage('Deploy to printer1') { steps { script { def remote = [:] remote.name = 'printer1' remote.host = 'printer1.tombutcher.local' remote.user = 'ci' remote.password = 'ci' remote.allowAnyHosts = true // Upload the build folder sshPut remote: remote, from: 'build/', into: '/srv/farmcontrol-server/' // Restart the service sshCommand remote: remote, command: 'sudo /bin/systemctl restart farmcontrol-server.service' } } } } post { always { cleanWs() } success { echo 'Pipeline completed successfully!' } failure { echo 'Pipeline failed!' } } }