Jenkinsfile 2.1 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
   separate_boot_image = []
8
   currentBuild.description = "${build_type} ${params.board} ${params.dist} image"
9

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

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

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

27
28
29
30
   if (separate_boot_image.contains(params.board)) {
     artifacts += ",${params.board}-boot.img.xz"
   }

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