module WarpEngine::CI
The CI integration of the engine. Listing and activating repositories, reading and triggering pipeline runs, provisioning secrets and serving generated pipeline configs all go through one adapter, chosen with WarpEngine.config.ci_adapter and returned by CI.adapter.
Woodpecker (CI::Woodpecker::Adapter) is the default, CI::Gitlab::Adapter ships too, CI::Null turns CI off, and any other object answering the same methods can be set as the adapter.
Constants
- Repo
-
A repository as the
CIserver knows it, built by the adapters.- id
-
the
CIserver’s id of the repository (Woodpeckerrepo id, GitLab project id) - name
-
the repository name
- owner
-
the owner or namespace
- active
-
whether
CIis enabled for it - raw
-
the provider’s response Hash
- Run
-
One pipeline run, built by the adapters.
- number
-
the run’s number (
Woodpecker) or pipeline id (GitLab) - status
-
the provider’s status string, e.g.
success - branch
-
the branch or ref built
- message
-
the commit message, when the provider gives one
- created_at
-
the start time as a Time, or
nil - url
-
the link to the run or commit on the forge
- raw
-
the provider’s response Hash
Public Class Methods
Source
# File lib/warp_engine/ci.rb, line 131 def adapter configured = WarpEngine.config.ci_adapter case configured when nil, :woodpecker, "woodpecker" then woodpecker_adapter when :gitlab, "gitlab" then gitlab_adapter when :none, "none", :null then null_adapter else configured end end
Returns the CI adapter in use, from WarpEngine.config.ci_adapter: the memoized CI::Woodpecker::Adapter for nil or :woodpecker, the CI::Gitlab::Adapter for :gitlab, CI::Null for :none or :null, and any other value (a host-supplied adapter object) as it is.
Source
# File lib/warp_engine/ci.rb, line 145 def gitlab? = adapter.is_a?(Gitlab::Adapter)
Returns true when the adapter in use is a CI::Gitlab::Adapter.
Source
# File lib/warp_engine/ci.rb, line 153 def gitlab_adapter @gitlab_adapter ||= Gitlab::Adapter.new end
Returns the memoized CI::Gitlab::Adapter, configured from ENV.
Source
# File lib/warp_engine/ci.rb, line 158 def null_adapter @null_adapter ||= Null.new end
Returns the memoized CI::Null adapter.
Source
# File lib/warp_engine/ci.rb, line 163 def reset! @woodpecker_adapter = nil @gitlab_adapter = nil @null_adapter = nil end
Forgets the memoized adapters, so the next call builds them again. Returns nil.
Source
# File lib/warp_engine/ci.rb, line 143 def woodpecker? = adapter.is_a?(Woodpecker::Adapter)
Returns true when the adapter in use is a CI::Woodpecker::Adapter.
Source
# File lib/warp_engine/ci.rb, line 148 def woodpecker_adapter @woodpecker_adapter ||= Woodpecker::Adapter.new end
Returns the memoized CI::Woodpecker::Adapter, configured from ENV.