The current workflow for submitting builds to CBS is to generate a Source RPM in the developer's working directory for submission to the builders. A developer needs an active CBS account and the client tools installed on their workstation (see SIGGuide#CBSAccount).
Generating a Source RPM
Still allowed for now and for --scratch builds, but building from git.centos.org is the way to go
[bstinson@localhost new-package]$ rpmbuild --define "%_topdir `pwd`" -bs SPECS/new-package.spec
Short detour to describe Tags and Targets
When building in CBS it helps to understand where to send the sources to start a build, and where the built packages will come out the other end.
Definitions
Build Target: Specifies the buildroot and destination of a package for submission. This is specified on the /usr/bin/cbs command line to direct the package into the correct place
Tag: A place for packages to be grouped together. Built packages can be added to a tag automatically (e.g. just after a build) or manually placed in a tag with the tag-build operation to /usr/bin/cbs
Build Targets
Build targets are named according to the CentOS version, SIG, Project, Project Version, and Disttag they represent. Taking cloud7-openstack-kilo-el7 as an example:
SIG |
cloud |
CentOS Version |
7 |
Project |
openstack |
Version |
kilo |
Disttag |
el7 |
The build target will be assigned when a new set of tags is requested, and a list of current targets can be found at http://cbs.centos.org/koji/buildtargets
Tags
When a chairperson requests a new set of build tags, the SIG is encouraged to adopt the default workflow:
[build] -> cloud7-openstack-kilo-candidate -> cloud7-openstack-kilo-testing -> cloud7-openstack-kilo-release
The buildroot for new packages includes repositories from:
- The CentOS Linux base operating system
- A collection of the latest builds of every package in the candidate tag.
This allows developers to satisfy dependencies by relying on content in the base OS or by making sure a proper version is tagged in to -candidate (either by building it through the corresponding build target, or by issuing the tag-build command to include an already-existing build).
Build!
New Packages:
If your package has not been built before add it to the package list on your destination tags:
[bstinson@localhost new-package]$ cbs add-pkg --owner=bstinson cloud7-openstack-kilo-candidate new-package [bstinson@localhost new-package]$ cbs add-pkg --owner=bstinson cloud7-openstack-kilo-testing new-package [bstinson@localhost new-package]$ cbs add-pkg --owner=bstinson cloud7-openstack-kilo-release new-package
Scratch Build:
# Sending a source RPM to a scratch build [bstinson@localhost new-package]$ cbs build --scratch cloud7-openstack-kilo-el7 SRPMS/new-package-1.0.1-2.el7.src.rpm
Scratch builds will show up in the CBS web interface, and the built RPMS will be downloadable from there, but the package will not be included in any of the CBS tags (or the repos generated from the tags). Scratch builds are used to test functionality before doing a proper tagged build.
Tagged (Normal) Build:
# Sending a source RPM to a build target [bstinson@localhost new-package]$ cbs build cloud7-openstack-kilo-el7 SRPMS/new-package-1.0.1-2.el7.src.rpm
Tagged builds will end up in the -candidate tag after it's finished building, and will be available in the buildroot in case other packages depend on it.
NOTE: There is a restriction in CBS that a package's Name-Version-Release must be globally unique. This means that if anyone else (even from another SIG) has built new-package-1.0.1-2.el7 you must use that build, or build a different version
Building from git.centos.org
Instead of building locally a .src.rpm pkg and upload it to CBS to be built, you can submit a build request pointing to git.centos.org (see previous steps about lookaside and git push).
You just have to call cbs build pointing to git+https://git.centos.org/rpms/<pkg_name>.git#<commit_hash>
If you followed our previous example about centpkg-minimal package, we can easily retrieve from our git history the commit hash for the c7-sig-core branch that we just pushed to git.centos.org :
git log|head -n 1 commit ca63b53c8bde1efc91d55548f194dbecbf457cad
So to tell cbs builders to automatically retrieve all from git.centos.org (.spec / patches and lookaside artifact declared in .<pkg_name>.metadata) we can call it like this (based on our example and infrastructure7-el7 being our target for cbs tags, so it depends on your SIG/tags):
cbs build infrastructure7-el7 git+https://git.centos.org/rpms/centpkg-minimal.git#ca63b53c8bde1efc91d55548f194dbecbf457cad
Frequent Error Messages
FAILED: BuildError: package new-package not in list for tag cloud7-openstack-kilo-candidate
Be sure you add the package to the list be sure to add it to the package list: See the New Packages section under the Build step