summaryrefslogtreecommitdiff
path: root/Jenkinsfile
blob: 6151fb722743c87716379aadc8da223a7d8e61d1 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/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 --sysctl net.ipv6.conf.lo.disable_ipv6=0'
        }
    }

    stages {
        stage('Configure') {
            steps {
                sh './configure --build-by="autobuild@vyos.net" --debian-mirror="http://ftp.us.debian.org/debian/"'
            }
        }
        stage('Init Submodules') {
            environment {
                // there values are exportesd to all commands in this stage
                GIT_BRANCH_PACKAGE = "current"
                GIT_BRANCH_KERNEL  = "linux-vyos-4.19.y"
            }
            steps {
                parallel (
                    "mdns-repeater": {
                        sh '''
                            git submodule update --init packages/mdns-repeater
                            cd packages/mdns-repeater
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "pmacct": {
                        sh '''
                            git submodule update --init packages/pmacct
                            cd packages/pmacct
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "udp-broadcast-relay": {
                        sh '''
                            git submodule update --init packages/udp-broadcast-relay
                            cd packages/udp-broadcast-relay
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyatta-bash": {
                        sh '''
                            git submodule update --init packages/vyatta-bash
                            cd packages/vyatta-bash
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyatta-cfg": {
                        sh '''
                            git submodule update --init packages/vyatta-cfg
                            cd packages/vyatta-cfg
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyatta-cfg-firewall": {
                        sh '''
                            git submodule update --init packages/vyatta-cfg-firewall
                            cd packages/vyatta-cfg-firewall
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyatta-cfg-op-pppoe": {
                        sh '''
                            git submodule update --init packages/vyatta-cfg-op-pppoe
                            cd packages/vyatta-cfg-op-pppoe
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyatta-cfg-qos": {
                        sh '''
                            git submodule update --init packages/vyatta-cfg-qos
                            cd packages/vyatta-cfg-qos
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyatta-cfg-quagga": {
                        sh '''
                            git submodule update --init packages/vyatta-cfg-quagga
                            cd packages/vyatta-cfg-quagga
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyatta-cfg-system": {
                        sh '''
                            git submodule update --init packages/vyatta-cfg-system
                            cd packages/vyatta-cfg-system
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyatta-cfg-vpn": {
                        sh '''
                            git submodule update --init packages/vyatta-cfg-vpn
                            cd packages/vyatta-cfg-vpn
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyos-kernel": {
                        sh '''
                            git submodule update --init packages/vyos-kernel
                            cd packages/vyos-kernel
                            git checkout $GIT_BRANCH_KERNEL
                        '''
                    },
                    "vyos-wireguard": {
                        sh '''
                            git submodule update --init packages/vyos-wireguard
                            cd packages/vyos-wireguard
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    },
                    "vyos-accel-ppp": {
                        sh '''
                            git submodule update --init packages/vyos-accel-ppp
                            cd packages/vyos-accel-ppp
                            git checkout $GIT_BRANCH_PACKAGE
                        '''
                    }
                )
            }
        }
        stage('Build Packages') {
            steps {
                sh 'git submodule update --remote'
                sh 'scripts/build-submodules'
            }
        }
        stage('Build ISO') {
            steps {
                sh 'ls -al'
                sh 'ls -al packages'
                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 .'
            echo 'No cleanup for now ....'
            deleteDir() /* cleanup our workspace */
        }
    }
}