forked from nrfconnect/sdk-mcuboot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
68 lines (62 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
def IMAGE_TAG = "ncs-toolchain:1.06"
def REPO_CI_TOOLS = "https://github.com/zephyrproject-rtos/ci-tools.git"
pipeline {
agent {
docker {
image "$IMAGE_TAG"
label "docker && ncs"
}
}
options {
// Checkout the repository to this folder instead of root
checkoutToSubdirectory('mcuboot')
}
environment {
// This token is used to by check_compliance to comment on PRs and use checks
GH_TOKEN = credentials('nordicbuilder-compliance-token')
GH_USERNAME = "NordicBuilder"
COMPLIANCE_SCRIPT_PATH = "../ci-tools/scripts/check_compliance.py"
COMPLIANCE_ARGS = "-g -r NordicPlayground/fw-nrfconnect-mcuboot -p $CHANGE_ID -S $GIT_COMMIT"
}
stages {
stage('Checkout repositories') {
steps {
dir("ci-tools") {
git branch: "master", url: "$REPO_CI_TOOLS"
}
}
}
stage('Run compliance check') {
steps {
dir('mcuboot') {
// Set the initial status to 'pending' for the various checks we plan to run
sh "$COMPLIANCE_SCRIPT_PATH $COMPLIANCE_ARGS --status"
script {
// If we're a pull request, compare the target branch against the current HEAD (the PR)
if (env.CHANGE_TARGET) {
COMMIT_RANGE = "origin/${env.CHANGE_TARGET}..HEAD"
}
// If not a PR, it's a non-PR-branch or master build. Compare against the origin.
else {
COMMIT_RANGE = "origin/${env.BRANCH_NAME}..HEAD"
}
// Run the compliance check
try {
sh "$COMPLIANCE_SCRIPT_PATH $COMPLIANCE_ARGS --commits $COMMIT_RANGE"
}
finally {
junit 'compliance.xml'
archiveArtifacts artifacts: 'compliance.xml'
}
}
}
}
}
}
post {
always {
// Clean up the working space at the end (including tracked files)
cleanWs()
}
}
}