-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
47 lines (46 loc) · 1.74 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
pipeline {
agent any
stages {
stage('Git repo'){
steps{
git branch: 'main', url: 'https://github.com/OscarAraya18/Karaoke.git'
}
}
stage('Unit testing'){
steps {
dir('Backend') {
sh 'npm i'
sh 'npm run test'
}
dir('Frontend') {
sh 'npm i'
sh 'ng test -- --watch=false --browsers ChromeHeadless'
}
}
}
stage('SonarCloud Analysis'){
steps {
withSonarQubeEnv('sonar'){
sh "/var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonar-qube2/bin/sonar-scanner \
-D sonar.organization=oscararaya18 \
-D sonar.projectKey=OscarAraya18_Karaoke \
-D sonar.sources=. \
-D sonar.host.url=https://sonarcloud.io/"
}
}
}
stage('Deploy'){
steps {
sshPublisher(publishers: [sshPublisherDesc(configName: 'Solution', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''cd Karaoke
git pull https://github.com/OscarAraya18/Karaoke
cd Backend
npm i
cd ..
cd Frontend
npm i
pm2 restart all
cd''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
}
}
}
}