Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Integrating Rollbar With Codeship

DZone's Guide to

Integrating Rollbar With Codeship

In this post, we quickly go over how to integrate these two tools as a means of providing logging for CI/CD deployment workflows.

· Integration Zone ·
Free Resource

SnapLogic is the leading self-service enterprise-grade integration platform. Download the 2018 GartnerMagic Quadrant for Enterprise iPaaS or play around on the platform, risk free, for 30 days.

At Codeship, we're pleased to be able to integrate with several third-party products across a variety of areas to ensure your CI/CD workflows are that much smoother. For example, Rollbar lets you collect and track errors and events related to your web applications. During your continuous deployment workflow, you can use Rollbar to log information related to your deployments.

By using Rollbar, you can track important logs for future analysis and alerting.

Their documentation does a great job of providing more information, in addition to the setup instructions below.

Codeship Pro

You will need to add your Rollbar access token to your encrypted environment variables that you encrypt and include in your codeship-services.yml file.

Logging During Deployment

Next, you will need to add the following commands to a script, placed in your repository, that you will call from your codeship-steps.yml file:

curl https://api.rollbar.com/api/1/deploy/ \
  -F access_token=$ACCESS_TOKEN \
  -F environment=$CI_BRANCH \
  -F revision=$CI_COMMIT_ID \
  -F local_username=$CI_COMMITTER_USERNAME

You will need to call this script on all deployment-related branches by specifying the tag. Be sure to add this step after your deployment commands, so that it only runs if the deployments were successful. For example:

- name: deploy
  service: app
  tag: master
  command: your deployment commands

- name: rollbar
  service: app
  tag: master
  command: deploy-rollbar.sh

Codeship Basic

You will need to add your Rollbar access token to your to your project's environment variables. You can do this by navigating to Project Settings and then clicking on the Environment tab.

Logging During Deployment

To log a deployment-related datapoint in Rollbar, you will want to add a new custom-script step to all of your deployment pipelines. This new step will either run the following commands or run a script that includes the following commands:

curl https://api.rollbar.com/api/1/deploy/ -F access_token=$ACCESS_TOKEN -F environment=$CI_BRANCH -F revision=$CI_COMMIT_ID -F local_username=$CI_COMMITTER_USERNAME

With SnapLogic’s integration platform you can save millions of dollars, increase integrator productivity by 5X, and reduce integration time to value by 90%. Sign up for our risk-free 30-day trial!

Topics:
integration ,logging ,ci/cd

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}