Codeship Integration

Codeship is a hosted continuous delivery service that focuses on speed, reliability and simplicity. It supports a variety of programming languages (Ruby on Rails, Node.js, PHP, Java, Go, Dart, etc.) and deployment platforms (Amazon Web Services, Heroku, Google App Engine, etc.).

202

The practice of continuous integration involves repeated automated testing and code merging with notifications to alert developers to problems in their code in real time. Codeship combines this with the practice of continuous delivery, which provides for regular code deployment once changes have passed automated tests. Essentially, when code is pushed to GitHub (or Bitbucket), Codeship rebuilds your application on its secure servers and runs your automated tests. If the tests fail, it notifies your development team via email or integration.

What does Opsgenie offer Codeship users?

Use Opsgenie Codeship Integration to forward Codeship build alerts to Opsgenie. Opsgenie
determines the right people to notify based on on-call schedules– notifies via email, text messages (SMS), phone calls, and iOS & Android push notifications, and escalates alerts until the alert is acknowledged or closed.

Functionality of the integration

  • When a build alert is created in Codeship, an alert is created in Opsgenie automatically through the integration.

Add Codeship Integration to Opsgenie

  1. Please create an Opsgenie account if you haven't done so already.
  2. Go to Opsgenie Codeship Integration page.

🚧

For Free and Essentials plans, you can only add the integrations from the Team Dashboards, please use the alternative instructions given below to add this integration.

  1. Specify who is notified of Codeship alerts using the Teams field. Auto-complete suggestions are provided as you type.

📘

An alternative for Step 2) and Step 3) is to add the integration from the Team Dashboard of the team which will own the integration. To add an integration directly to a team, navigate to the Team Dashboard and open Integrations tab. Click Add Integration and select the integration that you would like to add.

  1. Click Save Integration.
2012

Configuration in Codeship Pro

Configuring Build Notifications

To configure build notifications in Codeship, go to Project Settings and click on the Notifications tab.

To add more rules to an existing branch (or branch match), click add to the right of the branch name. To add rules for a new branch (or branch match), click the big new notification button at the bottom of the page.

To remove specific rule trigger for notifications, either disable it (use the toggle on the right-hand side) or delete it completely.

Common Configuration

All rules apply to either “All Branches”, a names branch, or a branch match. If the field is left empty, the rule applies to all branches.

Additionally, all rules can select between started, failed, succeeded, and recovered as events that trigger a notification. Select at least one event in order to save the rule.

started -> sends a notification when a new build is triggered
failed -> sends a notification if a build fails for some reason
succeeded -> sends a notification if the build finishes successfully
recovered -> sends a notification if the previous build failed, but the current build succeeded

Codeship sends build data using Webhook Services

Sample Webhook Message from Opsgenie Codeship Plugin

{
  "build": {
    "build_url":"https://www.codeship.com/projects/102xx/builds/97xxxx",
    "commit_url":"https://github.com/codeship/docs/
                  commit/96943xxxxxxxxxx",
    "project_id":102xx,
    "build_id":97xxxx,
    "status":"testing",
    # PROJECT_FULL_NAME IS DEPRECATED AND WILL BE REMOVED IN THE FUTURE
    "project_full_name":"codeship/docs",
    "project_name":"codeship/docs",
    "commit_id":"96943dc5xxxxxxxxxxxxxxxxxx",
    "short_commit_id":"96xxx",
    "message":"Merge pull request #34 from codeship/feature/shallow-clone",
    "committer":"beanixxxx",
    "branch":"master"
  }
}

The status field has one of the following values:

initiated for newly started build
error for failed builds
success for passed builds
stopped for stopped builds
waiting for waiting builds
ignored for builds ignored because the account is over the monthly build limit
blocked for builds blocked because of excessive resource consumption
infrastructure_failure for builds which failed because of an internal error on the build VM

For more information, please refer to Codeship's Manage Notification and Codeship's Opsgenie Integration Doc

Sample alert

2495