Jenkinsfile 1.96 KB
Newer Older
1
node {
2
   gitUrl = 'https://source.puri.sm/Librem5/image-builder.git'
3
   branch = 'master'
4
   artifacts = "checksums,${params.board}.img.xz,tmp/*-report.log,files/meta.yml"
5
   build_on_x86 = [ 'imx6', 'qemu-x86_64' ]
6
   qcow2_builds = [ 'qemu-x86_64' ]
7
   currentBuild.description = "${params.board} ${params.dist} ${build_type} image"
8

9 10
   parameters {
        string(name: 'board', defaultValue: "imx6", description: 'What board type to build for?')
11
        string(name: 'dist', defaultValue: "buster+ci", description: 'What distribuition to build for?')
12 13
        string(name: 'build_type', defaultValue: "unstable", description: 'What type of build is this?')
        string(name: 'publish', defaultValue: "false", description: 'Should the image get published?')
14
   }
15 16 17 18 19

   if (build_on_x86.contains(params.board)) {
     nodename = 'x86'
   } else { // Fall back to master if we don't know better
     nodename = 'master'
20
   }
21

22 23 24 25
   if (qcow2_builds.contains(params.board)) {
     artifacts += ",${params.board}.qcow2"
   }

26 27 28 29 30
   node (nodename) {
     stage('Setup') {
        git url: gitUrl, branch: branch
     }
     stage('Clean') {
31
          sh "make DIST='${params.dist}' BOARD='${params.board}' TYPE='${params.build_type}' clean"
32 33
     }
     stage('check') {
34
          sh "make DIST='${params.dist}' BOARD='${params.board}' TYPE='${params.build_type}' check"
35 36
     }
     stage('Build') {
37
          sh "make DIST='${params.dist}' BOARD='${params.board}' TYPE='${params.build_type}'"
38 39 40
     }
     stage('Publish') {
          if( "${params.publish}"=="true" ) {
41
            sh "make DIST='${params.dist}' BOARD='${params.board}' TYPE='${params.build_type}' sha256sums"
42
            sh "bin/publish_ci_files -t image -T ${params.build_type} ${params.board}.img.xz sha256sums"
43 44 45
          } else {
            echo 'This image will not be published'
          }
46 47 48 49
     }
     stage('Results') {
        archive artifacts
     }
50 51 52
     stage( 'Clean up' ) {
        deleteDir() /* clean up our workspace */
     }
53
  }
54
}