Jenkinsfile 2.61 KB
Newer Older
1
env.DIST = 'bionic'
Harald Sitter's avatar
Harald Sitter committed
2 3
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.'
}

19 20 21 22 23 24 25 26
// WARNING: DO NOT set properites()!
// properties() calls override whatever we set in the XML via our tooling
// templates. That is to say: calling properties() overrides the actual
// properties from the XML and can have all sorts of side effects.
// This is contrary to the reference documentation which says properties
// are preserved for non-multibranch pipelines!
// If you need properties set do it in pangea-tooling or talk to sitter/bshah
// about it
27

28
lock(inversePrecedence: true, label: 'OPENQA_INSTALL', quantity: 1, variable: 'DEBUG_LOCK') {
29 30 31
  fancyNode('openqa') {
    try {
      stage('clone') {
32
        sh 'env'
33 34 35 36 37
        git 'git://anongit.kde.org/sysadmin/neon-openqa.git'
      }
      stage('rake-test') {
        sh 'rake test'
      }
38

39 40
      stage('test_installation') {
        wrap([$class: 'LiveScreenshotBuildWrapper', fullscreenFilename: 'wok/qemuscreenshot/last.png']) {
41 42
          sh 'INSTALLATION=1 bin/contain.rb /workspace/bin/bootstrap.rb'
        }
43
      }
44

45 46 47 48
      if (env.ARCHIVE) {
        stage('archive-raid') {
          sh 'bin/archive.rb'
        }
49
      }
50
    } finally {
51
      dir('metadata') { archiveArtifacts allowEmptyArchive: true, artifacts: '*' }
52 53 54
      dir('wok') { archiveArtifacts allowEmptyArchive: true, artifacts: 'testresults/*, ulogs/*, video.*, vars.json, slide.html' }
      junit 'junit/*'
      sh 'bin/contain.rb chown -R jenkins .'
55 56 57
      // Make sure we fail if metadata was empty, we didn't assert this earlier
      // because we want the rest of the post-build to run.
      sh 'ls metadata/*'
58
    }
Harald Sitter's avatar
Harald Sitter committed
59 60 61
  }
}

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

72 73 74 75 76 77 78 79 80 81 82 83 84
def finally_chown(body) {
  try {
    body()
  } finally {
    sh 'bin/contain.rb chown -R jenkins .'
  }
}

def finally_cleanup(body) {
  try {
    body()
  } finally {
    if (!env.NO_CLEAN) {
85
      cleanWs()
86 87 88 89
    }
  }
}

90 91 92 93 94
// 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
  }
Jonathan Riddell's avatar
Jonathan Riddell committed
95
  String[] types = ["user", "user_lts", "unstable", "testing"]
96 97 98 99 100 101 102
  for (type in types) {
    if (env.JOB_NAME.contains(type)) {
      return type
    }
  }
  return null
}