Added Jenskinsfile.
Some checks reported warnings
farmcontrol/farmcontrol-api/pipeline/head This commit is unstable
Some checks reported warnings
farmcontrol/farmcontrol-api/pipeline/head This commit is unstable
This commit is contained in:
parent
a7e35c279e
commit
2d156aa98f
74
Jenkinsfile
vendored
Normal file
74
Jenkinsfile
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
pipeline {
|
||||
agent {
|
||||
label 'ubuntu'
|
||||
}
|
||||
|
||||
environment {
|
||||
NODE_ENV = 'production'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Setup Node.js') {
|
||||
steps {
|
||||
nodejs(nodeJSInstallationName: 'Node23') {
|
||||
sh 'node -v'
|
||||
sh 'yarn -v'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install Dependencies') {
|
||||
steps {
|
||||
nodejs(nodeJSInstallationName: 'Node23') {
|
||||
sh 'yarn install --frozen-lockfile --production=false'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy via SSH') {
|
||||
steps {
|
||||
sshPublisher(publishers: [
|
||||
sshPublisherDesc(
|
||||
configName: 'farmcontrol.tombutcher.local',
|
||||
transfers: [
|
||||
sshTransfer(
|
||||
cleanRemote: false,
|
||||
excludes: 'node_modules/**',
|
||||
execCommand: '''
|
||||
cd /opt/farmcontrol-api
|
||||
yarn install --production
|
||||
pm2 restart ecosystem.config.js --env production || pm2 start ecosystem.config.js --env production
|
||||
''',
|
||||
execTimeout: 120000,
|
||||
flatten: false,
|
||||
makeEmptyDirs: false,
|
||||
noDefaultExcludes: false,
|
||||
patternSeparator: '[, ]+',
|
||||
remoteDirectory: 'farmcontrol-api',
|
||||
remoteDirectorySDF: false,
|
||||
removePrefix: '',
|
||||
sourceFiles: '**/*'
|
||||
)
|
||||
],
|
||||
usePromotionTimestamp: false,
|
||||
useWorkspaceInPromotion: false,
|
||||
verbose: true
|
||||
)
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user