Giter Club home page Giter Club logo

concourse_fly's Introduction

ConcourseFly

Interact with Concourse instance from your Ruby code without fly binary!

Installation

Add this line to your application's Gemfile:

gem "concourse_fly"

And then execute:

$ bundle install

Or install it yourself as:

$ gem install concourse_fly

Usage

require "concourse_fly"

fly = ConcourseFly::Client.new("https://ci-dev.net") do |client|
  client.auth_type = :raw
  client.auth_data = {raw: "Bearer adeAOEITNogiim..."}
end

fly[:get_info]  #=> {"version" => "5.8.0", "worker_version" => "2.2", "external_url" => "https://ci-dev.net"}

Authorization

Currently Supported

# Provide your own HTTP Authorization header
ConcourseFly::Client.new("https://ci-dev.net") do |client|
  client.auth_type = :raw
  client.auth_data = {raw: "Bearer adeAOEITNogiim..."}
end

# Let the client parse it from ~/.flyrc
ConcourseFly::Client.new("https://ci-dev.net") do |client|
  client.auth_type = :flyrc
  client.auth_data = {flyrc_target: "some-target"}
end

# Providing local user
ConcourseFly::Client.new("https://ci-dev.net") do |client|
  client.auth_type = :local
  client.auth_data = {username: "service-account-user", password: "service-account-password"}
end

Coming soon

# Browser login
ConcourseFly::Client.new("https://ci-dev.net") do |client|
  client.auth_type = :browser
end

API endpoints

Concourse doesn't have official REST API support yet. However, the available endpoints can be viewed in their source code.

This gem has made it somewhat more Ruby-like and Ruby-friendly by translating the CamelCase endpoint names to :snake_case. At the time of this writing, the client only support v5.8.0 endpoints, though the routes rarely change between releases.

fly = ConcourseFly::Client.new("https://ci-dev.net") do |client|
  client.auth_type = :raw
  client.auth_data = {raw: "Bearer adeAOEITNogiim..."}
end

fly[:rename_pipeline] do |options|   # :rename_pipeline => /api/v1/:team_name/pipelines/:old_pipeline/rename
  options.path_vars = {team_name: "all-star", pipeline_name: "old-pipeline"}   # substitutes the above ๐Ÿ”ผ
  options.body = '{"name": "new-pipeline"}'   # no official documentation yet for this ๐Ÿ˜ฌ
end   #=> true  (HTTP 204: No Content)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bundle exec rspec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

This project follows Semantic Versioning, thus v1.0.0 will not be released until the official REST API support / documentation is out.

Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the ConcourseFly project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

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.