summaryrefslogtreecommitdiff
path: root/Jenkinsfile
blob: 78112ce636c032ecce936aedb69175b177cfcac9 (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
pipeline {
  agent none
  stages {
    stage('build-package') {
      parallel {
        stage('Build package amd64') {
          agent {
            docker {
              label 'jessie-amd64'
              args '--privileged --sysctl net.ipv6.conf.lo.disable_ipv6=0 -e GOSU_UID=1006 -e GOSU_GID=1006 -v /tmp:/tmp'
              image 'vyos/vyos-build:current'
            }

          }
          steps {
            sh '''#!/bin/bash
git clone --single-branch --branch $GIT_BRANCH $GIT_URL $BUILD_NUMBER
cd $BUILD_NUMBER
sudo pip3 uninstall vyos -y || true
sudo pip3 install -r test-requirements.txt
python3 -m "pylint" src -r n --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" > pylint-report.txt || true
make test
sudo apt-get -o Acquire::Check-Valid-Until=false update
sudo mk-build-deps -i -r -t \'apt-get --no-install-recommends -yq\' debian/control
dpkg-buildpackage -b -us -uc -tc
mkdir -p /tmp/$GIT_BRANCH/packages/script
mv ../*.deb /tmp/$GIT_BRANCH/packages/'''
          }
        }
        stage('Build package armhf') {
          agent {
            docker {
              label 'jessie-amd64'
              image 'vyos-build-armhf:current'
              args '--privileged --sysctl net.ipv6.conf.lo.disable_ipv6=0 -e GOSU_UID=1006 -e GOSU_GID=1006 -v /tmp:/tmp'
            }

          }
          steps {
            sh '''#!/bin/bash
git clone --single-branch --branch $GIT_BRANCH $GIT_URL $BUILD_NUMBER
cd $BUILD_NUMBER
sudo pip3 uninstall vyos -y || true
sudo pip3 install -r test-requirements.txt
python3 -m "pylint" src -r n --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" > pylint-report.txt || true
make test
sudo apt-get -o Acquire::Check-Valid-Until=false update
sudo mk-build-deps -i -r -t \'apt-get --no-install-recommends -yq\' debian/control
dpkg-buildpackage -b -us -uc -tc
mkdir -p /tmp/$GIT_BRANCH/packages/script
mv ../*.deb /tmp/$GIT_BRANCH/packages/'''
          }
        }
        stage('Build package arm64') {
          agent {
            docker {
              label 'jessie-amd64'
              args '--privileged --sysctl net.ipv6.conf.lo.disable_ipv6=0 -e GOSU_UID=1006 -e GOSU_GID=1006 -v /tmp:/tmp'
              image 'vyos-build-arm64:current'
            }

          }
          steps {
            sh '''#!/bin/bash
git clone --single-branch --branch $GIT_BRANCH $GIT_URL $BUILD_NUMBER
cd $BUILD_NUMBER
sudo pip3 uninstall vyos -y || true
sudo pip3 install -r test-requirements.txt
python3 -m "pylint" src -r n --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" > pylint-report.txt || true
make test
sudo apt-get -o Acquire::Check-Valid-Until=false update
sudo mk-build-deps -i -r -t \'apt-get --no-install-recommends -yq\' debian/control
dpkg-buildpackage -b -us -uc -tc
mkdir -p /tmp/$GIT_BRANCH/packages/script
mv ../*.deb /tmp/$GIT_BRANCH/packages/'''
          }
        }
      }
    }
    stage('Deploy packages') {
      agent {
        node {
          label 'jessie-amd64'
        }

      }
      steps {
        sh '''#!/bin/bash
cd /tmp/$GIT_BRANCH/packages/script
/var/lib/vyos-build/pkg-build.sh $GIT_BRANCH'''
      }
    }
    stage('Cleanup') {
      parallel {
        stage('Cleanup amd64') {
          agent {
            node {
              label 'jessie-amd64'
            }

          }
          steps {
            cleanWs(cleanWhenAborted: true, cleanWhenFailure: true, cleanWhenNotBuilt: true, cleanWhenSuccess: true, cleanWhenUnstable: true, cleanupMatrixParent: true, deleteDirs: true, disableDeferredWipeout: true)
          }
        }
        stage('Cleanup armhf') {
          agent {
            node {
              label 'jessie-amd64'
            }

          }
          steps {
            cleanWs(cleanWhenAborted: true, cleanWhenFailure: true, cleanWhenNotBuilt: true, cleanWhenSuccess: true, cleanWhenUnstable: true, cleanupMatrixParent: true, deleteDirs: true, disableDeferredWipeout: true)
          }
        }
        stage('Cleanup arm64') {
          agent {
            node {
              label 'jessie-amd64'
            }

          }
          steps {
            cleanWs(cleanWhenAborted: true, cleanWhenFailure: true, cleanWhenNotBuilt: true, cleanWhenSuccess: true, cleanWhenUnstable: true, cleanupMatrixParent: true, deleteDirs: true, disableDeferredWipeout: true)
          }
        }
      }
    }
  }
}