Developing your company’s pipeline for continuous integration is a daunting and ever-evolving effort. As software becomes more complex, a need to distribute versioned internal libraries will often arise. Tools like NuGet and Maven provide excellent platforms for distribution, but running your own server can be an unnecessary hassle. Enter Bintray.
What is Bintray?
Bintray bills itself as “…package hosting and download center infrastructure for automated software distribution.” Perhaps a simpler way to think of it is as a way to manage and distribute your versioned products. The system provides integration with repository systems like NuGet, Maven, and Docker, making it easy to find ways of utilizing the service within your build and delivery processes. Paid subscriptions offer you additional features such as private repositories and historical statistics, while an open-source license still offers CDN-based distribution and public repositories that support formats like NuGet, NPM, YUM, and more.
An Example: NuGet Library
I spend a lot of time working in .NET and Visual Studio. The software I help build is extraordinarily complex and is comprised of over 100 different pieces. Not all of those pieces are proprietary, and some are very stable. We’ve found that in these situations, it is often helpful to repackage those components as libraries within NuGet.
Here, we’ll pretend we have a library called FileHelper that is both open- source and stable, used throughout our code. We use TeamCity at work, so once the project has been separated from our main solution, we’ll have a build project configured for the library:
One of the build steps would be a Powershell script that does various housekeeping before packing the project into a properly formed NuGet package (see this link for instructions). Once the package is built through NuGet commands, I’ll again use the NuGet executable to push my package to Bintray. The following notes should help you get through:
Make sure you’re using a version of NuGet that is registered with your system path on Windows.
Register your Bintray repository with NuGet on your machine (before trying to run this in a build step in TeamCity) using the steps described by Bintray.
After you pack your nupkg file, use the described nuget push command to actually get your version pushed to Bintray’s repository.
When you’ve finished all of this, you should see your new version (in this case, mine was the first version) listed on your package’s version section:
Other Bintray Features
Bintray has plenty of useful features if you subscribe. For starters, there is the ability to restrict access to packages using access tokens, which appear to work as though they were download keys. You can also white-label your downloads with your own domain, and you can even determine what countries are able to access your downloads.
Like FTP, but Better
Taking care of binary distribution is an important step in the DevOps process, allowing a codebase to be much more flexible in how it handles dependencies and deployments. In the end, Bintray is a solution that can help alleviate several painful components of your development pipeline.
Editor’s Note: Using Bintray with Continuous Integration is published by the Sumo Logic DevOps Community. If you’d like to learn more or contribute, visit devops.sumologic.com. Also, be sure to check out the Sumo Logic Developers Open Source page for free tools, API’s and example code that will enable you to monitor and troubleshoot applications from code to production.
About the Author
Andrew Male (@AndyM84) is a senior engineer at an enterprise development company in Boston, MA. Andrew has been programming from a young age and is entirely self-taught; he has spent time in many corners of the programming world including game/VR work, agency work, and teaching development to students and adults alike. He spends most of his time working on architecture design and pursuing his favorite hobby—physics.