warp_engine: CiRepository -> Pipeline rename everywhere, ci_ service prefixes dropped, unknown platform allowed
This commit is contained in:
@@ -60,11 +60,11 @@ ActiveAdmin.register WarpEngine::ApplicationToken, as: "Application Token" do
|
||||
end
|
||||
|
||||
member_action :rotate, method: :post do
|
||||
result = WarpEngine::CiSecretSyncService.new.rotate(resource)
|
||||
result = WarpEngine::SecretSyncService.new.rotate(resource)
|
||||
if result[:rotated]
|
||||
session[:warp_engine_plain_token] = result[:new_token].plain_token
|
||||
redirect_to resource_path(result[:new_token]),
|
||||
notice: "Token rotated and synced to #{result.dig(:sync_result, :synced)&.size || 0} repo(s)"
|
||||
notice: "Token rotated and synced to #{result.dig(:sync_result, :synced)&.size || 0} pipeline(s)"
|
||||
else
|
||||
redirect_to resource_path(resource),
|
||||
alert: "Rotation failed: #{result[:reason]}"
|
||||
@@ -101,13 +101,13 @@ ActiveAdmin.register WarpEngine::ApplicationToken, as: "Application Token" do
|
||||
session[:warp_engine_plain_token] = resource.plain_token
|
||||
|
||||
if WarpEngine.woodpecker_configured?
|
||||
service = WarpEngine::CiSecretSyncService.new
|
||||
repos = service.repos_for_token(resource)
|
||||
if repos.any?
|
||||
result = service.provision(resource.plain_token, repos: repos)
|
||||
flash[:notice] = "Token created and synced to #{result[:synced].size} repo(s)."
|
||||
service = WarpEngine::SecretSyncService.new
|
||||
pipelines = service.pipelines_for_token(resource)
|
||||
if pipelines.any?
|
||||
result = service.provision(resource.plain_token, pipelines: pipelines)
|
||||
flash[:notice] = "Token created and synced to #{result[:synced].size} pipeline(s)."
|
||||
if result[:failed].any?
|
||||
flash[:alert] = "Failed to sync to #{result[:failed].size} repo(s)."
|
||||
flash[:alert] = "Failed to sync to #{result[:failed].size} pipeline(s)."
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -124,7 +124,7 @@ ActiveAdmin.register WarpEngine::ApplicationToken, as: "Application Token" do
|
||||
|
||||
def destroy
|
||||
if WarpEngine.woodpecker_configured?
|
||||
WarpEngine::CiSecretSyncService.new.deprovision(resource)
|
||||
WarpEngine::SecretSyncService.new.deprovision(resource)
|
||||
end
|
||||
resource.revoke!
|
||||
redirect_to collection_path, notice: "Token revoked and Woodpecker secrets cleaned up."
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
ActiveAdmin.register WarpEngine::CiRepository, as: "Pipeline" do
|
||||
ActiveAdmin.register WarpEngine::Pipeline, as: "Pipeline" do
|
||||
actions :index, :show, :edit, :update
|
||||
|
||||
menu parent: "🌀 WarpEngine", priority: 10, label: "🚀 Pipelines"
|
||||
@@ -30,9 +30,9 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "Pipeline" do
|
||||
end
|
||||
}
|
||||
column :last_pipeline_at
|
||||
actions defaults: true do |repo|
|
||||
if repo.active && WarpEngine.woodpecker_configured?
|
||||
item "Trigger", trigger_admin_pipeline_path(repo), method: :post, class: "member_link"
|
||||
actions defaults: true do |pipeline|
|
||||
if pipeline.active && WarpEngine.woodpecker_configured?
|
||||
item "Trigger", trigger_admin_pipeline_path(pipeline), method: :post, class: "member_link"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -76,7 +76,7 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "Pipeline" do
|
||||
para "This repository is inactive.", style: "color:#999;"
|
||||
else
|
||||
begin
|
||||
pipelines = WarpEngine::CiPipelineService.new.list_pipelines(resource, page: 1)
|
||||
pipelines = WarpEngine::PipelineService.new.list_pipelines(resource, page: 1)
|
||||
if pipelines.is_a?(Array) && pipelines.any?
|
||||
table_for pipelines.first(10) do
|
||||
column("Number") { |p| p["number"] }
|
||||
@@ -97,15 +97,15 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "Pipeline" do
|
||||
end
|
||||
|
||||
member_action :trigger, method: :post do
|
||||
repo = WarpEngine::CiRepository.find(params[:id])
|
||||
WarpEngine::CiPipelineService.new.trigger(repo)
|
||||
redirect_to resource_path(repo), notice: "Pipeline triggered for #{repo.full_name}"
|
||||
pipeline = WarpEngine::Pipeline.find(params[:id])
|
||||
WarpEngine::PipelineService.new.trigger(pipeline)
|
||||
redirect_to resource_path(pipeline), notice: "Pipeline triggered for #{pipeline.full_name}"
|
||||
rescue => e
|
||||
redirect_to resource_path(repo), alert: "Trigger failed: #{e.message}"
|
||||
redirect_to resource_path(pipeline), alert: "Trigger failed: #{e.message}"
|
||||
end
|
||||
|
||||
collection_action :sync, method: :post do
|
||||
result = WarpEngine::CiRepoSyncService.new.sync_all
|
||||
result = WarpEngine::PipelineSyncService.new.sync_all
|
||||
redirect_to collection_path,
|
||||
notice: "Synced: #{result[:created].size} new, #{result[:updated].size} updated, #{result[:deactivated].size} deactivated"
|
||||
rescue => e
|
||||
|
||||
@@ -53,9 +53,9 @@ ActiveAdmin.register WarpEngine::Software, as: "Software" do
|
||||
end
|
||||
end
|
||||
|
||||
if resource.ci_repository
|
||||
if resource.pipeline
|
||||
div style: "margin-bottom:8px;" do
|
||||
a href: admin_pipeline_path(resource.ci_repository), style: "display:inline-flex;align-items:center;gap:6px;font-weight:bold;color:#5850ec;" do
|
||||
a href: admin_pipeline_path(resource.pipeline), style: "display:inline-flex;align-items:center;gap:6px;font-weight:bold;color:#5850ec;" do
|
||||
span "🚀", style: "font-size:16px;"
|
||||
text_node "Pipelines"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user