-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
41 lines (41 loc) · 2.15 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
node{
def extractreport = '(cd ./static && tar xvjf ../qmstr-reports.tar.bz2 && mv ./reports ./packages)'
def extractdocs = '(cd ./static && tar xvjf ../qmstr-doc.tar.bz2)'
try{
stage('Clone sources') {
cleanWs()
git credentialsId: '6374572f-c47a-4939-beda-2ee601d65ff7', poll: true, url: 'https://github.com/qmstr/web'
}
stage('Copy artifacts') {
echo "Copying artifacts from last successful build from DOCS job"
copyArtifacts fingerprintArtifacts: true, flatten: true, projectName: 'qmstr-website/docs', selector: upstream(fallbackToLastSuccessful: true)
echo "Copying artifacts from last successful build from the hugo website generation job"
copyArtifacts fingerprintArtifacts: true, flatten: true, projectName: 'qmstr-website/hugo-web-generation', selector: upstream(fallbackToLastSuccessful: true)
}
stage('Publish website'){
withEnv(["PATH+SNAP=/snap/bin"]){
echo "Publishing QMSTR site"
sh 'git submodule init && git submodule update'
sh "${extractdocs}"
sh "${extractreport}"
sh './scripts/generate-data-branch.sh ./web_data_dir'
sh 'git config http.sslVersion tlsv1.2'
withCredentials([usernamePassword(credentialsId: 'endocode-ci', passwordVariable: 'cipassword', usernameVariable: 'ciuser')]) {
sh 'git push --force https://${ciuser}:${cipassword}@github.com/qmstr/web gh-pages'
}
}
}
}
catch (Exception e)
{
currentBuild.result = 'FAILURE'
}
finally {
if (currentBuild.result == 'SUCCESS' && currentBuild.getPreviousBuild().result != 'SUCCESS') {
googlechatnotification message: "Job ${env.JOB_NAME} ${env.BUILD_NUMBER} successfully finished. See ${env.BUILD_URL}", url: "id:qmstr_hangout_chat_webhook"
}
if (currentBuild.result == 'FAILURE') {
googlechatnotification message: "Job ${env.JOB_NAME} ${env.BUILD_NUMBER} failed. See ${env.BUILD_URL}", url: "id:qmstr_hangout_chat_webhook"
}
}
}