Git Product home page Git Product logo

travis-tasks's Introduction

Travis Tasks


Travis Task is a Sidekiq based background processor whose main job is to send all manner of notifications based on events within Travis (job started, build finished).

These notifications are all queued up by state changes which are processed by Travis Hub and Travis Gatekeeper.

And, to make Travis Tasks even more special, there is no database connection required! Travis Tasks is all about talking to 3rd party services, if it be, Mandrill, Campfire, Slack, or Pushover.

You can find the full list of addon services Travis natively talks to within Travis Core.

Travis Tasks Diagram

Sending Email Setup

Start an Interactive Ruby Shell

irb -Ilib -rtravis/tasks

Setup Config for SMTP By Running Each Command

Travis.config.smtp.address = 'smtp.mandrillapp.com'
Travis.config.smtp.domain = 'travis-ci.org'
Travis.config.smtp.enable_starttls_auto = true
Travis.config.smtp.password = 'your smtp password for your enviorment'
Travis.config.smtp.port = 587
Travis.config.smtp.user_name = 'your smtp username'

Send Build Emails

To send diffent types of build emails the state, previous_state attributes in the build hash and state attribute job hash will need to be modified

You can send email to multiple addresses by adding them to the array following the jobs hash

Success Build

Travis::Addons::Email::Mailer::Build.finished_email({ build: {id: 1, repository_id: 1, commit_id: 1, number: 2, pull_request: false, config: {rvm: ['1.8.7, 1.9.2']}, state: 'passed', previous_state: 'passed', started_at: '2014-04-03T10:21:05Z', finished_at: '2014-04-03T10:22:05Z', duration: 60, jobs_ids: [1, 2], type: 'push'}, repository: {id: 1, key: '-----BEGIN PUBLIC KEY-----', slug: 'wonderfulPerson/minimal', name: 'minimal', owner_name: 'wonderPerson', owner_email: '[email protected]', owner_avatar_url: nil, url: 'repo url here}, commit: {id: 1, sha: '62aae5f70ceee39123ef', branch: 'this-branch-is-awesome', message: 'the commit message', committed_at: '2014-04-03T09:22:05Z', author_name: 'Wonderful Person', author_email: '[email protected]', committer_name: 'Wonderful Person', committer_email: '[email protected]', compare_url: 'https://github.com/wonderfulperson/minimal/compare/master...develop'}, jobs: [{id: 1, number: '2.1', state: 'passed', config: {rvm: '1.8.7'}}]},['[email protected]'],[{message: 'Testing testing this is a message', category: 'announcement'}, {message: 'Testing testing this is a message', category: 'warning'}]).deliver

Failed Build

Travis::Addons::Email::Mailer::Build.finished_email({ build: {id: 1, repository_id: 1, commit_id: 1, number: 2, pull_request: false, config: {rvm: ['1.8.7, 1.9.2']}, state: 'failed', previous_state: 'passed', started_at: '2014-04-03T10:21:05Z', finished_at: '2014-04-03T10:22:05Z', duration: 60, jobs_ids: [1, 2], type: 'push'}, repository: {id: 1, key: '-----BEGIN PUBLIC KEY-----', slug: 'wonderfulPerson/minimal', name: 'minimal', owner_name: 'wonderPerson', owner_email: '[email protected]', owner_avatar_url: nil, url: 'repo url here}, commit: {id: 1, sha: '62aae5f70ceee39123ef', branch: 'this-branch-is-awesome', message: 'the commit message', committed_at: '2014-04-03T09:22:05Z', author_name: 'Wonderful Person', author_email: '[email protected]', committer_name: 'Wonderful Person', committer_email: '[email protected]', compare_url: 'https://github.com/wonderfulperson/minimal/compare/master...develop'}, jobs: [{id: 1, number: '2.1', state: 'failed', config: {rvm: '1.8.7'}}]},['[email protected]'],[{message: 'Testing testing this is a message', category: 'announcement'}, {message: 'Testing testing this is a message', category: 'warning'}]).deliver

Still Failing Build

Travis::Addons::Email::Mailer::Build.finished_email({ build: {id: 1, repository_id: 1, commit_id: 1, number: 2, pull_request: false, config: {rvm: ['1.8.7, 1.9.2']}, state: 'failed', previous_state: 'failed', started_at: '2014-04-03T10:21:05Z', finished_at: '2014-04-03T10:22:05Z', duration: 60, jobs_ids: [1, 2], type: 'push'}, repository: {id: 1, key: '-----BEGIN PUBLIC KEY-----', slug: 'wonderfulPerson/minimal', name: 'minimal', owner_name: 'wonderPerson', owner_email: '[email protected]', owner_avatar_url: nil, url: 'repo url here}, commit: {id: 1, sha: '62aae5f70ceee39123ef', branch: 'this-branch-is-awesome', message: 'the commit message', committed_at: '2014-04-03T09:22:05Z', author_name: 'Wonderful Person', author_email: '[email protected]', committer_name: 'Wonderful Person', committer_email: '[email protected]', compare_url: 'https://github.com/wonderfulperson/minimal/compare/master...develop'}, jobs: [{id: 1, number: '2.1', state: 'failed', config: {rvm: '1.8.7'}}]},['[email protected]'],[{message: 'Testing testing this is a message', category: 'announcement'}, {message: 'Testing testing this is a message', category: 'warning'}]).deliver

Error Build

Travis::Addons::Email::Mailer::Build.finished_email({ build: {id: 1, repository_id: 1, commit_id: 1, number: 2, pull_request: false, config: {rvm: ['1.8.7, 1.9.2']}, state: 'errored', previous_state: 'passed', started_at: '2014-04-03T10:21:05Z', finished_at: '2014-04-03T10:22:05Z', duration: 60, jobs_ids: [1, 2], type: 'push'}, repository: {id: 1, key: '-----BEGIN PUBLIC KEY-----', slug: 'wonderfulPerson/minimal', name: 'minimal', owner_name: 'wonderPerson', owner_email: '[email protected]', owner_avatar_url: nil, url: 'repo url here}, commit: {id: 1, sha: '62aae5f70ceee39123ef', branch: 'this-branch-is-awesome', message: 'the commit message', committed_at: '2014-04-03T09:22:05Z', author_name: 'Wonderful Person', author_email: '[email protected]', committer_name: 'Wonderful Person', committer_email: '[email protected]', compare_url: 'https://github.com/wonderfulperson/minimal/compare/master...develop'}, jobs: [{id: 1, number: '2.1', state: 'errored', config: {rvm: '1.8.7'}}]},['[email protected]'],[{message: 'Testing testing this is a message', category: 'announcement'}, {message: 'Testing testing this is a message', category: 'warning'}]).deliver

Send Trial Emails

Travis::Addons::Trial::Mailer::TrialMailer.trial_started(%w{[email protected]}, { name: 'Clark', login: 'github_username', billing_slug: 'user' }, 100).deliver

Send Billing Emails

When a charge failed we call this method: charge_failed(receivers, subscription, owner, charge, event, invoice, cc_last_digits)

To check it and receive an email:

Travis::Addons::Billing::Mailer::BillingMailer.charge_failed( ["[email protected]"], { first_name: "Firstname", last_name: "Lastname", company: "Org", selected_plan: "travis-ci-two-builds"}, { name: 'Name', login: 'login' }, {"object": "charge"}, { "object": "invoice", "paid": false, "next_payment_attempt": Time.now + 86400.to_i  }, {"object": "invoice"}, {cc_last_digest: 1234}).deliver

We have the similar methods for: invoice_payment_succeeded and subscription_cancelled.

Send Feedback Emails

When a user gives feedback after the cancellation that method gets called :user_feedback(recipients, subscription, owner, user, feedback)

To check it and receive an email at: [email protected]:

Travis::Addons::BillingFeedback::Mailer::BillingFeedbackMailer.user_feedback( ["[email protected]"], {first_name: "Firstname", last_name: "Lastname", company: "Org", selected_plan: "travis-ci-two-builds", valid_to: Time.now }, { name: 'Name', login: 'login' }, {name: 'user', login: 'userlogin', email: "[email protected]" }, {"feedback": "test"}).deliver

Reporting Issues

Please file any issues on the central Travis CI issue tracker.

License & copyright information

See LICENSE file.

Copyright (c) 2011 Travis CI development team.

travis-tasks's People

Contributors

aakritigupta avatar aaron1011 avatar backspace avatar banzaiman avatar bnferguson avatar calavera avatar carlad avatar clekstro avatar cotsog avatar danielfone avatar dependabot-support avatar drogus avatar igorwwwwwwwwwwwwwwwwwwww avatar jantman avatar joecorcoran avatar joshk avatar lislis avatar meatballhat avatar nschonni avatar paulthegeek avatar porras avatar rkh avatar robertjlooby avatar roidrage avatar sarahhodne avatar sorta avatar soulshake avatar svenfuchs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.