Jenkinsfile 1.72 KB
Newer Older
1
node {
2
   gitUrl = 'https://source.puri.sm/Librem5/image-builder.git'
3
   branch = 'master'
Guido Gunther's avatar
Guido Gunther committed
4
   artifacts = "checksums,${params.board}.img.xz"
5
   build_on_x86 = [ 'imx6', 'qemu-x86_64' ]
6
   qcow2_builds = [ 'qemu-x86_64' ]
7
   currentBuild.description = "${params.board} image"
8

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

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

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

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