#!/usr/bin/env groovy

def workspacePath = "/home/jenkins/workspace"
def buildLabel = "task.publish.unstable-${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')

String getLatestSnapshot(repository_stem) {
    def script = """
        aptly snapshot list --sort=time --raw \
            | grep -E '^${repository_stem}-' \
            | head -n1
    """

    return sh(returnStdout: true, script: script)
}

podTemplate(label: buildLabel, containers: [jnlpContainer, debianContainer], volumes: [aptlyVolume], envVars: []) {
    node(buildLabel) {
        dir(sourcePath) {
            container('debian') {
                withEnv(['GNUPGHOME=/var/lib/aptly/.gnupg']) {
                    def debianMirrorSnapshotName = getLatestSnapshot('debian-buster')
                    def coreSnapshotName = getLatestSnapshot('core-unstable')
                    def bspSnapshotName  = getLatestSnapshot('enterprise-bsp-unstable')

                    def date = new Date()
                    String stamp = date.format("yyyyMMdd-HHmmss")

                    sh """
                       aptly task run snapshot merge core-full-unstable-${stamp} ${debianMirrorSnapshotName} ${coreSnapshotName}, \\
                                      publish snapshot --distribution=unstable core-full-unstable-${stamp} filesystem:unstable, \\
                                      publish snapshot --distribution=unstable ${bspSnapshotName} filesystem:unstable
                       """
                }
            }
        }
    }
}
