blob: 2299a0522fd0d3a7f7c7244da9eeb08247a1d70f [file] [log] [blame]
#!/usr/bin/env groovy
library 'functions'
def workspacePath = "/home/jenkins/workspace"
def buildLabel = "${targetName}-${UUID.randomUUID().toString()}"
def sourcePath = "${workspacePath}/src"
// FIXME(jtgans): Get rid of privileged! This is a security risk!
def jnlpContainer = containerTemplate(name: 'jnlp',
image: 'jenkins/jnlp-slave:alpine')
def debianContainer = containerTemplate(name: 'debian',
image: 'gcr.io/mendel-linux-cloud-infra/mendel-builder:latest',
command: 'cat',
args: '',
ttyEnabled: true,
privileged: true)
def aptlyVolume = persistentVolumeClaim(claimName: 'aptly-state', mountPath: '/var/lib/aptly')
podTemplate(label: buildLabel, containers: [jnlpContainer, debianContainer], volumes: [aptlyVolume], envVars: []) {
def mirrorList = sh("aptly mirror list -raw").split('\n')
def date = new Date()
String stamp = date.format("yyyyMMdd-HHmmss")
node(buildLabel) {
dir(sourcePath) {
container('debian') {
stage('Mirror') {
for (mirror in mirrorList) {
sh "aptly update ${mirror}"
}
}
stage('Snapshot') {
for (mirror in mirrorList) {
sh "aptly snapshot create ${mirror}-${stamp} from mirror ${mirror}"
}
}
}
}
}
}