Suraj Deshmukh

4 minute read

Note: This is a living document and will be updated from time to time.

Following are steps to package kompose for CentOS PAAS SIG. CentOS PAAS SIG is a repository of packages where rpms related to OpenShift and eco-system around it are delivered.

Setup your machine

Install packages needed

sudo yum update -y && \
sudo yum install -y epel-release && \
sudo yum install -y rpm-build go redhat-rpm-config make koji \
                    gcc byobu rpmlint rpmdevtools centos-packager

Setup certs

centos-cert -u surajd -n

Make sure your rpmspec is error free

rpmlint kompose.spec

Building kompose srpm

There are two ways to build srpm either build it locally or the ones that is built in koji for epel.

Build rpms locally

Before you begin make sure you have setup the local directory structure:

rm -rf ~/rpmbuild/
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

Update the rpm spec and get source code using it.

spectool -g kompose.spec

Move the source to appropriate location

cp kompose-* ~/rpmbuild/SOURCES/

Start local build

rpmbuild -ba kompose.spec --define "dist .el7"

Once above exits with status code 0, you can find the RPMs:

$ ll ~/rpmbuild/RPMS/x86_64/
total 9724
-rw-rw-r--. 1 vagrant vagrant 9956072 May 26 09:37 kompose-0.7.0-0.1.el7.x86_64.rpm

SRPMs can be found at:

$ ll ~/rpmbuild/SRPMS/
total 4828
-rw-rw-r--. 1 vagrant vagrant 4941880 May 26 09:37 kompose-0.7.0-0.1.el7.src.rpm

See if dependencies are properly set

$ rpm -qpR ~/rpmbuild/RPMS/x86_64/kompose-*
git
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libpthread.so.0(GLIBC_2.3.2)(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1

Try installing it locally and test it as mentioned in http://suraj.io/post/test-kompose/

Pull sprm

For release 0.3.0, I pulled SRPM from:

wget https://kojipkgs.fedoraproject.org//packages/kompose/0.3.0/0.1.git135165b.el7/src/kompose-0.3.0-0.1.git135165b.el7.src.rpm

Build the rpm on cbs from src.rpm

CBS is a community build system for SpecialInterestGroup members. It allows to build packages with Koji against CentOS5, CentOS6 and CentOS7.

Trying a scratch build on CBS

Do a scratch build on CBS in paas7-openshift-common-release.

cbs build --scratch paas7-openshift-common-el7 ~/rpmbuild/SRPMS/kompose-*

You can download the rpm built here to test on CentOS machine.

Making an actual release

cbs build paas7-openshift-common-el7 ~/rpmbuild/SRPMS/kompose-*

Once build is done successfully goto build page and download the rpm that is built for x86_64.

The page where builds were listed: https://cbs.centos.org/koji/taskinfo?taskID=181452 The page where this particular build happened and where I had download link to rpm: https://cbs.centos.org/koji/buildinfo?buildID=17249

wget http://cbs.centos.org/kojifiles/packages/kompose/0.7.0/0.1.el7/x86_64/kompose-0.7.0-0.1.el7.x86_64.rpm

Try to install this rpm and see if it works on CentOS:

yum install -y epel-release
yum install -y wget jq make

wget http://cbs.centos.org/kojifiles/packages/kompose/0.7.0/0.1.el7/x86_64/kompose-0.7.0-0.1.el7.x86_64.rpm

yum install -y kompose-0.7.0-0.1.el7.x86_64.rpm

git clone https://github.com/kubernetes-incubator/kompose/
cd kompose
git reset --hard $(kompose version | cut -d "(" -f2 | cut -d ")" -f1)
make test-cmd

If everything is okay, Tag it into testing, Verify that whatever you built last cbs is the good, the output should be version you wanted, and not the old one.

$ cbs latest-build paas7-openshift-common-candidate kompose
Build                                     Tag                   Built by
----------------------------------------  --------------------  ----------------
kompose-0.7.0-0.1.el7                     paas7-openshift-common-candidate  surajd

Tag the build output of above command to testing

$ cbs tag-pkg paas7-openshift-common-testing kompose-0.7.0-0.1.el7
Created task 181472
Watching tasks (this may be safely interrupted)...
181472 tagBuild (noarch): closed

181472 tagBuild (noarch) completed successfully

Verify it is in testing

$ cbs latest-build paas7-openshift-common-testing kompose
Build                                     Tag                   Built by
----------------------------------------  --------------------  ----------------
kompose-0.7.0-0.1.el7                     paas7-openshift-common-testing  surajd

Run whatever tests you want to verify that it’s a good build. It takes anywhere from 5 to 30 minutes for the rpm to make it into testing http://buildlogs.centos.org/centos/7/paas/x86_64/openshift-origin/

yum -y install centos-release-openshift-origin
yum -y --enablerepo=centos-openshift-origin-testing install kompose
yum install -y epel-release
yum install -y jq make

git clone https://github.com/kubernetes-incubator/kompose/
cd kompose
git reset --hard $(kompose version | cut -d "(" -f2 | cut -d ")" -f1)
make test-cmd

Check if the package is in testing

$ cbs latest-build paas7-openshift-common-testing kompose
Build                                     Tag                   Built by
----------------------------------------  --------------------  ----------------
kompose-0.7.0-0.1.el7                     paas7-openshift-common-testing  surajd

Tag it into release:

$ cbs tag-pkg paas7-openshift-common-release kompose-0.7.0-0.1.el7
Created task 181634
Watching tasks (this may be safely interrupted)...
181634 tagBuild (noarch): free
181634 tagBuild (noarch): free -> closed
  0 free  0 open  1 done  0 failed

181634 tagBuild (noarch) completed successfully

Once it is populated, it will show up in the repos, install it as follows:

yum install -y centos-release-openshift-origin
yum install -y kompose

Ref:

comments powered by Disqus