mirror of
				https://github.com/vyos/vyos-build.git
				synced 2025-10-01 20:28:40 +02:00 
			
		
		
		
	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)
This commit is contained in:
		
							parent
							
								
									33391442c1
								
							
						
					
					
						commit
						fe80f574b8
					
				
							
								
								
									
										23
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user