forked from hyperledger-archives/sawtooth-docs-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
62 lines (53 loc) · 2.16 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
#!groovy
// Copyright (c) 2018 Bitwise IO, Inc.
// Licensed under Creative Commons Attribution 4.0 International License
// https://creativecommons.org/licenses/by/4.0/
// Discard old builds after 31 days
properties([[$class: 'BuildDiscarderProperty', strategy:
[$class: 'LogRotator', artifactDaysToKeepStr: '',
artifactNumToKeepStr: '', daysToKeepStr: '31', numToKeepStr: '']],
pipelineTriggers([cron('H 2 * * *')])]);
node ('master') {
timestamps {
// Create a unique workspace so Jenkins doesn't reuse an existing one
ws("workspace/${env.BUILD_TAG}") {
stage("Clone Repo") {
checkout scm
}
if (!(env.BRANCH_NAME == 'master' && env.JOB_BASE_NAME == 'master')) {
stage("Check Whitelist") {
readTrusted 'bin/whitelist'
sh './bin/whitelist "$CHANGE_AUTHOR" /etc/jenkins-authorized-builders'
}
}
stage("Check for Signed-Off Commits") {
sh '''#!/bin/bash -l
if [ -v CHANGE_URL ] ;
then
temp_url="$(echo $CHANGE_URL |sed s#github.com/#api.github.com/repos/#)/commits"
pull_url="$(echo $temp_url |sed s#pull#pulls#)"
IFS=$'\n'
for m in $(curl -s "$pull_url" | grep "message") ; do
if echo "$m" | grep -qi signed-off-by:
then
continue
else
echo "FAIL: Missing Signed-Off Field"
echo "$m"
exit 1
fi
done
unset IFS;
fi
'''
}
stage("Build website") {
sh 'BUILDONLY=true docker-compose up'
sh 'BUILDONLY=true docker-compose down'
}
stage("Archive Build artifacts") {
archiveArtifacts artifacts: 'generator/archive/htdocs/**'
}
}
}
}