99
1010def 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'
1111
12- def getCommitSha () {
13- sh " git rev-parse HEAD > .git/current-commit"
14- return readFile(" .git/current-commit" ). trim()
15- }
16-
1712void setBuildStatus (String state , String message ) {
18- commit = getCommitSha()
19-
2013 // FIXME: https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#string-interpolation
2114 sh """
2215 curl \
2316 -X POST \
2417 -H \' Accept: application/vnd.github+json\' \
2518 -H \' Authorization: Bearer ${ GITHUB_TOKEN} \' \
2619 -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 } \
2821 -d \' {\" state\" : \" ${ state} \" , \" target_url\" : \" ${ BUILD_URL} \" , \" description\" : \" ${ message} \" }\'
2922 """
3023}
@@ -48,7 +41,7 @@ pipeline {
4841
4942 parameters {
5043 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 )
5245 }
5346
5447 triggers {
@@ -61,23 +54,21 @@ pipeline {
6154 setBuildStatus(" pending" , " Pending" )
6255 slackSend(color : " good" , message : " ${ env.JOB_NAME} - #${ env.BUILD_ID} started (<${ env.BUILD_URL} |Open>)" )
6356
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} ' ]],
6760 extensions : [
68- [
69- $class : ' SubmoduleOption' ,
70- disableSubmodules : false ,
61+ lfs(),
62+ pruneStaleBranch(),
63+ pruneTags(true ),
64+ submodule(
7165 parentCredentials : true ,
7266 recursiveSubmodules : true ,
73- reference : ' ' ,
74- trackingSubmodules : false
75- ],
76- [ $class : ' GitLFSPull' ],
77- [ $class : ' PruneStaleBranch' ],
67+ reference : ' '
68+ ),
7869 ],
79- userRemoteConfigs : [[url : ' https://github.com/system76/firmware-open' ]]
80- ] )
70+ userRemoteConfigs : [[url : ' https://github.com/system76/firmware-open.git ' ]]
71+ )
8172
8273 sh """ #!/bin/bash
8374 # Install dependencies
0 commit comments