Browse Source

Provide yaml setup files for usage with jenkins-job-builder

NOTE: I've filed a report against upstream's BTS to (hopefully)
get a new release of jenkins-job-builder, see
https://bugs.launchpad.net/openstack-ci/+bug/1251201
In the meanwhile be aware that the unsupported settings
(see jjb/README for details) are just ignored.

The piuparts job currently doesn't work out-of-the-box when set up
via jenkins-job-builder without the patch from
https://review.openstack.org/#/c/56412/ because the CopyArtifact
plugin applies a rewrite of the config.xml on first *build* of
the Jenkins job.
tags/v0.8.0
Michael Prokop 7 years ago
parent
commit
cbe7f6f5f6
3 changed files with 280 additions and 0 deletions
  1. +54
    -0
      jjb/README
  2. +95
    -0
      jjb/jdg-freight.yaml
  3. +131
    -0
      jjb/jdg-reprepro.yaml

+ 54
- 0
jjb/README View File

@@ -0,0 +1,54 @@
README for jjb directory in jenkins-debian-glue
-----------------------------------------------

Jenkins Job Builder (JJB) takes simple descriptions of Jenkins
jobs in YAML format and uses them to configure Jenkins.
This directory provides some sample configuration for usage of
jenkins-debian-glue with Jenkins Job Builder.

Usage instructions:

1) Install jenkins-job-builder, available as Debian package
in Debian jessie and newer and in Ubuntu [universe]
raring, saucy, trusty and newer, or from upstream at
https://github.com/openstack-infra/jenkins-job-builder
Find upstream documentation for jenkins-job-builder at
http://ci.openstack.org/jenkins-job-builder

2) Create /etc/jenkins_jobs/jenkins_jobs.ini, like (adjust user,
password and url settings as needed for your environment):

[jenkins]
user=jenkins-job-builder
password=jenkins-job-builder
url=http://localhost:8080/

3) Execute e.g. 'jenkins-jobs update jjb/jdg-reprepro.yaml' to
generate Jenkins jobs in the specified Jenkins environment (see
point 2) as defined in file jdg-reprepro.yaml, currently being
jobs jenkins-debian-glue-source, jenkins-debian-glue-binaries
and jenkins-debian-glue-piuparts.

