summaryrefslogtreecommitdiff
path: root/Jenkinsfile
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-03-24 20:46:06 +0100
committerChristian Poessinger <christian@poessinger.com>2021-03-24 21:30:12 +0100
commite552cf8eb23f6d7fd95461771002b7fb0115d475 (patch)
tree4ce4f5af8ac60949466e4df2c3c051334e8fe83c /Jenkinsfile
parent30180961225ce0a594a96f1244046e3203ae4b8a (diff)
downloadvyos-build-e552cf8eb23f6d7fd95461771002b7fb0115d475.tar.gz
vyos-build-e552cf8eb23f6d7fd95461771002b7fb0115d475.zip
Jenkins: add parameters to image build
The ISO image build should be able to be parameterised from the outside, as setting who build the image, and which version number to use. If nothing is specified, use sane defaults as the current timestand and autobuild@vyos.net.
Diffstat (limited to 'Jenkinsfile')
-rw-r--r--Jenkinsfile24
1 files changed, 14 insertions, 10 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 660dea80..bd25caf4 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -21,13 +21,6 @@
// @Library annotation is not an import statement!
@Library('vyos-build@current')_
-
-// Only keep the 10 most recent builds
-def projectProperties = [
- [$class: 'BuildDiscarderProperty',strategy: [$class: 'LogRotator', numToKeepStr: '10']],
-]
-
-properties(projectProperties)
setDescription()
// Due to long build times on DockerHub we rather build the container by ourself
@@ -96,6 +89,11 @@ node('Docker') {
}
)
}
+ stage('Build timestamp') {
+ script {
+ env.TIMESTAMP = sh(returnStdout: true, script: 'date +%Y%m%d%H%M').toString().trim()
+ }
+ }
}
pipeline {
@@ -104,6 +102,11 @@ pipeline {
timeout(time: 120, unit: 'MINUTES')
parallelsAlwaysFailFast()
timestamps()
+ buildDiscarder(logRotator(numToKeepStr: '200'))
+ }
+ parameters {
+ string(name: 'BUILD_BY', defaultValue: 'autobuild@vyos.net', description: 'Builder identifier (e.g. jrandomhacker@example.net)')
+ string(name: 'BUILD_VERSION', defaultValue: '1.4-rolling-' + env.TIMESTAMP, description: 'Version number (release builds only)')
}
triggers {
cron('H 2 * * *')
@@ -138,11 +141,12 @@ pipeline {
currentBuild.description = sprintf('Git SHA1: %s', commitId[-11..-1])
sh """
+ env
./configure \
- --build-by autobuild@vyos.net \
+ --build-by ${params.BUILD_BY} \
--debian-mirror http://ftp.us.debian.org/debian/ \
--build-type release \
- --version 1.4-rolling-\$(date +%Y%m%d%H%M) \
+ --version ${params.BUILD_VERSION} \
--custom-package "vyos-1x-smoketest"
sudo make iso
"""
@@ -200,7 +204,7 @@ pipeline {
def ISO = sh(returnStdout: true, script: "ls vyos-*.iso").trim()
def SSH_DIR = '/home/sentrium/web/downloads.vyos.io/public_html/rolling/' + getGitBranchName() + '/' + ARCH
def SSH_OPTS = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
- def SSH_REMOTE = env.DOWNLOADS_VYOS_IO_HOST // defined as global variable
+ def SSH_REMOTE = env.DOWNLOADS_VYOS_IO_HOST // defined as global variable
// No need to explicitly check the return code. The pipeline
// will fail if sh returns a non 0 exit code