Interact with Concourse instance from your Ruby code without fly
binary!
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
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"}
# 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
# Browser login
ConcourseFly::Client.new("https://ci-dev.net") do |client|
client.auth_type = :browser
end
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)
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.
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.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the ConcourseFly project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.