9
9
10
10
def all_models = ' addw2 addw3 bonw14 bonw15 darp5 darp6 darp7 darp8 darp9 galp3-c galp4 galp5 galp6 galp7 gaze15 gaze16-3050 gaze16-3060 gaze16-3060-b gaze16-3050 gaze16-3060-b gaze17-3050 gaze17-3060-b gaze18 lemp9 lemp10 lemp11 lemp12 oryp5 oryp6 oryp7 oryp8 oryp9 oryp10 oryp11 serw13'
11
11
12
- def getCommitSha () {
13
- sh " git rev-parse HEAD > .git/current-commit"
14
- return readFile(" .git/current-commit" ). trim()
15
- }
16
-
17
12
void setBuildStatus (String state , String message ) {
18
- commit = getCommitSha()
19
-
20
13
// FIXME: https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#string-interpolation
21
14
sh """
22
15
curl \
23
16
-X POST \
24
17
-H \' Accept: application/vnd.github+json\' \
25
18
-H \' Authorization: Bearer ${ GITHUB_TOKEN} \' \
26
19
-H \' X-GitHub-Api-Version: 2022-11-28\' \
27
- https://api.github.com/repos/system76/firmware-open/statuses/${ commit } \
20
+ https://api.github.com/repos/system76/firmware-open/statuses/${ GIT_COMMIT } \
28
21
-d \' {\" state\" : \" ${ state} \" , \" target_url\" : \" ${ BUILD_URL} \" , \" description\" : \" ${ message} \" }\'
29
22
"""
30
23
}
@@ -48,7 +41,7 @@ pipeline {
48
41
49
42
parameters {
50
43
string(name : ' MODELS' , defaultValue : " $all_models " , description : ' Space separated list of models to build' , trim : true )
51
- string(name : ' GIT_BRANCH ' , defaultValue : ' master' , description : ' Git branch or revision to build' , trim : true )
44
+ string(name : ' SOURCE_BRANCH ' , defaultValue : ' master' , description : ' Git branch or revision to build' , trim : true )
52
45
}
53
46
54
47
triggers {
@@ -61,23 +54,21 @@ pipeline {
61
54
setBuildStatus(" pending" , " Pending" )
62
55
slackSend(color : " good" , message : " ${ env.JOB_NAME} - #${ env.BUILD_ID} started (<${ env.BUILD_URL} |Open>)" )
63
56
64
- checkout([
65
- $ class : ' GitSCM ' ,
66
- branches : [[name : " ${ GIT_BRANCH } " ]],
57
+ // https://www.jenkins.io/doc/pipeline/steps/params/scmgit/
58
+ checkout scmGit(
59
+ branches : [[name : ' ${SOURCE_BRANCH} ' ]],
67
60
extensions : [
68
- [
69
- $class : ' SubmoduleOption' ,
70
- disableSubmodules : false ,
61
+ lfs(),
62
+ pruneStaleBranch(),
63
+ pruneTags(true ),
64
+ submodule(
71
65
parentCredentials : true ,
72
66
recursiveSubmodules : true ,
73
- reference : ' ' ,
74
- trackingSubmodules : false
75
- ],
76
- [ $class : ' GitLFSPull' ],
77
- [ $class : ' PruneStaleBranch' ],
67
+ reference : ' '
68
+ ),
78
69
],
79
- userRemoteConfigs : [[url : ' https://github.com/system76/firmware-open' ]]
80
- ] )
70
+ userRemoteConfigs : [[url : ' https://github.com/system76/firmware-open.git ' ]]
71
+ )
81
72
82
73
sh """ #!/bin/bash
83
74
# Install dependencies
0 commit comments