summaryrefslogtreecommitdiff
path: root/Jenkinsfile
blob: d46fdcbf1e212110720d3302f27ae1c6ddea54e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env groovy

@NonCPS
def setDescription() {
    def item = Jenkins.instance.getItemByFullName(env.JOB_NAME)
    item.setDescription("VyOS image build using a\nPipeline build inside Docker container.")
    item.save()
}

setDescription()

/* Only keep the 10 most recent builds. */
def projectProperties = [
    [$class: 'BuildDiscarderProperty',strategy: [$class: 'LogRotator', numToKeepStr: '5']],
]

properties(projectProperties)

pipeline {
    agent {
        dockerfile {
            filename 'Dockerfile'
            label 'jessie-amd64'
            args '--privileged'
        }
    }

    stages {
        stage('Configure') {
            steps {
                sh './configure --build-by="autobuild@vyos.net" --debian-mirror="http://ftp.us.debian.org/debian/"'
            }
        }
        stage('Build ISO') {
            steps {
                sh 'sudo make iso'
            }
        }
    }

    post {
        always {
            echo 'One way or another, I have finished'
            // change build dir file permissions so wen can cleanup as regular
            // user (jenkins) afterwards
            sh 'sudo chmod -R 777 .'
            deleteDir() /* cleanup our workspace */
        }
    }
}