-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
93 lines (82 loc) · 3.7 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!groovy
def executors = 'Ubuntu-18.04'
properties([gitLabConnection('https://gitlab.cs.fau.de/'),
])
node(executors) {
gitlabBuilds(builds: ['build', 'lint', 'test']) {
gitlabCommitStatus(name: "build") {
stage('Preparation') {
cleanWs()
checkout scm
sh """#!/usr/bin/env bash
set -e
set -x
echo "###############################################################"
echo "# GITLAB PLUGIN OUTPUT"
echo "###############################################################"
echo ""
echo gitlabBranch \$gitlabBranch
echo gitlabSourceBranch \$gitlabSourceBranch
echo gitlabActionType \$gitlabActionType
echo gitlabUserName \$gitlabUserName
echo gitlabUserEmail \$gitlabUserEmail
echo gitlabSourceRepoHomepage \$gitlabSourceRepoHomepage
echo gitlabSourceRepoName \$gitlabSourceRepoName
echo gitlabSourceNamespace \$gitlabSourceNamespace
echo gitlabSourceRepoURL \$gitlabSourceRepoURL
echo gitlabSourceRepoSshUrl \$gitlabSourceRepoSshUrl
echo gitlabSourceRepoHttpUrl \$gitlabSourceRepoHttpUrl
echo gitlabMergeRequestTitle \$gitlabMergeRequestTitle
echo gitlabMergeRequestDescription \$gitlabMergeRequestDescription
echo gitlabMergeRequestId \$gitlabMergeRequestId
echo gitlabMergeRequestIid \$gitlabMergeRequestIid
echo gitlabMergeRequestState \$gitlabMergeRequestState
echo gitlabMergedByUser \$gitlabMergedByUser
echo gitlabMergeRequestAssignee \$gitlabMergeRequestAssignee
echo gitlabMergeRequestLastCommit \$gitlabMergeRequestLastCommit
echo gitlabMergeRequestTargetProjectId \$gitlabMergeRequestTargetProjectId
echo gitlabTargetBranch \$gitlabTargetBranch
echo gitlabTargetRepoName \$gitlabTargetRepoName
echo gitlabTargetNamespace \$gitlabTargetNamespace
echo gitlabTargetRepoSshUrl \$gitlabTargetRepoSshUrl
echo gitlabTargetRepoHttpUrl \$gitlabTargetRepoHttpUrl
echo gitlabBefore \$gitlabBefore
echo gitlabAfter \$gitlabAfter
echo gitlabTriggerPhrase \$gitlabTriggerPhrase
echo "###############################################################"
echo ""
export GEM_HOME="\$(pwd)/gems"
gem install rake
bundle install
"""
}
}
gitlabCommitStatus(name: "lint") {
stage('Lint') {
sh """#!/usr/bin/env bash
set -e
set -x
export GEM_HOME="\$(pwd)/gems"
MERGE_BASE="\$(git merge-base ${gitlabBefore} ${gitlabAfter} || true)"
if [[ ! -z \${MERGE_BASE+x} ]]; then
echo "Could not determine MERGE_BASE: Assuming force push, using master as base"
MERGE_BASE="\$(git merge-base refs/remotes/origin/master ${gitlabAfter})"
fi
bundle exec pronto run -c "\${MERGE_BASE}"
"""
}
}
gitlabCommitStatus(name: "test") {
stage('Test') {
sh """#!/usr/bin/env bash
set -e
set -x
export GEM_HOME="\$(pwd)/gems"
export LD_LIBRARY_PATH="/usr/lib/lp_solve"
export PATH="\$(pwd):\$PATH"
bundle exec ./test/testrunner.rb -v -v
"""
}
}
}
}