Setting up a YUM / RPM repository on Bintray

Bintray supports many kinds of repositories: Maven, Debian packages, etc. And this is very convenient for open source projects. I recently had to create a repository for Roboconf’s RPM packages. And the least I can say is that it did not work as expected. I made several attempts before it finally works.

The creation of a RPM repository is made through Bintray’s web interface. Create a new repository, set RPM as its type and make sure the YUM metadata folder depth is zero. Here, we assume there will be only one RPM repository contained in this « Bintray repository ».

Create a new RPM repository on Bintray

Once created, add a new package in Bintray.
Packages are these entities that contain versions. In my case, there was only one package that I called main. So far, so good.

I once wrote an article about how to upload binaries on Bintray with their REST API. I will show CURL snippets for the following steps.

First, create a version.

curl -vvf -u${BINTRAY_USER}:${BINTRAY_API_KEY} -H "Content-Type: application/json" \
	-X POST ${BINTRAY_URL}/packages/<organization>/<repository-name>/<package-name>/versions \
	--data "{\"name\": \"${RELEASE_VERSION}\", \"github_use_tag_release_notes\": false }"

Then, upload binaries (RPM) to this package.

for f in $(find -name "*.rpm" -type f)
do
	echo
	echo "Uploading $f"
	curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} \
		-H "X-Bintray-Version:${RELEASE_VERSION}" \
		-H "X-Bintray-Package:<package-name>" \
		-# -o "/tmp/curl-output.txt" \
		${BINTRAY_URL}/content/<organization>/<repository-name>/<package-name>/${RELEASE_VERSION}/
	
	echo
	echo "$(</tmp/curl-output.txt)"
	echo
done

To publish them, I generally recommend to do it through the web interface of Bintray. This is the manual step for verification before publishing. But you could use Bintray’s REST API too.

Once your binaries are published, I guess you will want to test them. Personnaly, I like to use Docker to test my installers (but whatever). Get a (virtual) machine and click the set me up link on Bintray’s page. There are not that many documentation on Bintray, but these set me up links generally show whatever you need.

In my case, it indicated the following steps.

Set me up instructions on Bintray

There was indeed a file at https://bintray.com/roboconf/roboconf-rpm/rpm. But when I typed in yum install roboconf-dm, I got a 404 error (not found) about a file called repodata/repomd.xml.

Bintray indicates metadata files should be generated automatically. Obviously, it was not the case there. Hopefully, there is a REST command that allows to force the generation of these metadata.

curl -X POST -u ${BINTRAY_USER}:${BINTRAY_API_KEY} \
https://api.bintray.com/calc_metadata/<organization>/<repository-name>

Then, yum install roboconf-dm worked as expected.
I hope this article will help you. I would have saved 2 hours if I have had all these things right at the beginning.


About this entry