warp_engine 0.2.0: pluggable storage adapter and publish notifications
Two seams the hosts needed, both backward compatible.
Storage: artifacts are served through WarpEngine::Storage.adapter instead of
raw filesystem calls. The default :local adapter keeps the previous behaviour
byte for byte, including the path traversal guard. A host can now set
config.storage_adapter to any object answering file?/directory?/locate and
serve builds from an object store - FileService and /api/download both honour
a Location.redirect, so a signing adapter turns them into redirects.
DownloadService#create still returns an absolute path (nil when missing) for
existing callers; #locate is the new entry point that can also return a
redirect. Ingestion (upload, extraction, file manager) stays local for now.
Publish: PublishService emits ActiveSupport::Notifications
("warp_engine.publish") with platform/name/version/software/release, so hosts
can react to a new build without hanging callbacks on the models.
WarpEngine.instruments_publish? lets a host feature-detect and keep its
fallback for older engine versions.
This commit is contained in:
@@ -3,6 +3,7 @@ require "apipie-rails"
|
||||
|
||||
require "warp_engine/version"
|
||||
require "warp_engine/configuration"
|
||||
require "warp_engine/storage"
|
||||
|
||||
module WarpEngine
|
||||
# A tábláink prefix nélküliek (softwares, releases, ...) — az isolate_namespace
|
||||
@@ -23,6 +24,18 @@ module WarpEngine
|
||||
def self.woodpecker_configured?
|
||||
config.woodpecker_url.present? && config.woodpecker_api_token.present?
|
||||
end
|
||||
|
||||
# A host innen tudja, hogy a publikálás ActiveSupport::Notifications-t szór
|
||||
# ("warp_engine.publish"), és nem kell modell-callbackre kapaszkodnia.
|
||||
# Régebbi engine-verziókon a metódus nem létezik, ezért a hívó oldalon
|
||||
# respond_to?-val kérdezendő.
|
||||
def self.instruments_publish?
|
||||
true
|
||||
end
|
||||
|
||||
def self.storage
|
||||
Storage.adapter
|
||||
end
|
||||
end
|
||||
|
||||
require "warp_engine/engine"
|
||||
|
||||
Reference in New Issue
Block a user