summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-06-21 11:45:27 +0200
committerChristian Poessinger <christian@poessinger.com>2020-06-21 11:55:53 +0200
commit97627aa19df5e87f5888e6bf29a43b19f598f05b (patch)
tree0168ceaeb5bbaa48bbdd717c0445f28dd2a50593
parent8e27b8cd147a5dfc77cc0842651b0c59efae6229 (diff)
downloadvyos-build-97627aa19df5e87f5888e6bf29a43b19f598f05b.tar.gz
vyos-build-97627aa19df5e87f5888e6bf29a43b19f598f05b.zip
Jenkins: lib: Debian packges must be build in 'build' subdirectory
Package build must be done in "any" subdir. Without it the Debian build system is unable to generate the *.deb files in the sources parent directory, which will cause a "Permission denied" error.
-rw-r--r--vars/buildPackage.groovy61
1 files changed, 35 insertions, 26 deletions
diff --git a/vars/buildPackage.groovy b/vars/buildPackage.groovy
index 262db472..366b1b72 100644
--- a/vars/buildPackage.groovy
+++ b/vars/buildPackage.groovy
@@ -80,28 +80,33 @@ def call(description=null, pkgList=null, buildCmd=null) {
}
steps {
script {
- checkout scm
+ // package build must be done in "any" subdir. Without it the Debian build system
+ // is unable to generate the *.deb files in the sources parent directory, which
+ // will cause a "Permission denied" error.
+ dir ('build') {
+ // checkout git repository which hold 'Jenkinsfile'
+ checkout scm
- // Display Git commit Id used on Jenkinsfile on the
- // Jenkins Job "Build History" pane
- def commitId = sh(returnStdout: true, script: 'git rev-parse --short=11 HEAD').trim()
- currentBuild.description = sprintf('Git SHA1: %s', commitId[-11..-1])
+ // Display Git commit Id used on Jenkinsfile on the
+ // Jenkins Job "Build History" pane
+ def commitId = sh(returnStdout: true, script: 'git rev-parse --short=11 HEAD').trim()
+ currentBuild.description = sprintf('Git SHA1: %s', commitId[-11..-1])
- if (pkgList) {
- // Fetch individual package source code, but only if a URL is defined, this will
- // let us reuse this script for packages like vyos-1x which ship a Jenkinfile in
- // their repositories root folder.
- pkgList.each { pkg ->
- dir(env.BASE_DIR + pkg.name) {
- checkout([$class: 'GitSCM',
- doGenerateSubmoduleConfigurations: false,
- extensions: [[$class: 'CleanCheckout']],
- branches: [[name: pkg.scmCommit]],
- userRemoteConfigs: [[url: pkg.scmUrl]]])
+ if (pkgList) {
+ // Fetch individual package source code, but only if a URL is defined, this will
+ // let us reuse this script for packages like vyos-1x which ship a Jenkinfile in
+ // their repositories root folder.
+ pkgList.each { pkg ->
+ dir(env.BASE_DIR + pkg.name) {
+ checkout([$class: 'GitSCM',
+ doGenerateSubmoduleConfigurations: false,
+ extensions: [[$class: 'CleanCheckout']],
+ branches: [[name: pkg.scmCommit]],
+ userRemoteConfigs: [[url: pkg.scmUrl]]])
+ }
}
}
}
- sh "pwd; ls -al"
}
}
}
@@ -117,17 +122,21 @@ def call(description=null, pkgList=null, buildCmd=null) {
}
steps {
script {
- if (pkgList) {
- pkgList.each { pkg ->
- dir(env.BASE_DIR + pkg.name) {
- sh "pwd; ls -al"
- sh pkg.buildCmd
+ // package build must be done in "any" subdir. Without it the Debian build system
+ // is unable to generate the *.deb files in the sources parent directory, which
+ // will cause a "Permission denied" error.
+ dir ('build') {
+ if (pkgList) {
+ pkgList.each { pkg ->
+ dir(env.BASE_DIR + pkg.name) {
+ sh pkg.buildCmd
+ }
}
+ } else if (buildCmd) {
+ sh buildCmd
+ } else {
+ sh "dpkg-buildpackage -uc -us -tc -b"
}
- } else if (buildCmd) {
- sh buildCmd
- } else {
- sh "dpkg-buildpackage -uc -us -tc -b"
}
}
}