-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
70 lines (61 loc) · 1.93 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
pipeline {
environment {
imagename = "bilel707/projectfront"
scannerHome = tool name: 'sonarqube-scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
registryCredential = 'Docker_hub'
}
agent any
// docker {
// image 'node:lts-buster-slim'
// args '-p 3000:3000'
// }
stages {
stage("test-sonar"){
steps{
script {
withSonarQubeEnv("sonarQube") {
sh "${scannerHome}/bin/sonar-scanner \
-Dsonar.projectKey=Project-Devops \
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=c8b2c764943238488fb46caf357927b330c86cbf"
}
}
}
}
stage('Build') {
steps {
sh 'npm install'
sh 'CI=false npm run build'
}
}
stage("docker-build"){
steps{
script {
dockerImage = docker.build imagename
}
}
}
stage("docker-deploy-img"){
steps{
script {
docker.withRegistry('', registryCredential) {
dockerImage.push('latest')
}
}
}
}
stage('Test') {
steps {
sh './jenkins/scripts/test.sh'
}
}
stage('Deliver') {
steps {
sh './jenkins/scripts/deliver.sh'
input message: 'Finished using the web site? (Click "Proceed" to continue)'
sh './jenkins/scripts/kill.sh'
}
}
}
}