UPDATE: As of January 10th, 2018, we released a Go client for Codeship’s API. To learn more, read the documentation article.
After a few months in public beta and handling close to a million requests a month, including requests from some of our biggest customers, we’re excited to announce that our new API is now in general availability.
We’ve been very satisfied with the performance and stability of the API, and we'd like to invite you to start using it to automate your own workflows. If you’re wondering what you could do with the API, we’ve included a few examples below that have come up during the beta.
Not all builds needs a code change, and the new API allows you to trigger those builds without doing empty commits.
We’ve seen this particular workflow implemented by Sage. They wanted to automate the process of updating their web app EC2 AMIs, which is built using Codeship Pro and the official Packer Docker image.
The project pulls the latest packages, security patches, etc., ensuring that everything is always up to date. Obviously, the Ansible scripts themselves wouldn’t need to constantly be updated, so what Sage needed was a reliable way of triggering the scripts, either manually or on a schedule.
The final solution is a Lambda script (which you can view here) that triggers a new build on a schedule based on a particular commit. The AMI is built on Codeship and pushed to AWS, where a separate process ensures that the latest image is always used to boot the EC2s.
To manage the secrets needed for the API, Sage defined a KMS encrypted variable, which is used within the Lambda script to retrieve the correct credentials.
Tool-specific dashboards are fine, but sometimes you want to combine your CI metrics with your issue tracker and possibly your production monitoring. The new API enables you to pull all history for all builds, allowing you to build out your own dashboard with data from multiple systems.
If you’re looking for inspiration on how to get started, Karl Hughes takes you through an example in his blog post, Creating a Custom Build Status Page Using Codeship.
This is especially useful if you often create new projects, even if they’re not that similar. With the API, you can create just a skeleton project or define standard notification rules, team access, etc.
Note that only Pro projects are fully supported with this release (full support for Basic projects will be added Jan 2018).
A great example of this is from another of our large customers, working on automating their project creation flow. Whenever a new repo is added to their organization, a script will automatically provision a project on Codeship, which is linked to the newly created repo. This allows them to template standard projects and make the initial setup much faster.
!Sign up for a free Codeship Account
What’s the Future?
The main idea with our API has always been to provide more flexibility, to allow you to integrate Codeship into your own workflow. The scenarios above hint at some of the things that can be built, but really anything that involves historic build data, triggering builds, or creating projects can likely be automated using Codeship's new API.
Early 2018, we'll add full support for working with Codeship Basic projects, and going forward, you can expect to see new features added to the overall product also become available through the API.
We’re excited to see how you will use the API, and we'll be happy to help you get started if needed. Also, if you have any ideas as to how we can improve the API, feel free to reach out to me as well; we appreciate all the feedback we get, and it helps us provide a better solution for you.
Codeship API v1
Note that with the public release of v2, the v1 API will be deprecated by July 1, 2018. Hopefully this is enough notice to give you time to migrate to v2, but do reach out if you need any help getting going.
Stay up to date
We'll never share your email address and you can opt out at any time, we promise.