Client updates roundup

Jan 18, 2016 • packagecloud

TL;DR

We’ve made a few changes and improvements to our client libraries. This short post aims to provide a quick summary. Look forward to these roundups as we continue to add features and improve our integrations.

Latest Versions

As of writing, these are the latest versions that support the features listed below.

NOTE: the major version has been bumped for all libraries, so your code WILL need to be updated (except the jenkins and CLI) before upgrading to these versions.

packagecloud-ruby: 1.0.2

io.packagecloud.client: 2.0.0

package_cloud (CLI) 0.2.28

packagecloud-plugin: 1.4

Python support across the board

All of our client libraries now support uploading Python packages!

packagecloud-ruby changes

:filename required

The filename is now required if it cannot be detected (see below).

smarter Package object

Package.new now takes an options hash instead of arguments, which cleans up the API a bit and makes it easier to report the user what is wrong with their arguments.

Now, you can pass a file path for :file or a File object, (like the previous versions) and it will fill out :filename for you:

pkg = Package.new(file: "packages/jake-1.0.2.deb")
pkg.filename == jake-1.0.2.deb

Or, you can pass an IO object and pass the filename yourself:

fd = IO.sysopen("packages/chewbacca-1.0.0.gem", "r")
io = IO.new(fd)
Package.new(file: io, filename: "chewbacca-1.0.0.gem")

fuzzy distro_version_id lookup

The distro_version_id has been removed from Package.new and is now part of the put_package call. This allows you to push the same Package instance to multiple distributions without having to recreate the package object, like so:

pkg = Package.new(file: "packages/jake-1.0.2.deb")

@client.put_package(pkg, "ubuntu/trusty")
@client.put_package(pkg, "ubuntu/warty")

packagecloud-plugin changes

collaborator repository support

Previously, the username was used for URL generation and jenkins credentials lookup, making it difficult to push to repositories you collaborate on (the workaround was creating another set of credentials, with their username and your token).

Now, there is an extra field for entering the collaborator username, allowing you to use your token on someone else’s repository.

packagecloud-plugin jenkins 1.4 UI

io.packagecloud.client changes

filename required

The filename is now a required field on Package

collaborator support

Pass the collaborator username into putPackage and it will be used instead of the loaded credentials one.

public Result putPackage(
        InputStream fileStream,
        String filename,
        String username,
        String repository,
        Integer distroVersionId,
        Map<String, InputStream> sourceFiles)

Conclusion

We’re constantly improving our client libraries to ensure that you have an excellent user experience using packagecloud.io, from any system. Don’t hesitate to file an issue or open a pull request on our projects. We look forward to hearing your feedback. Pop into our slack or email support@packagecloud.io if you have any questions or comments. Happy packaging!

Never miss an update!

Subscribe to our RSS feed