-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile
64 lines (64 loc) · 2.08 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
pipeline {
options { disableConcurrentBuilds() }
agent { label 'docker-slave' }
stages {
stage ('Pull repo code from github') {
steps {
checkout scm
sh('git config --global user.email "[email protected]"')
sh('git config --global user.name "Sodalite Jenkins"')
sh('git reset --hard origin/${BRANCH_NAME}')
}
}
stage ('Build IDE and run Sonar') {
steps {
sh """ #!/bin/bash
cd "dsl/org.sodalite.IDE.parent/"
mvn clean verify -Dmaven.test.skip
git reset --hard
"""
}
}
stage('SonarQube analysis'){
environment {
scannerHome = tool 'SonarQubeScanner'
}
steps {
withSonarQubeEnv('SonarCloud') {
sh """ #!/bin/bash
cd "dsl/org.sodalite.IDE.parent/"
${scannerHome}/bin/sonar-scanner
"""
}
}
}
stage ('Publish update site') {
steps {
withCredentials([usernamePassword(credentialsId: 'sodalite-jenkins_github_creds', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh('mkdir -p site')
sh('scripts/publish_site.sh ${GIT_USERNAME} ${GIT_PASSWORD}')
}
}
}
stage('Build and push IDE image') {
when {
branch "master"
}
steps{
withDockerRegistry(credentialsId: 'jenkins-sodalite.docker_token', url: '') {
sh "cd Docker; ./create_sodalite_ide_image.sh"
sh "docker tag sodalite-ide sodaliteh2020/sodalite-ide"
sh "docker push sodaliteh2020/sodalite-ide:latest"
}
}
}
}
post {
failure {
slackSend (channel: '@Gad Maor', color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
fixed {
slackSend (channel: '@Gad Maor', color: '#6d3be3', message: "FIXED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}