The jjb/jdg-freight.yaml file configures Jenkins jobs
jdg-freight-source and jdg-freight-binaries, which provide
a similar setup as jenkins-debian-glue-* but using the
freight repository software [https://github.com/rcrowley/freight/]
instead of using reprepro [http://mirrorer.alioth.debian.org/].

Hint: by running "mkdir /tmp/jdg; jenkins-jobs test jjb/ -o /tmp/jdg'
you can get a test configuration of your jobs without
directly deploying them into the Jenkins system.

Notes:

* the yaml files assume amd64 as default architecture,
if you don't have an amd64 system please adjust the
references to "amd64" in the files with "i386" (or so)
* you need to adjust the KEY_ID setting in jjb/jdg-freight.yaml
before executing the jdg-freight-* Jenkins jobs (and if you
don't have a GPG key for the user which runs the job yet you
also have to create a key running 'gpg --gen-key')
* junit's "keep-long-stdio: false" setting requires
jenkins-job-builder >0.5.0 (available as of git commit 2faa91e2).
* the TAP test result files feature requires
jenkins-job-builder >0.5.0 (available as of git commit 624fd659).

+ 95
- 0
jjb/jdg-freight.yaml View File

@@ -0,0 +1,95 @@
# This jenkins-job-build configuration sets up Jenkins jobs
# for building Debian packages of jenkins-debian-glue
# which are provided using the repository software called freight
# [https://github.com/rcrowley/freight/] then.

- project:
name: jdg-freight
repos: git://github.com/mika/jenkins-debian-glue.git
jobs:
- '{name}-source'
- '{name}-binaries'

- job-template:
name: '{name}-source'
project-type: freestyle
description: 'Build Debian source package of {name}.<br />Do not edit this job through the web, it is generated via jenkins-job-builder!'
disabled: false
scm:
- git:
url: '{repos}'
name: origin
refspec: +refs/heads/*:refs/remotes/origin/*
basedir: source
branches:
- master
wipe-workspace: false
builders:
- shell: 'rm -f ./* || true'
- shell: '/usr/bin/generate-git-snapshot'
- shell: |
mkdir -p report
/usr/bin/lintian-junit-report *.dsc > report/lintian.xml
publishers:
- archive:
artifacts: '*.gz,*.bz2,*.xz,*.deb,*.dsc,*.changes,lintian.txt'
- trigger:
project: '{name}-binaries'
- junit:
results: '**/lintian.xml'
keep-long-stdio: false
- fingerprint:
record-artifacts: true
wrappers:
- timestamps

- job-template:
name: '{name}-binaries'
project-type: matrix
description: |
<p>Build Debian binary packages of {name}.<br />Do not edit this job through the web, it is generated via jenkins-job-builder!</p>
<h2>Usage instructions how to remotely access and use the repository:</h2>
<p>Install apache webserver:</p>
<pre>
sudo apt-get install apache2
sudo ln -s /var/cache/freight /var/www/debian
</pre>
<p>Then access to this repository is available using the following sources.list entry:</p>
<pre>
deb http://$jenkins_server/debian/ {name} main
deb-src http://$jenkins_server/debian/ {name} main
</pre>
execution-strategy:
sequential: true
axes:
- axis:
type: user-defined
name: architecture
values:
- amd64
builders:
- copyartifact:
project: '{name}-source'
filter: '*'
which-build: upstream-build
fallback-to-last-successful: true
- shell: |
export USE_FREIGHT=true
export SUDO_CMD=sudo
export KEY_ID=DEADBEEF # please adjust, or edit /etc/freight.conf
/usr/bin/build-and-provide-package
- shell: |
mkdir -p report
/usr/bin/lintian-junit-report *.dsc > report/lintian.xml
publishers:
- archive:
artifacts: '*.gz,*.bz2,*.xz,*.deb,*.dsc,*.changes,lintian.txt'
- junit:
results: '**/lintian.xml'
keep-long-stdio: false
- fingerprint:
record-artifacts: true
- workspace-cleanup:
dirmatch: false
wrappers:
- timestamps

+ 131
- 0
jjb/jdg-reprepro.yaml View File

@@ -0,0 +1,131 @@
# This jenkins-job-build configuration sets up Jenkins jobs
# for building Debian packages of jenkins-debian-glue
# which are provided using the repository software called reprepro
# [http://mirrorer.alioth.debian.org/] then.

- project:
name: jenkins-debian-glue
repos: git://github.com/mika/jenkins-debian-glue.git
jobs:
- '{name}-source'
- '{name}-binaries'
- '{name}-piuparts'

- job-template:
name: '{name}-source'
project-type: freestyle
description: 'Build Debian source package of {name}.<br />Do not edit this job through the web, it is generated via jenkins-job-builder!'
disabled: false
scm:
- git:
url: '{repos}'
name: origin
refspec: +refs/heads/*:refs/remotes/origin/*
basedir: source
branches:
- master
wipe-workspace: false
builders:
- shell: 'rm -f ./* || true'
- shell: '/usr/bin/generate-git-snapshot'
- shell: |
mkdir -p report
/usr/bin/lintian-junit-report *.dsc > report/lintian.xml
publishers:
- archive:
artifacts: '*.gz,*.bz2,*.xz,*.deb,*.dsc,*.changes,lintian.txt'
- trigger:
project: '{name}-binaries'
- junit:
results: '**/lintian.xml'
keep-long-stdio: false
- fingerprint:
record-artifacts: true
wrappers:
- timestamps

- job-template:
name: '{name}-binaries'
project-type: matrix
description: |
<p>Build Debian binary packages of {name}.<br />Do not edit this job through the web, it is generated via jenkins-job-builder!</p>
<h2>Usage instructions how to remotely access and use the repository:</h2>
<p>Install apache webserver:</p>
<pre>
sudo apt-get install apache2
sudo ln -s /srv/repository /var/www/debian
</pre>
<p>Then access to this repository is available using the following sources.list entry:</p>
<pre>
deb http://$jenkins_server/debian/ {name} main
deb-src http://$jenkins_server/debian/ {name} main
</pre>
execution-strategy:
sequential: true
axes:
- axis:
type: user-defined
name: architecture
values:
- amd64
builders:
- copyartifact:
project: '{name}-source'
filter: '*'
which-build: upstream-build
fallback-to-last-successful: true
- shell: "/usr/bin/build-and-provide-package"
- shell: |
echo "Listing packages inside the {name} repository:"
/usr/bin/repository_checker --list-repos jenkins-debian-glue
- shell: |
mkdir -p report
/usr/bin/lintian-junit-report *.dsc > report/lintian.xml
publishers:
- archive:
artifacts: '*.gz,*.bz2,*.xz,*.deb,*.dsc,*.changes,lintian.txt'
- junit:
results: '**/lintian.xml'
keep-long-stdio: false
- fingerprint:
record-artifacts: true
- trigger:
project: '{name}-piuparts'
- workspace-cleanup:
dirmatch: false
wrappers:
- timestamps

- job-template:
name: '{name}-piuparts'
project-type: freestyle
description: 'Installation and upgrade tests for {name} Debian packages.<br />Do not edit this job through the web, it is generated via jenkins-job-builder!'
disabled: false
parameters:
- string:
name: architecture
default: amd64
description: "Architecture that should be used."
builders:
- copyartifact:
project: '{name}-binaries/architecture=$architecture'
filter: '*.deb'
which-build: upstream-build
fallback-to-last-successful: true
flatten: true
target: 'artifacts/'
- shell: |
# sadly piuparts always returns with exit code 1 :((
sudo piuparts_wrapper $PWD/artifacts/*.deb || true
- shell: 'piuparts_tap piuparts.txt > piuparts.tap'
publishers:
- tap:
results: 'piuparts.tap'
- archive:
artifacts: 'piuparts.*'
- fingerprint:
record-artifacts: true
- workspace-cleanup:
dirmatch: false
wrappers:
- timestamps

Loading…
Cancel
Save