summaryrefslogtreecommitdiff
path: root/Jenkinsfile
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-04-09 20:15:57 +0200
committerChristian Poessinger <christian@poessinger.com>2019-04-23 08:43:23 +0200
commit63493afa4c9cb05cdf7318b841edf52ad0779014 (patch)
tree380d4e5ce9d77a37dc3e6ed4a94a2ea79a5f8a36 /Jenkinsfile
parenta0b3251dba33a9a2e59aecd742746fc22f96fd8d (diff)
downloadvyos-build-63493afa4c9cb05cdf7318b841edf52ad0779014.tar.gz
vyos-build-63493afa4c9cb05cdf7318b841edf52ad0779014.zip
Replace build-submodules with Python based package builder
Support building individual VyOS packages by this modules. Call scripts/build-packages -l to list all available packages which will be build when invoking scripts/build-packages.
Diffstat (limited to 'Jenkinsfile')
-rw-r--r--Jenkinsfile130
1 files changed, 116 insertions, 14 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 4bc64b26..169a52f3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,22 +1,76 @@
#!/usr/bin/env groovy
+// Copyright (C) 2018 VyOS maintainers and contributors
+//
+// This program is free software; you can redistribute it and/or modify
+// in order to easy exprort images built to "external" world
+// it under the terms of the GNU General Public License version 2 or later as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
@NonCPS
+
+def getGitBranchName() {
+ return scm.branches[0].name
+}
+
+def getGitRepoURL() {
+ return scm.userRemoteConfigs[0].url
+}
+
+// Returns true if this is a custom build launched on any project fork,
+// returns false if this is build from git@github.com:vyos/vyos-build.git
+def isCustomBuild() {
+ def gitURI = "git@github.com:vyos/vyos-build.git"
+ def httpURI = "https://github.com/vyos/vyos-build.git"
+
+ return ! ((getGitRepoURL() == gitURI) || (getGitRepoURL() == httpURI))
+}
+
def setDescription() {
def item = Jenkins.instance.getItemByFullName(env.JOB_NAME)
- item.setDescription("VyOS image build using a\nPipeline build inside Docker container.")
+
+ // build up the main description text
+ def description = ""
+ description += "<h2>Build VyOS ISO image</h2>"
+ description += "All required Vyatta/VyOS packages are build from source prior to assembling the ISO."
+
+ if (isCustomBuild()) {
+ description += "<p style='border: 3px dashed red; width: 50%;'>"
+ description += "<b>Build not started from official Git repository!</b><br>"
+ description += "<br>"
+ description += "Repository: <font face = 'courier'>" + getGitRepoURL() + "</font><br>"
+ description += "Branch: <font face = 'courier'>" + getGitBranchName() + "</font><br>"
+ description += "</p>"
+ } else {
+ description += "Sources taken from Git branch: <font face = 'courier'>" + getGitBranchName() + "</font><br>"
+ }
+
+ item.setDescription(description)
item.save()
}
-setDescription()
-
/* Only keep the 10 most recent builds. */
def projectProperties = [
- [$class: 'BuildDiscarderProperty',strategy: [$class: 'LogRotator', numToKeepStr: '5']],
+ [$class: 'BuildDiscarderProperty',strategy: [$class: 'LogRotator', numToKeepStr: '1']],
]
properties(projectProperties)
+setDescription()
pipeline {
+ options {
+ disableConcurrentBuilds()
+ timeout(time: 4, unit: 'HOURS')
+ parallelsAlwaysFailFast()
+ }
agent {
dockerfile {
filename 'Dockerfile'
@@ -27,23 +81,71 @@ pipeline {
}
stages {
- stage('Submodule Init') {
+ stage('VyOS Packages') {
steps {
- sh '''
- git submodule update --init --recursive --remote
- '''
+ script {
+ def build = [:]
+ // get a list of available package from scripts/build-packages
+ packageList = sh(
+ script: "scripts/build-packages -l | grep '*' | sed -e 's/ \\* //'",
+ returnStdout: true
+ ).split("\r?\n")
+
+ packageList.each { pkg ->
+ skipList = ['vyos-kernel', 'vyos-wireguard', 'vyos-accel-ppp']
+ if (pkg in skipList) {
+ return
+ }
+
+ // add each object from 'packageList' to the 'build' array
+ build[pkg] = {
+ // we're already in the script{} block, so do our advanced stuff here
+ sh(
+ script: "scripts/build-packages -vvv -b ${pkg}",
+ returnStdout: true
+ )
+ }
+ }
+ // Still within the 'Script' block, run the parallel array object
+ parallel build
+ }
}
}
- stage('Build Packages') {
+
+ stage('Kernel') {
steps {
- sh '''
- #!/bin/sh
- scripts/build-submodules --verbose
- '''
+ sh "scripts/build-packages -vvv -b vyos-kernel"
+ }
+ }
+
+ stage('Kernel Modules') {
+ steps {
+ script {
+ def build = [:]
+ kernelModules = ['vyos-wireguard', 'vyos-accel-ppp']
+ kernelModules.each { pkg ->
+ // add each object from 'packageList' to the 'build' array
+ build[pkg] = {
+ // we're already in the script{} block, so do our advanced stuff here
+ sh(
+ script: "scripts/build-packages -vvv -b ${pkg}",
+ returnStdout: true
+ )
+ }
+ }
+ // Still within the 'Script' block, run the parallel array object
+ parallel build
+ }
+ }
+ }
+
+ stage('Intel Drivers') {
+ steps {
+ sh "KSRC=\$(pwd)/packages/vyos-kernel scripts/build-intel-drivers"
}
}
- stage('Build ISO') {
+ stage('ISO Image') {
steps {
sh '''
#!/bin/sh