Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{jenkins-plugin-info:debian-pbuilder}
Excerpt

This plugin lets you build Debian packages in a pbuilder environment, keeping a clean filesystem for builds.


 Build Debian packages in Jenkins!

...

If using pipeline, you may setup a job similar to the following:

Code Block
languagegroovy
titlePipeline Setup - single arch
node(){
        ws{
            stage( "clean" ){
                cleanWs()
            }
            stage( "checkout" ){
                checkout([$class: 'GitSCM', branches: 
                         [[name: '*/jenkinsfile-updates']], 
                         doGenerateSubmoduleConfigurations: false, 
                         extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'source']], 
                         submoduleCfg: [], 
                         userRemoteConfigs: [[credentialsId: '78de5c66-5dfb-4c95-8ad9-ec34e8dee4ec', url: 'git@github.com:rm5248/CSerial.git']]])
            }

            stage("build"){
                //AddActually whateverbuild parameters you need the package.
                //Note that you can go to the class'Pipeline Syntax' page on your Jenkins instance to generate this automatically
                debianPbuilder additionalBuildResults: '', architecture: '', distribution: 'jessie', keyring: '', mirrorSite: 'http://ftp.us.debian.org'
            }
        }

}

The following example shows how to build for multiple architectures:

Code Block
languagegroovy
titlePipeline Setup - Multiple arch
def axisArchitecture = ["amd64", "armhf"]
def axisNode = ["master"]
def tasks = [:]

for( int i = 0; i < axisArchitecture.size(); i++ ){
    def arch = axisArchitecture[i];
    tasks["${axisNode[0]}/${axisArchitecture[i]}"] = {
        node(axisNode[0]){
            ws{
                stage( "clean" ){
                    cleanWs()
                }
	            stage( "checkout" ){
                    checkout([$class: 'GitSCM', branches: 
                             [[name: '*/jenkinsfile-updates']], 
                             doGenerateSubmoduleConfigurations: false, 
                             extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'source']], 
                             submoduleCfg: [], 
                             userRemoteConfigs: [[credentialsId: '78de5c66-5dfb-4c95-8ad9-ec34e8dee4ec', url: 'git@github.com:rm5248/CSerial.git']]])
   	            } 
                stage("build-${arch}"){
                    debianPbuilder architecture:"${arch}"
                }
            }
        }
    }
}

stage('build'){
    parallel tasks
}


Package Versioning

By default the plugin will increment the current version number by reading 'debian/changelog'.  The algorithm follows the standard Debian practice of packages having a ~ being a pre-release version, and packages with a + denoting a version greater than what is default.  Note that this only happens if the the distribution set in 'debian/changelog' is UNRELEASED, or a tag is being built.  Tags are automatically scanned; if using SVN or git, the environment variables SVN_URL_1 and GIT_BRANCH are scanned for the substring "tags/"; if the substring is found, the package will be built as a tag.  Otherwise, you can also select the "Build as tag" to force the package to not increment the version number, or alternatively set the environment variable DEB_PBUILDER_BUILDING_TAG if you are building a tag.

...

All output can be found in the build output of the project when it is built.  If for some reason the build fails, this is a good first place to look.  If there is a configuration problem, a (hopefully) useful error message will be printed out when the build fails.  

Building packages with 'quilt' format

When building a package with format "3.0 (quilt)", you must provide the orig.tar.gz file for the builder to work properly.  This can be done one of two ways: either you can provide the orig.tar.gz through a pre-build step of some kind, or under the 'advanced' section there is a field for you to fill in the name of the package to checkout using the 'pristine-tar' command.

Issue Tracking

Please file any bugs that you may find on the Jenkins JIRA, using the debian-pbuilder-plugin component.  Click here for all open issues.

Releases

Version 1.6(2019-04-21)
  • Removed file lock when building packages; pbuilder should take care of this automatically and it probably doesn't work with multiple slaves anyway
  • Catch correct exception if trying to create multiple chroots at the same time
  • Added an option to change the pbuilder dependency resolver.  Changing the dependency resolver fixes problems with apt segfaulting on an armhf chroot.
  • Made the global configuration actually save and load correctly.
  • Print out a more useful error message when the debian/source/format file doesn't exist or is bad.
Version 1.5(2019-01-27)
  • Added ability to use pristine-tar to get orig.tar.gz file(JENKINS-52645)
  • Added ability to set components when creating pbuilder base.  This is mostly useful for building Ubuntu packages.
Version 1.4(2018-05-12)
  • Added a setting for the keyring.  

    • Auto-detection for building Debian packages on Ubuntu should still work, but this is useful for overriding it

    • Thanks to jayjlawrence with PR #1 for prompting this change

Version 1.3(2018-01-13)
  • Plugin does not depend on pipeline
  • Fixed JENKINS-48921

...