New to jenkins-debian-glue? Please check out Getting Started before digging deeper into the docs.

The easiest way to add further Jenkins jobs for additional Debian packages is using the existing ones as input. Just use the exisiting jenkins-debian-glue-source job as input for your new *-source job and the jenkins-debian-glue-binaries one as input for your new *-binaries job:

Screenshot of New Jenkins job dialog

Do not forget to adjust the repository URL accordingly for your own package:

Screenshot of adjustting SCM settings

Do not forget to adjust all references to jenkins-debian-glue-* in your new Jenkins jobs with your new jenkins jobs!

Once you're happy with the way your Jenkins jobs work you usually don't want to click on 'Build now' manually whenever you want to trigger the build process. Instead let's build Debian packages whenever changes are pushed into your repository.

To avoid polling for updates in VCS trigger the build remotely from your version control system:

You might want to build your Debian package based on a specific branch. For Git you could hardcode the branch(es) inside the 'Branches to build' setting. But you are much more flexible by using parameterized builds. Depending on whether you use Git or Subversion adjust the Jenkins job accordingly:

If you're using Git then enable the 'This build is parameterized' with the 'String parameter' option in the source job. Add String Parameter settings as follows:

Name: branch
Default value: master
Description: branch to build (trunk, tags/...)

Then adjust the 'Branches to build' SCM settings:

Screenshot of git branch settings

If you're using Subversion instead then enable the 'This build is parameterized' with the 'List Subversion tags (and more)' option in the source job. An example configuration looks like:

Screenshot of subversion branch settings

DONE! Now you should be able to choose the branch that should be used for building the Debian source package.

Additionally to building Debian package based on a specific branch, you might want that built packages are put in a branch-based repository as well. To achieve that, start with adjusting the Artifact Deployer-Configuration like this:

Screenshot of artifact deployer settings for different branches

You should also choose "Trigger parameterized build on other projects" and add "Current build parameters" to the parameters. This will make sure, that the chosen branch is passed to the binary job. You can remove the usual "Build after other projects are built" trigger.

Next, proceed with the binary job. Start making it parameterized and accepting the branch parameter as done in the source job.

Now edit the build commands to be as following:

  rm -rf ./* || true
  export sources="${JENKINS_HOME}/userContent/${branch}/${JOB_NAME%-binaries*}-source"
  export REPOS="${JOB_NAME%-binaries*}-${branch}-${distribution}"
  /usr/bin/generate-reprepro-codename "${REPOS}"

  /usr/bin/build-and-provide-package
  

Thats it. If you now trigger a build for your source job, it will ask your for the branch and will put the resulting binaries and sources into a branch-specific repository.

The following scripts are provided by jenkins-debian-glue:

jenkins-debian-glue and its scripts can be customized mainly through several environment variables.

You can either set environment variables system wide or inside Jenkins jobs (use export VARIABLE=SETTING in the 'Execute shell' step accordingly).

The following settings are supposed to be configured in /etc/jenkins/debian_glue:

The following settings are supported by build-and-provide-package:

The following settings are supported by generate-git-snapshot:

The following settings are supported by generate-reprepro-codename:

The following settings are supported by generate-svn-snapshot:

Fork me on GitHub