summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-26 09:00:18 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-26 10:07:36 +0200
commita534d2ca71eba4ce9b545a2a7d327a5e8671bff9 (patch)
tree45d279b9fcd2963fb987b88ec65eef88acce79c8
parent13295638a6ad994a21dd3e530f919507495a6fec (diff)
downloadvyos-build-a534d2ca71eba4ce9b545a2a7d327a5e8671bff9.tar.gz
vyos-build-a534d2ca71eba4ce9b545a2a7d327a5e8671bff9.zip
Jenkins: BUILD_VERSION is now calculated during runtime
In the past a cached version of BUILD_VERSION was used which would manifest in a wrong timestamp from build start time vs ISO time. (cherry picked from commit 1941149de81d0e9c0c7ae334452786ba6fff8f09)
-rw-r--r--Jenkinsfile42
1 files changed, 23 insertions, 19 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index ec437c31..bcbe8d78 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -22,9 +22,8 @@
setDescription()
node('Docker') {
- stage('Build timestamp') {
+ stage('Setup Container') {
script {
- env.TIMESTAMP = sh(returnStdout: true, script: 'date -u +%Y%m%d%H%M').toString().trim()
// create container name on demand
def branchName = getGitBranchName()
// Adjust PR target branch name so we can re-map it to the proper Docker image.
@@ -39,27 +38,12 @@ node('Docker') {
env.USR_ID = sh(returnStdout: true, script: 'id -u').toString().trim()
env.GRP_ID = sh(returnStdout: true, script: 'id -g').toString().trim()
env.DOCKER_ARGS = '--privileged --sysctl net.ipv6.conf.lo.disable_ipv6=0 -e GOSU_UID=' + env.USR_ID + ' -e GOSU_GID=' + env.GRP_ID
+ env.BASE_VERSION = '1.3-beta-'
}
}
}
pipeline {
- options {
- disableConcurrentBuilds()
- timeout(time: 150, unit: 'MINUTES')
- timestamps()
- buildDiscarder(logRotator(numToKeepStr: '20'))
- }
- parameters {
- string(name: 'BUILD_BY', defaultValue: 'autobuild@vyos.net', description: 'Builder identifier (e.g. jrandomhacker@example.net)')
- string(name: 'BUILD_VERSION', defaultValue: '1.3-beta-' + env.TIMESTAMP, description: 'Version number (release builds only)')
- booleanParam(name: 'BUILD_PUBLISH', defaultValue: true, description: 'Publish this build to downloads.vyos.io and AWS S3')
- booleanParam(name: 'BUILD_SMOKETESTS', defaultValue: true, description: 'Include Smoketests in ISO image')
- booleanParam(name: 'BUILD_SNAPSHOT', defaultValue: false, description: 'Upload image to AWS S3 snapshot bucket')
- }
- triggers {
- cron('H 4 * * *')
- }
agent {
docker {
label "Docker"
@@ -69,6 +53,22 @@ pipeline {
reuseNode true
}
}
+ triggers {
+ cron('H 4 * * *')
+ }
+ parameters {
+ string(name: 'BUILD_BY', defaultValue: 'autobuild@vyos.net', description: 'Builder identifier (e.g. jrandomhacker@example.net)')
+ string(name: 'BUILD_VERSION', defaultValue: env.BASE_VERSION + 'ISO8601-TIMESTAMP', description: 'Version number (release builds only)')
+ booleanParam(name: 'BUILD_PUBLISH', defaultValue: true, description: 'Publish this build to downloads.vyos.io and AWS S3')
+ booleanParam(name: 'BUILD_SMOKETESTS', defaultValue: true, description: 'Include Smoketests in ISO image')
+ booleanParam(name: 'BUILD_SNAPSHOT', defaultValue: false, description: 'Upload image to AWS S3 snapshot bucket')
+ }
+ options {
+ disableConcurrentBuilds()
+ timeout(time: 150, unit: 'MINUTES')
+ timestamps()
+ buildDiscarder(logRotator(numToKeepStr: '20'))
+ }
stages {
stage('Build ISO') {
when {
@@ -91,12 +91,16 @@ pipeline {
if (params.BUILD_SMOKETESTS)
CUSTOM_PACKAGES = '--custom-package vyos-1x-smoketest'
+ def VYOS_VERSION = params.BUILD_BY
+ if (params.BUILD_VERSION == env.BASE_VERSION + 'ISO8601-TIMESTAMP')
+ VYOS_VERSION = env.BASE_VERSION + sh(returnStdout: true, script: 'date -u +%Y%m%d%H%M').toString().trim()
+
sh """
./configure \
--build-by "${params.BUILD_BY}" \
--debian-mirror http://deb.debian.org/debian/ \
--build-type release \
- --version "${params.BUILD_VERSION}" ${CUSTOM_PACKAGES}
+ --version "${VYOS_VERSION}" ${CUSTOM_PACKAGES}
sudo make iso
"""