Jenkinsfile 1.93 KB
Newer Older
Harald Sitter's avatar
importy  
Harald Sitter committed
1 2 3
env.DIST = 'xenial'
env.PWD_BIND = '/workspace'

4 5 6 7 8 9 10 11 12 13 14 15
if (env.TYPE == null) {
  if (params.TYPE != null) {
    env.TYPE = params.TYPE
  } else {
    type = inferType()
    if (type != null) {
      env.TYPE = type
    }
  }
}

if (env.TYPE == null) {
16 17 18
  error 'TYPE param not set. Cannot run install test without a type.'
}

Harald Sitter's avatar
Harald Sitter committed
19 20 21 22 23 24
properties([
  pipelineTriggers([upstream(threshold: 'UNSTABLE',
                             upstreamProjects: "iso_neon_xenial_${TYPE}_amd64")]),
  pipelineTriggers([cron('0 H(9-22) * * *')])
])

25
fancyNode('openqa') {
26 27 28 29 30 31 32 33 34 35 36
  try {
    stage('clone') {
      git 'https://github.com/apachelogger/kde-os-autoinst'
    }
    stage('rake-test') {
      sh 'rake test'
    }
    stage('iso-handover') {
        if (params.ISO) {
          echo 'Picking up ISO from trigger job.'
          sh "cp -v ${params.ISO} incoming.iso"
37
      }
38 39 40 41
    }
    stage('test_installation') {
      wrap([$class: 'LiveScreenshotBuildWrapper', fullscreenFilename: 'wok/qemuscreenshot/last.png']) {
        sh 'INSTALLATION=1 bin/contain.rb /workspace/bin/bootstrap.rb'
42
      }
43
    }
44 45 46 47
    if (env.ARCHIVE) {
      stage('archive-raid') {
        sh 'bin/archive.rb'
      }
48 49
    }
  } finally {
50
    dir('metadata') { archiveArtifacts '*' }
Harald Sitter's avatar
Harald Sitter committed
51
    dir('wok') { archiveArtifacts allowEmptyArchive: true, artifacts: 'testresults/*, ulogs/*, video.*, vars.json' }
52 53
    junit 'junit/*'
    sh 'bin/contain.rb chown -R jenkins .'
Harald Sitter's avatar
importy  
Harald Sitter committed
54 55 56
  }
}

57
def fancyNode(label = null, body) {
Harald Sitter's avatar
importy  
Harald Sitter committed
58
  node(label) {
59 60 61
    wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {
      wrap([$class: 'TimestamperBuildWrapper']) {
        body()
Harald Sitter's avatar
importy  
Harald Sitter committed
62 63 64 65
      }
    }
  }
}
66 67 68 69 70 71

// When not called from an ISO build we'll want to infer the type from our own name.
def inferType() {
  if (!env.JOB_NAME) {
    return null
  }
Harald Sitter's avatar
Harald Sitter committed
72
  String[] types = ["useredition", "userltsedition", "devedition-gitunstable", "devedition-gitstable"]
73 74 75 76 77 78 79
  for (type in types) {
    if (env.JOB_NAME.contains(type)) {
      return type
    }
  }
  return null
}