diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-03-24 20:46:06 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-03-24 21:32:16 +0100 |
commit | fe80f574b807d38ac6e5e20b93238b00d4c06049 (patch) | |
tree | 802a3564cd8a60842f142e65f1416d233bfabd7a /Jenkinsfile | |
parent | 33391442c1cc70bb3eac70cfdecd041295149d42 (diff) | |
download | vyos-build-fe80f574b807d38ac6e5e20b93238b00d4c06049.tar.gz vyos-build-fe80f574b807d38ac6e5e20b93238b00d4c06049.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.
(cherry picked from commit e552cf8eb23f6d7fd95461771002b7fb0115d475)
Diffstat (limited to 'Jenkinsfile')
-rw-r--r-- | Jenkinsfile | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index 5dcec7de..2fa754a1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,12 +21,6 @@ // @Library annotation is not an import statement! @Library('vyos-build@equuleus')_ -// 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 @@ -95,6 +89,11 @@ node('Docker') { } ) } + stage('Build timestamp') { + script { + env.TIMESTAMP = sh(returnStdout: true, script: 'date +%Y%m%d%H%M').toString().trim() + } + } } pipeline { @@ -103,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.3-rolling-' + env.TIMESTAMP, description: 'Version number (release builds only)') } triggers { cron('H 4 * * *') @@ -137,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.3-beta-\$(date +%Y%m%d%H%M) \ + --version ${params.BUILD_VERSION} \ --custom-package "vyos-1x-smoketest" sudo make iso """ @@ -199,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 |